Table of Contents

Class Workflow

Namespace
Temporalio.Workflows
Assembly
Temporalio.dll

Static class with all calls that can be made from a workflow. Properties and methods on this class cannot be used outside of a workflow (with the obvious exception of InWorkflow).

public static class Workflow
Inheritance
Workflow
Inherited Members

Properties

CancellationToken

Gets the cancellation token for the workflow.

public static CancellationToken CancellationToken { get; }

Property Value

CancellationToken

Remarks

This token is cancelled when the workflow is cancelled. When cancellation token is not provided to any method in this class, this cancellation token is the default.

InWorkflow

Gets a value indicating whether this code is currently running in a workflow.

public static bool InWorkflow { get; }

Property Value

bool

Info

Gets information about the workflow.

public static WorkflowInfo Info { get; }

Property Value

WorkflowInfo

Logger

Gets the logger for the workflow. This is scoped with logger information and does not log during replay.

public static ILogger Logger { get; }

Property Value

ILogger

Memo

Gets the workflow memo.

public static IReadOnlyDictionary<string, IRawValue> Memo { get; }

Property Value

IReadOnlyDictionary<string, IRawValue>

Remarks

This is read-only from the workflow author perspective. To update use UpsertMemo(params MemoUpdate[]). This always returns the same instance. Any workflow memo updates are immediately reflected on the returned instance, so it is not immutable.

Queries

Gets queries for this workflow.

public static IDictionary<string, WorkflowQueryDefinition> Queries { get; }

Property Value

IDictionary<string, WorkflowQueryDefinition>

Remarks

This dictionary can be mutated during workflow run. However, users are strongly encouraged to use fixed methods with the [WorkflowQuery] attribute.

Random

Gets a random instance that is deterministic for workflow use.

public static Random Random { get; }

Property Value

Random

Remarks

This instance should be accessed each time needed, not stored. This instance may be recreated with a different seed in special cases (e.g. workflow reset). Do not use any other randomization inside workflow code.

Signals

Gets signals for this workflow.

public static IDictionary<string, WorkflowSignalDefinition> Signals { get; }

Property Value

IDictionary<string, WorkflowSignalDefinition>

Remarks

This dictionary can be mutated during workflow run. However, users are strongly encouraged to use fixed methods with the [WorkflowSignal] attribute.

TypedSearchAttributes

Gets the workflow search attributes.

public static SearchAttributeCollection TypedSearchAttributes { get; }

Property Value

SearchAttributeCollection

Remarks

This is read-only from the workflow author perspective. To update use UpsertTypedSearchAttributes(params SearchAttributeUpdate[]). This always returns the same instance. Any workflow search attribute updates are immediately reflected on the returned instance, so it is not immutable.

UtcNow

Gets the current timestamp for this workflow.

public static DateTime UtcNow { get; }

Property Value

DateTime

Remarks

This value is deterministic and safe for replays. Do not use normal UtcNow or anything else dealing with system time in workflows.

Methods

CreateContinueAsNewException(string, IReadOnlyCollection<object?>, ContinueAsNewOptions?)

Create an exception that, when thrown out of the workflow, will continue-as-new with the given workflow.

public static ContinueAsNewException CreateContinueAsNewException(string workflow, IReadOnlyCollection<object?> args, ContinueAsNewOptions? options = null)

Parameters

workflow string

Workflow name.

args IReadOnlyCollection<object>

Workflow arguments.

options ContinueAsNewOptions

Continue as new options.

Returns

ContinueAsNewException

Exception for continuing as new.

CreateContinueAsNewException<TWorkflow>(Expression<Func<TWorkflow, Task>>, ContinueAsNewOptions?)

Create an exception via lambda invoking the run method that, when thrown out of the workflow, will continue-as-new with the given workflow.

public static ContinueAsNewException CreateContinueAsNewException<TWorkflow>(Expression<Func<TWorkflow, Task>> workflowRunCall, ContinueAsNewOptions? options = null)

Parameters

workflowRunCall Expression<Func<TWorkflow, Task>>

Invocation of workflow run method with a result.

options ContinueAsNewOptions

Continue as new options.

