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

NameSignatureSynopsis
Activitythis.ActivityCalls an external system.
Allthis.AllRuns the steps together and gives every result, in step order.
AwaitChildthis.AwaitChildWaits for a child workflow to end and gives its result.
Boththis.BothRuns two steps together and gives both results, which may have different types: `var (price, customer) = await ctx.Both(priceStep, customerStep);`.
Childthis.ChildStarts the registered workflow named `workflow` as a child and waits for its result.
NewGuidthis.NewGuidA new GUID, stored so that replay returns the same value.
Nowthis.NowThe current UTC time, stored so that replay returns the same value.
Racethis.RaceRuns the steps together.
Randomthis.RandomA random number in [0, 1), stored so that replay returns the same value.
Runthis.RunTurns a workflow method into a step, for `All` and `Race`: `ctx.Run(() => Reserve(ctx, order))`.
Sendthis.SendSends a command under `policy` and gives the first event that `filter` accepts, among the events the aggregate publishes under the step's correlation ID.
Sendthis.Send`Send` under a retry policy of its own.
Sendthis.SendSends a command to an aggregate and gives the reply: the event that this command caused.
Sleepthis.SleepWaits for `duration`.
StartChildthis.StartChildStarts the registered workflow named `workflow` as a child and gives its handle once the child's start is stored.
Untilthis.UntilWaits until `instant`.
Versionthis.VersionThe version of the workflow's code this instance runs at this point.
WaitSignalthis.WaitSignalWaits for a signal named `name` for at most `timeout`.
WaitSignalthis.WaitSignalWaits for a signal named `name`.

Activity

this.Activity
Member
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

NameTypeDescription
namestring
policyRetryPolicy
runFunc<AttemptContext, Task<'T>>

Returns

Step<'T>

All

this.All
Member
Runs the steps together and gives every result, in step order.

Parameters

NameTypeDescription
stepsStep<'T>[]

Returns

Step<IReadOnlyList<'T>>

AwaitChild

this.AwaitChild
Member
Waits for a child workflow to end and gives its result.

Parameters

NameTypeDescription
handleChildHandle<'TResult>

Returns

Step<'TResult>

Both

this.Both
Member
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

NameTypeDescription
firstStep<'A>
secondStep<'B>

Returns

Step<'A * 'B>

Child

this.Child
Member
Starts the registered workflow named `workflow` as a child and waits for its result.

Parameters

NameTypeDescription
workflowstring
input'TInput

Returns

Step<'TResult>

NewGuid

this.NewGuid
Member
A new GUID, stored so that replay returns the same value.

Returns

Step<Guid>

Now

this.Now
Member
The current UTC time, stored so that replay returns the same value.

Returns

Step<DateTime>

Race

this.Race
Member
Runs the steps together. The first to finish decides the result, and the others are abandoned.

Parameters

NameTypeDescription
stepsStep<'T>[]

Returns

Step<'T>

Random

this.Random
Member
A random number in [0, 1), stored so that replay returns the same value.

Returns

Step<float>

Run

this.Run
Member
Turns a workflow method into a step, for `All` and `Race`: `ctx.Run(() => Reserve(ctx, order))`.

Parameters

NameTypeDescription
methodFunc<WorkflowTask<'T>>

Returns

Step<'T>

Send

this.Send
Member
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

NameTypeDescription
policyRetryPolicy
aggregateAggregateFactory
aggregateIdstring
command'TCommand
filterFunc<'TEvent, bool>

Returns

Step<'TEvent>

Send

this.Send
Member
`Send` under a retry policy of its own.

Parameters

NameTypeDescription
policyRetryPolicy
aggregateAggregateFactory
aggregateIdstring
command'TCommand

Returns

Step<'TEvent>

Send

this.Send
Member
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

NameTypeDescription
aggregateAggregateFactory
aggregateIdstring
command'TCommand

Returns

Step<'TEvent>

Sleep

this.Sleep
Member
Waits for `duration`. The due time is stored, so a restart does not postpone it.

Parameters

NameTypeDescription
durationTimeSpan

Returns

Step

StartChild

this.StartChild
Member
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

NameTypeDescription
workflowstring
input'TInput

Returns

Step<ChildHandle<'TResult>>

Until

this.Until
Member
Waits until `instant`. A time that names no zone (`DateTimeKind.Unspecified`) is read as UTC, and a local time is converted to UTC.

Parameters

NameTypeDescription
instantDateTime

Returns

Step

Version

this.Version
Member
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

NameTypeDescription
changeIdstring
latestint

Returns

Step<int>

WaitSignal

this.WaitSignal
Member
Waits for a signal named `name` for at most `timeout`.

Parameters

NameTypeDescription
namestring
timeoutTimeSpan

Returns

Step<SignalOutcome<'T>>

WaitSignal

this.WaitSignal
Member
Waits for a signal named `name`. Stored signals with one name are consumed oldest first.

Parameters

NameTypeDescription
namestring

Returns

Step<'T>