Class WorkflowHandle<TWorkflow>
- Namespace
- Temporalio.Client
- Assembly
- Temporalio.dll
A workflow handle with a known workflow type.
public record WorkflowHandle<TWorkflow> : WorkflowHandle, IEquatable<WorkflowHandle>, IEquatable<WorkflowHandle<TWorkflow>>
Type Parameters
TWorkflow
Workflow class type.
- Inheritance
-
WorkflowHandle<TWorkflow>
- Implements
-
IEquatable<WorkflowHandle<TWorkflow>>
- Derived
- Inherited Members
Constructors
WorkflowHandle(ITemporalClient, string, string?, string?, string?)
A workflow handle with a known workflow type.
public WorkflowHandle(ITemporalClient Client, string Id, string? RunId = null, string? ResultRunId = null, string? FirstExecutionRunId = null)
Parameters
Client
ITemporalClientClient used for workflow handle calls.
Id
stringWorkflow ID.
RunId
stringRun ID used for signals and queries if present to ensure a very specific run to call. This is only set when getting a workflow handle, not when starting a workflow.
ResultRunId
stringRun ID used for get result calls to ensure getting a result starting from this run. This is set the same as a run ID when getting a workflow handle. When starting a workflow, this is set as the resulting run ID.
FirstExecutionRunId
stringRun ID used for cancellation and termination to ensure they happen on a workflow starting with this run ID. This can be set when getting a workflow handle. When starting a workflow, this is set as the resulting run ID if no start signal was provided.
Methods
ExecuteUpdateAsync(Expression<Func<TWorkflow, Task>>, WorkflowUpdateOptions?)
Start an update and wait for it to complete. This is a shortcut for StartUpdateAsync(Expression<Func<TWorkflow, Task>>, WorkflowUpdateStartOptions) + GetResultAsync(RpcOptions?).
public Task ExecuteUpdateAsync(Expression<Func<TWorkflow, Task>> updateCall, WorkflowUpdateOptions? options = null)
Parameters
updateCall
Expression<Func<TWorkflow, Task>>Invocation of workflow update method.
options
WorkflowUpdateOptionsExtra options.
Returns
- Task
Completed update task.
ExecuteUpdateAsync<TUpdateResult>(Expression<Func<TWorkflow, Task<TUpdateResult>>>, WorkflowUpdateOptions?)
Start an update and wait for it to complete. This is a shortcut for StartUpdateAsync<TUpdateResult>(Expression<Func<TWorkflow, Task<TUpdateResult>>>, WorkflowUpdateStartOptions) + GetResultAsync(RpcOptions?).
public Task<TUpdateResult> ExecuteUpdateAsync<TUpdateResult>(Expression<Func<TWorkflow, Task<TUpdateResult>>> updateCall, WorkflowUpdateOptions? options = null)
Parameters
updateCall
Expression<Func<TWorkflow, Task<TUpdateResult>>>Invocation of workflow update method.
options
WorkflowUpdateOptionsExtra options.
Returns
- Task<TUpdateResult>
Completed update task.
Type Parameters
TUpdateResult
Update result type.
QueryAsync<TQueryResult>(Expression<Func<TWorkflow, TQueryResult>>, WorkflowQueryOptions?)
Query a workflow via a lambda that calls a WorkflowQuery attributed method or accesses a WorkflowQuery attributed property.
public Task<TQueryResult> QueryAsync<TQueryResult>(Expression<Func<TWorkflow, TQueryResult>> queryCall, WorkflowQueryOptions? options = null)
Parameters
queryCall
Expression<Func<TWorkflow, TQueryResult>>Invocation of a workflow query method or access of workflow query property.
options
WorkflowQueryOptionsExtra options.
Returns
- Task<TQueryResult>
Query result.
Type Parameters
TQueryResult
Query result type.
Exceptions
- WorkflowQueryFailedException
Query failed on worker.
- WorkflowQueryRejectedException
Query rejected by server based on rejection condition.
- RpcException
Server-side error.
SignalAsync(Expression<Func<TWorkflow, Task>>, WorkflowSignalOptions?)
Signal a workflow via a lambda call to a WorkflowSignal attributed method.
public Task SignalAsync(Expression<Func<TWorkflow, Task>> signalCall, WorkflowSignalOptions? options = null)
Parameters
signalCall
Expression<Func<TWorkflow, Task>>Invocation of a workflow signal method.
options
WorkflowSignalOptionsExtra options.
Returns
- Task
Signal completion task. Means signal was accepted, but may not have been processed by the workflow yet.
Exceptions
- RpcException
Server-side error.
StartUpdateAsync(Expression<Func<TWorkflow, Task>>, WorkflowUpdateStartOptions)
Start a workflow update via a call to a WorkflowUpdate attributed method.
public Task<WorkflowUpdateHandle> StartUpdateAsync(Expression<Func<TWorkflow, Task>> updateCall, WorkflowUpdateStartOptions options)
Parameters
updateCall
Expression<Func<TWorkflow, Task>>Invocation of workflow update method.
options
WorkflowUpdateStartOptionsUpdate options. Currently
WaitForStage
is required.
Returns
- Task<WorkflowUpdateHandle>
Workflow update handle.
StartUpdateAsync<TUpdateResult>(Expression<Func<TWorkflow, Task<TUpdateResult>>>, WorkflowUpdateStartOptions)
Start a workflow update via a call to a WorkflowUpdate attributed method.
public Task<WorkflowUpdateHandle<TUpdateResult>> StartUpdateAsync<TUpdateResult>(Expression<Func<TWorkflow, Task<TUpdateResult>>> updateCall, WorkflowUpdateStartOptions options)
Parameters
updateCall
Expression<Func<TWorkflow, Task<TUpdateResult>>>Invocation of workflow update method.
options
WorkflowUpdateStartOptionsUpdate options. Currently
WaitForStage
is required.
Returns
- Task<WorkflowUpdateHandle<TUpdateResult>>
Workflow update handle.
Type Parameters
TUpdateResult
Update result type.