Returns

ContinueAsNewException

Exception for continuing as new.

Type Parameters

TWorkflow

Workflow class type.

CreateContinueAsNewException<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>>, ContinueAsNewOptions?)

Create an exception via lambda invoking the run method that, when thrown out of the workflow, will continue-as-new with the given workflow.

public static ContinueAsNewException CreateContinueAsNewException<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>> workflowRunCall, ContinueAsNewOptions? options = null)

Parameters

workflowRunCall Expression<Func<TWorkflow, Task<TResult>>>

Invocation of workflow run method with a result.

options ContinueAsNewOptions

Continue as new options.

Returns

ContinueAsNewException

Exception for continuing as new.

Type Parameters

TWorkflow

Workflow class type.

TResult

Workflow result type.

DelayAsync(int, CancellationToken?)

Sleep in a workflow for the given time. See documentation of DelayAsync(TimeSpan, CancellationToken?) for details.

public static Task DelayAsync(int millisecondsDelay, CancellationToken? cancellationToken = null)

Parameters

millisecondsDelay int

Delay amount. See documentation of DelayAsync(TimeSpan, CancellationToken?) for details.

cancellationToken CancellationToken?

Cancellation token. See documentation of DelayAsync(TimeSpan, CancellationToken?) for details.

Returns

Task

Task for completion. See documentation of DelayAsync(TimeSpan, CancellationToken?) for details.

See Also

DelayAsync(TimeSpan, CancellationToken?)

Sleep in a workflow for the given time.

public static Task DelayAsync(TimeSpan delay, CancellationToken? cancellationToken = null)

Parameters

delay TimeSpan

Amount of time to sleep.

cancellationToken CancellationToken?

Cancellation token. If unset, this defaults to CancellationToken.

Returns

Task

Task that is complete when sleep completes.

Remarks

The delay value can be Infinite or InfiniteTimeSpan but otherwise cannot be negative. A server-side timer is not created for infinite delays, so it is non-deterministic to change a timer to/from infinite from/to an actual value.

If the delay is 0, it is assumed to be 1 millisecond and still results in a server-side timer. Since Temporal timers are server-side, timer resolution may not end up as precise as system timers.

DeprecatePatch(string)

Mark a patch as deprecated.

public static void DeprecatePatch(string patchID)

Parameters

patchID string

Patch ID.

Remarks

This marks a workflow that had Patched(string) in a previous version of the code as no longer applicable because all workflows that use the old code path are done and will never be queried again. Therefore the old code path is removed as well.

ExecuteActivityAsync(Expression<Action>, ActivityOptions)

Execute a static non-async activity without result via lambda.

