mirror of https://github.com/dapr/docs.git
Merge branch 'issue_3216' of https://github.com/hhunter-ms/docs into issue_3216
This commit is contained in:
commit
be16f18b2b
|
@ -8,7 +8,7 @@ aliases:
|
|||
- "/developing-applications/building-blocks/actors/actors-background"
|
||||
---
|
||||
|
||||
[Actor reminders]({{< ref "howto-actors-partitioning.md#actor-reminders" >}}) are persisted and continue to be triggered after sidecar restarts. Applications with multiple reminders registered can experience the following issues:
|
||||
[Actor reminders]({{< ref "actors-timers-reminders.md#actor-reminders" >}}) are persisted and continue to be triggered after sidecar restarts. Applications with multiple reminders registered can experience the following issues:
|
||||
|
||||
- Low throughput on reminders registration and de-registration
|
||||
- Limited number of reminders registered based on the single record size limit on the state store
|
||||
|
|
|
@ -31,25 +31,27 @@ Dapr Workflow solves these complexities by allowing you to implement the task ch
|
|||
|
||||
```csharp
|
||||
// Expotential backoff retry policy that survives long outages
|
||||
var retryPolicy = TaskOptions.FromRetryPolicy(new RetryPolicy(
|
||||
maxNumberOfAttempts: 10,
|
||||
firstRetryInterval: TimeSpan.FromMinutes(1),
|
||||
backoffCoefficient: 2.0,
|
||||
maxRetryInterval: TimeSpan.FromHours(1)));
|
||||
var retryOptions = new WorkflowTaskOptions
|
||||
{
|
||||
RetryPolicy = new WorkflowRetryPolicy(
|
||||
firstRetryInterval: TimeSpan.FromMinutes(1),
|
||||
backoffCoefficient: 2.0,
|
||||
maxRetryInterval: TimeSpan.FromHours(1),
|
||||
maxNumberOfAttempts: 10),
|
||||
};
|
||||
|
||||
// Task failures are surfaced as ordinary .NET exceptions
|
||||
try
|
||||
{
|
||||
var result1 = await context.CallActivityAsync<string>("Step1", wfInput, retryPolicy);
|
||||
var result2 = await context.CallActivityAsync<byte[]>("Step2", result1, retryPolicy);
|
||||
var result3 = await context.CallActivityAsync<long[]>("Step3", result2, retryPolicy);
|
||||
var result4 = await context.CallActivityAsync<Guid[]>("Step4", result3, retryPolicy);
|
||||
var result1 = await context.CallActivityAsync<string>("Step1", wfInput, retryOptions);
|
||||
var result2 = await context.CallActivityAsync<byte[]>("Step2", result1, retryOptions);
|
||||
var result3 = await context.CallActivityAsync<long[]>("Step3", result2, retryOptions);
|
||||
var result4 = await context.CallActivityAsync<Guid[]>("Step4", result3, retryOptions);
|
||||
return string.Join(", ", result4);
|
||||
}
|
||||
catch (TaskFailedException)
|
||||
catch (TaskFailedException) // Task failures are surfaced as TaskFailedException
|
||||
{
|
||||
// Retries expired - apply custom compensation logic
|
||||
await context.CallActivityAsync<long[]>("MyCompensation", options: retryPolicy);
|
||||
await context.CallActivityAsync<long[]>("MyCompensation", options: retryOptions);
|
||||
throw;
|
||||
}
|
||||
```
|
||||
|
|
|
@ -187,7 +187,7 @@ Creates a persistent reminder for an actor.
|
|||
POST/PUT http://localhost:<daprPort>/v1.0/actors/<actorType>/<actorId>/reminders/<name>
|
||||
```
|
||||
|
||||
#### Request Body
|
||||
#### Reminder request body
|
||||
|
||||
A JSON object with the following fields:
|
||||
|
||||
|
@ -351,7 +351,8 @@ Creates a timer for an actor.
|
|||
POST/PUT http://localhost:<daprPort>/v1.0/actors/<actorType>/<actorId>/timers/<name>
|
||||
```
|
||||
|
||||
Body:
|
||||
#### Timer request body:
|
||||
The format for the timer request body is the same as for [actor reminders]({{< ref "#reminder-request-body" >}}). For example:
|
||||
|
||||
The following specifies a `dueTime` of 3 seconds and a period of 7 seconds.
|
||||
|
||||
|
@ -484,6 +485,16 @@ Parameter | Description
|
|||
`maxStackDepth` | A value in the reentrancy configuration that controls how many reentrant calls be made to the same actor.
|
||||
`entitiesConfig` | Array of entity configurations that allow per actor type settings. Any configuration defined here must have an entity that maps back into the root level entities.
|
||||
|
||||
|
||||
{{% alert title="Note" color="primary" %}}
|
||||
Actor settings in configuration for timeouts and intervals use [time.ParseDuration](https://pkg.go.dev/time#ParseDuration) format. You can use string formats to represent durations. For example:
|
||||
- `1h30m` or `1.5h`: A duration of 1 hour and 30 minutes
|
||||
- `1d12h`: A duration of 1 day and 12 hours
|
||||
- `500ms`: A duration of 500 milliseconds
|
||||
- `-30m`: A negative duration of 30 minutes
|
||||
|
||||
{{% /alert %}}
|
||||
|
||||
```json
|
||||
{
|
||||
"entities":["actorType1", "actorType2"],
|
||||
|
|
Loading…
Reference in New Issue