Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Actors] Add ttl and data to API reference #4188

Merged
merged 9 commits into from
Jun 19, 2024
23 changes: 22 additions & 1 deletion daprdocs/content/en/reference/api/actors_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Parameter | Description

#### Examples

> Note, the following example uses the `ttlInSeconds` field, which requires the [`ActorStateTTL` feature enabled]]({{< ref "support-preview-features.md" >}}).
> Note, the following example uses the `ttlInSeconds` field, which requires the [`ActorStateTTL` feature enabled]({{< ref "support-preview-features.md" >}}).

```shell
curl -X POST http://localhost:3500/v1.0/actors/stormtrooper/50/state \
Expand Down Expand Up @@ -202,6 +202,8 @@ A JSON object with the following fields:
|-------|--------------|
| `dueTime` | Specifies the time after which the reminder is invoked. Its format should be [time.ParseDuration](https://pkg.go.dev/time#ParseDuration)
| `period` | Specifies the period between different invocations. Its format should be [time.ParseDuration](https://pkg.go.dev/time#ParseDuration) or ISO 8601 duration format with optional recurrence.
| `ttl` | Sets time at or interval after which the timer or reminder will be expired and deleted. Its format should be [time.ParseDuration format](https://pkg.go.dev/time#ParseDuration), RFC3339 date format, or ISO 8601 duration format.
| `data` |
hhunter-ms marked this conversation as resolved.
Show resolved Hide resolved

`period` field supports `time.Duration` format and ISO 8601 format with some limitations. For `period`, only duration format of ISO 8601 duration `Rn/PnYnMnWnDTnHnMnS` is supported. `Rn/` specifies that the reminder will be invoked `n` number of times.

Expand Down Expand Up @@ -237,6 +239,25 @@ To configure the reminder to fire only once, the period should be set to empty s
}
```

When you specify the repitiion number in both `period` and `ttl`, the timer/reminder will be stopped when either condition is met. The following example has a timer with a `period` of 3 seconds (in ISO 8601 duration format) and a `ttl` of 20 seconds. This timer fires immediately after registration, then every 3 seconds after that for the duration of 20 seconds.
msfussell marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"period":"PT3S",
"ttl":"20s"
}
```

Need description for data.

```json
{
"data": "someData",
"dueTime": "1m",
"period": "20s"
}
```

#### HTTP Response Codes

Code | Description
Expand Down
Loading