public static Task ExecuteActivityAsync(Expression<Action> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Action>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync(Expression<Func<Task>>, ActivityOptions)

Execute a static async activity without result via lambda.

public static Task ExecuteActivityAsync(Expression<Func<Task>> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Func<Task>>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync(string, IReadOnlyCollection<object?>, ActivityOptions)

Execute an activity by name with no result and any number of arguments.

public static Task ExecuteActivityAsync(string activity, IReadOnlyCollection<object?> args, ActivityOptions options)

Parameters

activity string

Activity name to execute.

args IReadOnlyCollection<object>

Activity arguments.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync<TActivityInstance>(Expression<Action<TActivityInstance>>, ActivityOptions)

Execute a non-static non-async activity without result via lambda.

public static Task ExecuteActivityAsync<TActivityInstance>(Expression<Action<TActivityInstance>> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Action<TActivityInstance>>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync<TResult>(Expression<Func<Task<TResult>>>, ActivityOptions)

Execute a static async activity with result via lambda.

public static Task<TResult> ExecuteActivityAsync<TResult>(Expression<Func<Task<TResult>>> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Func<Task<TResult>>>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync<TActivityInstance>(Expression<Func<TActivityInstance, Task>>, ActivityOptions)

Execute a non-static async activity without result via lambda.

public static Task ExecuteActivityAsync<TActivityInstance>(Expression<Func<TActivityInstance, Task>> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Func<TActivityInstance, Task>>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync<TResult>(Expression<Func<TResult>>, ActivityOptions)

Execute a static non-async activity with result via lambda.

public static Task<TResult> ExecuteActivityAsync<TResult>(Expression<Func<TResult>> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Func<TResult>>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync<TResult>(string, IReadOnlyCollection<object?>, ActivityOptions)

Execute an activity by name with a result and any number of arguments.

public static Task<TResult> ExecuteActivityAsync<TResult>(string activity, IReadOnlyCollection<object?> args, ActivityOptions options)

Parameters

activity string

Activity name to execute.

args IReadOnlyCollection<object>

Activity arguments.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, Task<TResult>>>, ActivityOptions)

Execute a non-static async activity with result via lambda.

public static Task<TResult> ExecuteActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, Task<TResult>>> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Func<TActivityInstance, Task<TResult>>>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, TResult>>, ActivityOptions)

Execute a non-static non-async activity with result via lambda.

public static Task<TResult> ExecuteActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, TResult>> activityCall, ActivityOptions options)

Parameters

activityCall Expression<Func<TActivityInstance, TResult>>

Invocation of activity method.

options ActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteChildWorkflowAsync(string, IReadOnlyCollection<object?>, ChildWorkflowOptions?)

public static Task ExecuteChildWorkflowAsync(string workflow, IReadOnlyCollection<object?> args, ChildWorkflowOptions? options = null)

Parameters

workflow string

Workflow name to execute.

args IReadOnlyCollection<object>

Workflow arguments.

options ChildWorkflowOptions

Workflow options.

Returns

Task

Task for workflow completion.

ExecuteChildWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>>, ChildWorkflowOptions?)

public static Task ExecuteChildWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>> workflowRunCall, ChildWorkflowOptions? options = null)

Parameters

workflowRunCall Expression<Func<TWorkflow, Task>>

Invocation of workflow run method with a result.

options ChildWorkflowOptions

Workflow options.

Returns

Task

Task for workflow completion.

Type Parameters

TWorkflow

Workflow class type.

ExecuteChildWorkflowAsync<TResult>(string, IReadOnlyCollection<object?>, ChildWorkflowOptions?)

public static Task<TResult> ExecuteChildWorkflowAsync<TResult>(string workflow, IReadOnlyCollection<object?> args, ChildWorkflowOptions? options = null)

Parameters

workflow string

Workflow name to execute.

args IReadOnlyCollection<object>

Workflow arguments.

options ChildWorkflowOptions

Workflow options.

Returns

Task<TResult>

Task for workflow completion.

Type Parameters

TResult

Workflow result type.

ExecuteChildWorkflowAsync<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>>, ChildWorkflowOptions?)

public static Task<TResult> ExecuteChildWorkflowAsync<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>> workflowRunCall, ChildWorkflowOptions? options = null)

Parameters

workflowRunCall Expression<Func<TWorkflow, Task<TResult>>>

Invocation of workflow run method with a result.

options ChildWorkflowOptions

Workflow options.

Returns

Task<TResult>

Task for workflow completion.

Type Parameters

TWorkflow

Workflow class type.

TResult

Workflow result type.

ExecuteLocalActivityAsync(Expression<Action>, LocalActivityOptions)

Execute a static non-async local activity without result via lambda.

