WorkflowContextType
PackageFCQRS.Workflows
The steps a C# workflow method can await. Each method describes a step; nothing runs until
the step is awaited.
Specification
Kind
Type
Members
19
Examples
0
ActivitySignature
this.Activity
AllSignature
this.All
AwaitChildSignature
this.AwaitChild
BothSignature
this.Both
ChildSignature
this.Child
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Activity | this.Activity | Calls an external system. |
| All | this.All | Runs the steps together and gives every result, in step order. |
| AwaitChild | this.AwaitChild | Waits for a child workflow to end and gives its result. |
| Both | this.Both | Runs two steps together and gives both results, which may have different types: `var (price, customer) = await ctx.Both(priceStep, customerStep);`. |
| Child | this.Child | Starts the registered workflow named `workflow` as a child and waits for its result. |
| NewGuid | this.NewGuid | A new GUID, stored so that replay returns the same value. |
| Now | this.Now | The current UTC time, stored so that replay returns the same value. |
| Race | this.Race | Runs the steps together. |
| Random | this.Random | A random number in [0, 1), stored so that replay returns the same value. |
| Run | this.Run | Turns a workflow method into a step, for `All` and `Race`: `ctx.Run(() => Reserve(ctx, order))`. |
| Send | this.Send | Sends a command under `policy` and gives the first event that `filter` accepts, among the events the aggregate publishes under the step's correlation ID. |
| Send | this.Send | `Send` under a retry policy of its own. |
| Send | this.Send | Sends a command to an aggregate and gives the reply: the event that this command caused. |
| Sleep | this.Sleep | Waits for `duration`. |
| StartChild | this.StartChild | Starts the registered workflow named `workflow` as a child and gives its handle once the child's start is stored. |
| Until | this.Until | Waits until `instant`. |
| Version | this.Version | The version of the workflow's code this instance runs at this point. |
| WaitSignal | this.WaitSignal | Waits for a signal named `name` for at most `timeout`. |
| WaitSignal | this.WaitSignal | Waits for a signal named `name`. |
Calls an external system. The call runs at least once, so pass the context's
`IdempotencyKey` to the external system. `name` is stored and must not change while
instances are running.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | |
| policy | RetryPolicy | |
| run | Func<AttemptContext, Task<'T>> |
Returns
Step<'T>
Runs the steps together and gives every result, in step order.
Parameters
| Name | Type | Description |
|---|---|---|
| steps | Step<'T>[] |
Returns
Step<IReadOnlyList<'T>>
Waits for a child workflow to end and gives its result.
Parameters
| Name | Type | Description |
|---|---|---|
| handle | ChildHandle<'TResult> |
Returns
Step<'TResult>
Runs two steps together and gives both results, which may have different types:
`var (price, customer) = await ctx.Both(priceStep, customerStep);`. Both results are
stored. If one step fails, the other is abandoned and the failure is raised here. This is
`and!` in F#.
Parameters
| Name | Type | Description |
|---|---|---|
| first | Step<'A> | |
| second | Step<'B> |
Returns
Step<'A * 'B>
Starts the registered workflow named `workflow` as a child and waits for its result.
Parameters
| Name | Type | Description |
|---|---|---|
| workflow | string | |
| input | 'TInput |
Returns
Step<'TResult>
A new GUID, stored so that replay returns the same value.
Returns
Step<Guid>
The current UTC time, stored so that replay returns the same value.
Returns
Step<DateTime>
Runs the steps together. The first to finish decides the result, and the others are abandoned.
Parameters
| Name | Type | Description |
|---|---|---|
| steps | Step<'T>[] |
Returns
Step<'T>
A random number in [0, 1), stored so that replay returns the same value.
Returns
Step<float>
Turns a workflow method into a step, for `All` and `Race`: `ctx.Run(() => Reserve(ctx, order))`.
Parameters
| Name | Type | Description |
|---|---|---|
| method | Func<WorkflowTask<'T>> |
Returns
Step<'T>
Sends a command under `policy` and gives the first event that `filter` accepts, among the
events the aggregate publishes under the step's correlation ID. The event need not be the
reply to this command: a saga's commands carry the correlation ID of the command that
started the saga. The wait is in memory. An event published while no attempt listens, for
example during a restart, is not seen. Each attempt listens for the policy's attempt
timeout, or for `akka.fcqrs.command-timeout` when the policy sets none, and then the command
is sent again. The aggregate must answer a repeated command with an event
the filter accepts once the outcome is known. Wait for a signal when the event must not be
missed. `filter` must depend on the event alone.
Parameters
| Name | Type | Description |
|---|---|---|
| policy | RetryPolicy | |
| aggregate | AggregateFactory | |
| aggregateId | string | |
| command | 'TCommand | |
| filter | Func<'TEvent, bool> |
Returns
Step<'TEvent>
`Send` under a retry policy of its own.
Parameters
| Name | Type | Description |
|---|---|---|
| policy | RetryPolicy | |
| aggregate | AggregateFactory | |
| aggregateId | string | |
| command | 'TCommand |
Returns
Step<'TEvent>
Sends a command to an aggregate and gives the reply: the event that this command caused.
An event that another command caused under the same correlation ID, such as a command of
the saga this one started, is not taken. The aggregate must answer a repeated command with
the same verdict. With no reply for five minutes the step fails as `OutcomeUnknown`.
Parameters
| Name | Type | Description |
|---|---|---|
| aggregate | AggregateFactory | |
| aggregateId | string | |
| command | 'TCommand |
Returns
Step<'TEvent>
Waits for `duration`. The due time is stored, so a restart does not postpone it.
Parameters
| Name | Type | Description |
|---|---|---|
| duration | TimeSpan |
Returns
Step
Starts the registered workflow named `workflow` as a child and gives its handle once the
child's start is stored. A child that is never awaited outlives this workflow. If this
workflow is cancelled while the start is in flight, the child is cancelled too.
Parameters
| Name | Type | Description |
|---|---|---|
| workflow | string | |
| input | 'TInput |
Returns
Step<ChildHandle<'TResult>>
Waits until `instant`. A time that names no zone (`DateTimeKind.Unspecified`) is read as
UTC, and a local time is converted to UTC.
Parameters
| Name | Type | Description |
|---|---|---|
| instant | DateTime |
Returns
Step
The version of the workflow's code this instance runs at this point. See `version` in F#.
`changeId` names the change, and the number is stored under the step's position and this
name: use a name once per position, keep it when a later change raises `latest`, and never
rename it while instances that ran it exist.
Parameters
| Name | Type | Description |
|---|---|---|
| changeId | string | |
| latest | int |
Returns
Step<int>
Waits for a signal named `name` for at most `timeout`.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | |
| timeout | TimeSpan |
Returns
Step<SignalOutcome<'T>>