public static Task ExecuteLocalActivityAsync(Expression<Action> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Action>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync(Expression<Func<Task>>, LocalActivityOptions)

Execute a static async local activity without result via lambda.

public static Task ExecuteLocalActivityAsync(Expression<Func<Task>> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Func<Task>>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync(string, IReadOnlyCollection<object?>, LocalActivityOptions)

Execute a local activity by name with no result and any number of arguments.

public static Task ExecuteLocalActivityAsync(string activity, IReadOnlyCollection<object?> args, LocalActivityOptions options)

Parameters

activity string

Activity name to execute.

args IReadOnlyCollection<object>

Activity arguments.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync<TActivityInstance>(Expression<Action<TActivityInstance>>, LocalActivityOptions)

Execute a non-static non-async local activity without result via lambda.

public static Task ExecuteLocalActivityAsync<TActivityInstance>(Expression<Action<TActivityInstance>> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Action<TActivityInstance>>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync<TResult>(Expression<Func<Task<TResult>>>, LocalActivityOptions)

Execute a static async local activity with result via lambda.

public static Task<TResult> ExecuteLocalActivityAsync<TResult>(Expression<Func<Task<TResult>>> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Func<Task<TResult>>>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync<TActivityInstance>(Expression<Func<TActivityInstance, Task>>, LocalActivityOptions)

Execute a non-static async local activity without result via lambda.

public static Task ExecuteLocalActivityAsync<TActivityInstance>(Expression<Func<TActivityInstance, Task>> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Func<TActivityInstance, Task>>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync<TResult>(Expression<Func<TResult>>, LocalActivityOptions)

Execute a static non-async local activity with result via lambda.

public static Task<TResult> ExecuteLocalActivityAsync<TResult>(Expression<Func<TResult>> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Func<TResult>>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync<TResult>(string, IReadOnlyCollection<object?>, LocalActivityOptions)

Execute a local activity by name with a result and any number of arguments.

public static Task<TResult> ExecuteLocalActivityAsync<TResult>(string activity, IReadOnlyCollection<object?> args, LocalActivityOptions options)

Parameters

activity string

Activity name to execute.

args IReadOnlyCollection<object>

Activity arguments.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, Task<TResult>>>, LocalActivityOptions)

Execute a non-static async local activity with result via lambda.

public static Task<TResult> ExecuteLocalActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, Task<TResult>>> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Func<TActivityInstance, Task<TResult>>>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

ExecuteLocalActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, TResult>>, LocalActivityOptions)

Execute a non-static non-async local activity with result via lambda.

public static Task<TResult> ExecuteLocalActivityAsync<TActivityInstance, TResult>(Expression<Func<TActivityInstance, TResult>> activityCall, LocalActivityOptions options)

Parameters

activityCall Expression<Func<TActivityInstance, TResult>>

Invocation of activity method.

options LocalActivityOptions

Activity options. This is required and either ScheduleToCloseTimeout or StartToCloseTimeout must be set.

Returns

Task<TResult>

Task for completion with result.

Type Parameters

TActivityInstance

Activity class type.

TResult

Activity result type.

Remarks

The task will throw an ActivityFailureException on activity failure.

GetExternalWorkflowHandle(string, string?)

Get a handle to an external workflow for cancelling and issuing signals.

public static ExternalWorkflowHandle GetExternalWorkflowHandle(string id, string? runID = null)

Parameters

id string

Workflow ID.

runID string

Optional workflow run ID.

Returns

ExternalWorkflowHandle

External workflow handle.

GetExternalWorkflowHandle<TWorkflow>(string, string?)

Get a handle to an external workflow for cancelling and issuing signals.

public static ExternalWorkflowHandle<TWorkflow> GetExternalWorkflowHandle<TWorkflow>(string id, string? runID = null)

Parameters

id string

Workflow ID.

runID string

Optional workflow run ID.

Returns

ExternalWorkflowHandle<TWorkflow>

External workflow handle.

Type Parameters

TWorkflow

Workflow class type.

NewGuid()

Deterministically create a new Guid similar to NewGuid() (which cannot be used in workflows). The resulting GUID intentionally represents a version 4 UUID.

public static Guid NewGuid()

Returns

Guid

A new GUID.

Patched(string)

Patch a workflow.

public static bool Patched(string patchID)

Parameters

patchID string

Patch ID.

Returns

bool

True if this should take the newer patch, false if it should take the old path.

Remarks

When called, this will only return true if code should take the newer path which means this is either not replaying or is replaying and has seen this patch before. Results for successive calls to this function for the same ID and workflow are memoized.

Use DeprecatePatch(string) when all workflows are done and will never be queried again. The old code path can be removed at that time too.

StartChildWorkflowAsync(string, IReadOnlyCollection<object?>, ChildWorkflowOptions?)

Start a child workflow by name.

public static Task<ChildWorkflowHandle> StartChildWorkflowAsync(string workflow, IReadOnlyCollection<object?> args, ChildWorkflowOptions? options = null)

Parameters

workflow string

Workflow name to execute.

args IReadOnlyCollection<object>

Workflow arguments.

options ChildWorkflowOptions

Workflow options.

Returns

Task<ChildWorkflowHandle>

The child workflow handle once started.

Remarks

The task can throw a WorkflowAlreadyStartedException if an ID is given in the options but it is already running.

StartChildWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>>, ChildWorkflowOptions?)

Start a child workflow via lambda invoking the run method.

public static Task<ChildWorkflowHandle<TWorkflow>> StartChildWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>> workflowRunCall, ChildWorkflowOptions? options = null)

Parameters

workflowRunCall Expression<Func<TWorkflow, Task>>

Invocation of workflow run method without a result.

options ChildWorkflowOptions

Workflow options.

Returns

Task<ChildWorkflowHandle<TWorkflow>>

The child workflow handle once started.

Type Parameters

TWorkflow

Workflow class type.

Remarks

The task can throw a WorkflowAlreadyStartedException if an ID is given in the options but it is already running.

StartChildWorkflowAsync<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>>, ChildWorkflowOptions?)

Start a child workflow via lambda invoking the run method.

public static Task<ChildWorkflowHandle<TWorkflow, TResult>> StartChildWorkflowAsync<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>> workflowRunCall, ChildWorkflowOptions? options = null)

Parameters

workflowRunCall Expression<Func<TWorkflow, Task<TResult>>>

Invocation of workflow run method with a result.

options ChildWorkflowOptions

Workflow options.

Returns

Task<ChildWorkflowHandle<TWorkflow, TResult>>

The child workflow handle once started.

Type Parameters

TWorkflow

Workflow class type.

TResult

Workflow result type.

Remarks

The task can throw a WorkflowAlreadyStartedException if an ID is given in the options but it is already running.

UpsertMemo(params MemoUpdate[])

Issue updates to the workflow memo.

public static void UpsertMemo(params MemoUpdate[] updates)

Parameters

updates MemoUpdate[]

Updates to issue.

Exceptions

ArgumentException

If no updates given, two updates are given for a key, or an update value cannot be converted.

UpsertTypedSearchAttributes(params SearchAttributeUpdate[])

Issue updates to the workflow search attributes.

public static void UpsertTypedSearchAttributes(params SearchAttributeUpdate[] updates)

Parameters

updates SearchAttributeUpdate[]

Updates to issue.

Exceptions

ArgumentException

If no updates given or two updates are given for a key.

WaitConditionAsync(Func<bool>, int, CancellationToken?)

Wait for the given function to return true or a timeout. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

public static Task<bool> WaitConditionAsync(Func<bool> conditionCheck, int timeoutMilliseconds, CancellationToken? cancellationToken = null)

Parameters

conditionCheck Func<bool>

Condition function. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

timeoutMilliseconds int

Timeout milliseconds. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

cancellationToken CancellationToken?

Cancellation token. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

Returns

Task<bool>

Task when condition becomes true or a timeout has occurred. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

See Also

WaitConditionAsync(Func<bool>, CancellationToken?)

Wait for the given function to return true. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

public static Task WaitConditionAsync(Func<bool> conditionCheck, CancellationToken? cancellationToken = null)

Parameters

conditionCheck Func<bool>

Condition function. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

cancellationToken CancellationToken?

Cancellation token. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

Returns

Task

Task when condition becomes true. See documentation of WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?) for more details.

See Also

WaitConditionAsync(Func<bool>, TimeSpan, CancellationToken?)

Wait for the given function to return true or a timeout.

public static Task<bool> WaitConditionAsync(Func<bool> conditionCheck, TimeSpan timeout, CancellationToken? cancellationToken = null)

Parameters

conditionCheck Func<bool>

Condition function.

timeout TimeSpan

Optional timeout for waiting.

cancellationToken CancellationToken?

Cancellation token. If unset, this defaults to CancellationToken.

Returns

Task<bool>

Task with true when condition becomes true or false if a timeout occurs.

Remarks

The conditionCheck function is invoked on each iteration of the event loop. Therefore, it should be fast and side-effect free.