Interface ITemporalClient
- Namespace
- Temporalio.Client
- Assembly
- Temporalio.dll
Interface to a client to Temporal.
public interface ITemporalClient : IWorkerClient
- Inherited Members
- Extension Methods
Remarks
Clients are thread-safe and are encouraged to be reused to properly reuse the underlying connection.
Properties
Connection
Gets the connection associated with this client.
ITemporalConnection Connection { get; }
Property Value
OperatorService
Gets the raw gRPC operator service for self-hosted servers. Most users do not need this.
OperatorService OperatorService { get; }
Property Value
OutboundInterceptor
Gets the outbound interceptor in use.
ClientOutboundInterceptor OutboundInterceptor { get; }
Property Value
WorkflowService
Gets the raw gRPC workflow service. Most users do not need this.
WorkflowService WorkflowService { get; }
Property Value
Methods
CountActivitiesAsync(string, ActivityCountOptions?)
Count activities with the given query.
Task<ActivityExecutionCount> CountActivitiesAsync(string query, ActivityCountOptions? options = null)
Parameters
querystringQuery to use for counting.
optionsActivityCountOptionsOptions for the count call.
Returns
- Task<ActivityExecutionCount>
Count information for the activities.
Remarks
WARNING: Standalone activities are experimental.
CountWorkflowsAsync(string, WorkflowCountOptions?)
Count workflows with the given query.
Task<WorkflowExecutionCount> CountWorkflowsAsync(string query, WorkflowCountOptions? options = null)
Parameters
querystringQuery to use for counting.
optionsWorkflowCountOptionsOptions for the count call.
Returns
- Task<WorkflowExecutionCount>
Count information for the workflows.
- See Also
CreateScheduleAsync(string, Schedule, ScheduleOptions?)
Create a schedule and return its handle.
Task<ScheduleHandle> CreateScheduleAsync(string scheduleId, Schedule schedule, ScheduleOptions? options = null)
Parameters
scheduleIdstringUnique ID for the schedule.
scheduleScheduleSchedule to create.
optionsScheduleOptionsOptions for creating the schedule.
Returns
- Task<ScheduleHandle>
Handle to the created schedule.
Remarks
This can throw ScheduleAlreadyRunningException if the ID already exists.
GetActivityHandle(string, string?)
Get a handle for an existing standalone activity with unknown result type.
ActivityHandle GetActivityHandle(string id, string? runId = null)
Parameters
Returns
- ActivityHandle
Created activity handle.
Remarks
WARNING: Standalone activities are experimental.
GetActivityHandle<TResult>(string, string?)
Get a handle for an existing standalone activity with known result type.
ActivityHandle<TResult> GetActivityHandle<TResult>(string id, string? runId = null)
Parameters
Returns
- ActivityHandle<TResult>
Created activity handle.
Type Parameters
TResultResult type of the activity.
Remarks
WARNING: Standalone activities are experimental.
GetAsyncActivityHandle(byte[])
Get a handle to complete an activity asynchronously using its task token.
AsyncActivityHandle GetAsyncActivityHandle(byte[] taskToken)
Parameters
taskTokenbyte[]Task token for the activity.
Returns
- AsyncActivityHandle
Async activity handle.
GetAsyncActivityHandle(string, string, string)
Get a handle to complete an activity asynchronously using its qualified identifiers.
AsyncActivityHandle GetAsyncActivityHandle(string workflowId, string runId, string activityId)
Parameters
workflowIdstringID for the activity's workflow.
runIdstringRun ID for the activity's workflow.
activityIdstringID for the activity.
Returns
- AsyncActivityHandle
Async activity handle.
GetScheduleHandle(string)
Gets the schedule handle for the given ID.
ScheduleHandle GetScheduleHandle(string scheduleId)
Parameters
scheduleIdstringSchedule ID to get the handle for.
Returns
- ScheduleHandle
Schedule handle.
GetWorkerBuildIdCompatibilityAsync(string, int, RpcOptions?)
Use to retrieve the sets of compatible Build IDs for the targeted Task Queue. For more on this feature, see https://docs.temporal.io/workers#worker-versioning .
[Obsolete("Use the Worker Deployment API instead. See https://docs.temporal.io/worker-deployments")]
Task<WorkerBuildIdVersionSets?> GetWorkerBuildIdCompatibilityAsync(string taskQueue, int maxSets = 0, RpcOptions? rpcOptions = null)
Parameters
taskQueuestringThe Task Queue to target.
maxSetsintThe maximum number of sets to return. If not specified, all sets will be returned.
rpcOptionsRpcOptionsRPC options.
Returns
- Task<WorkerBuildIdVersionSets>
The sets, if the Task Queue is versioned, otherwise null.
GetWorkerTaskReachabilityAsync(IReadOnlyCollection<string>, IReadOnlyCollection<string>, TaskReachability?, RpcOptions?)
Determine if some Build IDs for certain Task Queues could have tasks dispatched to them. For more on this feature, see https://docs.temporal.io/workers#worker-versioning .
[Obsolete("Use the Worker Deployment API instead. See https://docs.temporal.io/worker-deployments")]
Task<WorkerTaskReachability> GetWorkerTaskReachabilityAsync(IReadOnlyCollection<string> buildIds, IReadOnlyCollection<string> taskQueues, TaskReachability? reachability = null, RpcOptions? rpcOptions = null)
Parameters
buildIdsIReadOnlyCollection<string>The Build IDs to query the reachability of. At least one must be specified.
taskQueuesIReadOnlyCollection<string>Task Queues to restrict the query to. If not specified, all Task Queues will be searched. When requesting a large number of task queues or all task queues associated with the given Build IDs in a namespace, all Task Queues will be listed in the response but some of them may not contain reachability information due to a server enforced limit. When reaching the limit, task queues that reachability information could not be retrieved for will be marked with a
NotFetchedentry in TaskQueueReachability. The caller may issue another call to get the reachability for those task queues.reachabilityTaskReachability?The kind of reachability this request is concerned with.
rpcOptionsRpcOptionsRPC options.
Returns
- Task<WorkerTaskReachability>
The reachability information.
GetWorkflowHandle(string, string?, string?)
Get a workflow handle for an existing workflow with unknown return type.
WorkflowHandle GetWorkflowHandle(string id, string? runId = null, string? firstExecutionRunId = null)
Parameters
idstringID of the workflow.
runIdstringRun ID of the workflow or null for latest.
firstExecutionRunIdstringOptional first execution ID used for cancellation and termination.
Returns
- WorkflowHandle
Created workflow handle.
GetWorkflowHandle<TWorkflow>(string, string?, string?)
Get a workflow handle for an existing workflow with known type.
WorkflowHandle<TWorkflow> GetWorkflowHandle<TWorkflow>(string id, string? runId = null, string? firstExecutionRunId = null)
Parameters
idstringID of the workflow.
runIdstringRun ID of the workflow or null for latest.
firstExecutionRunIdstringOptional first execution ID used for cancellation and termination.
Returns
- WorkflowHandle<TWorkflow>
Created workflow handle.
Type Parameters
TWorkflowWorkflow class type.
GetWorkflowHandle<TWorkflow, TResult>(string, string?, string?)
Get a workflow handle for an existing workflow with known type and return type.
WorkflowHandle<TWorkflow, TResult> GetWorkflowHandle<TWorkflow, TResult>(string id, string? runId = null, string? firstExecutionRunId = null)
Parameters
idstringID of the workflow.
runIdstringRun ID of the workflow or null for latest.
firstExecutionRunIdstringOptional first execution ID used for cancellation and termination.
Returns
- WorkflowHandle<TWorkflow, TResult>
Created workflow handle.
Type Parameters
TWorkflowWorkflow class type.
TResultResult type of the workflow.
ListActivitiesAsync(string, ActivityListOptions?)
List activities with the given query.
IAsyncEnumerable<ActivityExecution> ListActivitiesAsync(string query, ActivityListOptions? options = null)
Parameters
querystringQuery to use for filtering.
optionsActivityListOptionsOptions for the list call.
Returns
- IAsyncEnumerable<ActivityExecution>
Async enumerator for the activities.
Remarks
WARNING: Standalone activities are experimental.
ListActivitiesPaginatedAsync(string, byte[]?, ActivityListPaginatedOptions?)
List activities with the given query using manual paging.
Task<ActivityListPage> ListActivitiesPaginatedAsync(string query, byte[]? nextPageToken, ActivityListPaginatedOptions? options = null)
Parameters
querystringQuery to use for filtering. Subsequent pages must have the same query as the initial call.
nextPageTokenbyte[]Set to null for the initial call to retrieve the first page. Set to NextPageToken returned by a previous call to retrieve the next page.
optionsActivityListPaginatedOptionsOptions for the list call.
Returns
- Task<ActivityListPage>
A single page of a list of activities. Repeat the call using NextPageToken to get more pages.
Remarks
WARNING: Standalone activities are experimental.
ListSchedulesAsync(ScheduleListOptions?)
List schedules.
IAsyncEnumerable<ScheduleListDescription> ListSchedulesAsync(ScheduleListOptions? options = null)
Parameters
optionsScheduleListOptionsOptions for the list call.
Returns
- IAsyncEnumerable<ScheduleListDescription>
Async enumerator for the schedules.
ListWorkflowsAsync(string, WorkflowListOptions?)
List workflows with the given query.
IAsyncEnumerable<WorkflowExecution> ListWorkflowsAsync(string query, WorkflowListOptions? options = null)
Parameters
querystringQuery to use for filtering.
optionsWorkflowListOptionsOptions for the list call.
Returns
- IAsyncEnumerable<WorkflowExecution>
Async enumerator for the workflows.
- See Also
ListWorkflowsPaginatedAsync(string, byte[]?, WorkflowListPaginatedOptions?)
List workflows with the given query using manual paging.
Task<WorkflowListPage> ListWorkflowsPaginatedAsync(string query, byte[]? nextPageToken, WorkflowListPaginatedOptions? options = null)
Parameters
querystringQuery to use for filtering. Subsequent pages must have the same query as the initial call.
nextPageTokenbyte[]Set to null for the initial call to retrieve the first page. Set to NextPageToken returned by a previous call to retrieve the next page.
optionsWorkflowListPaginatedOptionsOptions for the list call.
Returns
- Task<WorkflowListPage>
A single page of a list of workflows. Repeat the call using NextPageToken to get more pages.
- See Also
StartActivityAsync(Expression<Func<Task>>, StartActivityOptions)
Start a standalone activity via lambda invoking the activity method with no result.
Task<ActivityHandle> StartActivityAsync(Expression<Func<Task>> activityCall, StartActivityOptions options)
Parameters
activityCallExpression<Func<Task>>Invocation of activity method with no result.
optionsStartActivityOptionsActivity options. ID and TaskQueue are required.
Returns
- Task<ActivityHandle>
Activity handle for the started activity.
Remarks
WARNING: Standalone activities are experimental.
Exceptions
- ArgumentException
Invalid activity call or options.
- ActivityAlreadyStartedException
Activity was already started according to ID reuse and conflict policy.
- RpcException
Server-side error.
StartActivityAsync(string, IReadOnlyCollection<object?>, StartActivityOptions)
Start a standalone activity by name.
Task<ActivityHandle> StartActivityAsync(string activity, IReadOnlyCollection<object?> args, StartActivityOptions options)
Parameters
activitystringActivity type name.
argsIReadOnlyCollection<object>Arguments for the activity.
optionsStartActivityOptionsActivity options. ID and TaskQueue are required.
Returns
- Task<ActivityHandle>
Activity handle for the started activity.
Remarks
WARNING: Standalone activities are experimental.
Exceptions
- ArgumentException
Invalid options.
- ActivityAlreadyStartedException
Activity was already started according to ID reuse and conflict policy.
- RpcException
Server-side error.
StartActivityAsync<TResult>(Expression<Func<Task<TResult>>>, StartActivityOptions)
Start a standalone activity via lambda invoking the activity method.
Task<ActivityHandle<TResult>> StartActivityAsync<TResult>(Expression<Func<Task<TResult>>> activityCall, StartActivityOptions options)
Parameters
activityCallExpression<Func<Task<TResult>>>Invocation of activity method with a result.
optionsStartActivityOptionsActivity options. ID and TaskQueue are required.
Returns
- Task<ActivityHandle<TResult>>
Activity handle for the started activity.
Type Parameters
TResultActivity result type.
Remarks
WARNING: Standalone activities are experimental.
Exceptions
- ArgumentException
Invalid activity call or options.
- ActivityAlreadyStartedException
Activity was already started according to ID reuse and conflict policy.
- RpcException
Server-side error.
StartUpdateWithStartWorkflowAsync(string, IReadOnlyCollection<object?>, WorkflowStartUpdateWithStartOptions)
Start an update using its name, possibly starting the workflow at the same time. Note that in some cases this call may fail but the workflow will still be started.
Task<WorkflowUpdateHandle> StartUpdateWithStartWorkflowAsync(string update, IReadOnlyCollection<object?> args, WorkflowStartUpdateWithStartOptions options)
Parameters
updatestringName of the update.
argsIReadOnlyCollection<object>Arguments for the update.
optionsWorkflowStartUpdateWithStartOptionsUpdate options. Currently
WaitForStageis required.
Returns
- Task<WorkflowUpdateHandle>
Workflow update handle.
Exceptions
- ArgumentException
Invalid run call or options.
- WorkflowAlreadyStartedException
Workflow was already started according to ID reuse and conflict policy.
- RpcException
Server-side error.
StartUpdateWithStartWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>>, WorkflowStartUpdateWithStartOptions)
Start an update via a call to a WorkflowUpdate attributed method, possibly starting the workflow at the same time. Note that in some cases this call may fail but the workflow will still be started.
Task<WorkflowUpdateHandle> StartUpdateWithStartWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>> updateCall, WorkflowStartUpdateWithStartOptions options)
Parameters
updateCallExpression<Func<TWorkflow, Task>>Invocation of workflow update method.
optionsWorkflowStartUpdateWithStartOptionsUpdate options. Currently
WaitForStageis required.
Returns
- Task<WorkflowUpdateHandle>
Workflow update handle.
Type Parameters
TWorkflowWorkflow class type.
Exceptions
- ArgumentException
Invalid run call or options.
- WorkflowAlreadyStartedException
Workflow was already started according to ID reuse and conflict policy.
- RpcException
Server-side error.
StartUpdateWithStartWorkflowAsync<TUpdateResult>(string, IReadOnlyCollection<object?>, WorkflowStartUpdateWithStartOptions)
Start an update using its name, possibly starting the workflow at the same time. Note that in some cases this call may fail but the workflow will still be started.
Task<WorkflowUpdateHandle<TUpdateResult>> StartUpdateWithStartWorkflowAsync<TUpdateResult>(string update, IReadOnlyCollection<object?> args, WorkflowStartUpdateWithStartOptions options)
Parameters
updatestringName of the update.
argsIReadOnlyCollection<object>Arguments for the update.
optionsWorkflowStartUpdateWithStartOptionsUpdate options. Currently
WaitForStageis required.
Returns
- Task<WorkflowUpdateHandle<TUpdateResult>>
Workflow update handle.
Type Parameters
TUpdateResultUpdate result type.
Exceptions
- ArgumentException
Invalid run call or options.
- WorkflowAlreadyStartedException
Workflow was already started according to ID reuse and conflict policy.
- RpcException
Server-side error.
StartUpdateWithStartWorkflowAsync<TWorkflow, TUpdateResult>(Expression<Func<TWorkflow, Task<TUpdateResult>>>, WorkflowStartUpdateWithStartOptions)
Start an update via a call to a WorkflowUpdate attributed method, possibly starting the workflow at the same time. Note that in some cases this call may fail but the workflow will still be started.
Task<WorkflowUpdateHandle<TUpdateResult>> StartUpdateWithStartWorkflowAsync<TWorkflow, TUpdateResult>(Expression<Func<TWorkflow, Task<TUpdateResult>>> updateCall, WorkflowStartUpdateWithStartOptions options)
Parameters
updateCallExpression<Func<TWorkflow, Task<TUpdateResult>>>Invocation of workflow update method.
optionsWorkflowStartUpdateWithStartOptionsUpdate options. Currently
WaitForStageis required.
Returns
- Task<WorkflowUpdateHandle<TUpdateResult>>
Workflow update handle.
Type Parameters
TWorkflowWorkflow class type.
TUpdateResultUpdate result type.
Exceptions
- ArgumentException
Invalid run call or options.
- WorkflowAlreadyStartedException
Workflow was already started according to ID reuse and conflict policy.
- RpcException
Server-side error.
StartWorkflowAsync(string, IReadOnlyCollection<object?>, WorkflowOptions)
Start a workflow by name.
Task<WorkflowHandle> StartWorkflowAsync(string workflow, IReadOnlyCollection<object?> args, WorkflowOptions options)
Parameters
workflowstringWorkflow type name.
argsIReadOnlyCollection<object>Arguments for the workflow.
optionsWorkflowOptionsStart workflow options. ID and TaskQueue are required.
Returns
- Task<WorkflowHandle>
Workflow handle for the started workflow.
Exceptions
- ArgumentException
Invalid options.
- WorkflowAlreadyStartedException
Workflow was already started according to ID reuse policy.
- RpcException
Server-side error.
StartWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>>, WorkflowOptions)
Start a workflow via lambda invoking the run method.
Task<WorkflowHandle<TWorkflow>> StartWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>> workflowRunCall, WorkflowOptions options)
Parameters
workflowRunCallExpression<Func<TWorkflow, Task>>Invocation of workflow run method with no result.
optionsWorkflowOptionsStart workflow options. ID and TaskQueue are required.
Returns
- Task<WorkflowHandle<TWorkflow>>
Workflow handle for the started workflow.
Type Parameters
TWorkflowWorkflow class type.
Exceptions
- ArgumentException
Invalid run call or options.
- WorkflowAlreadyStartedException
Workflow was already started according to ID reuse policy.
- RpcException
Server-side error.
StartWorkflowAsync<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>>, WorkflowOptions)
Start a workflow via lambda invoking the run method.
Task<WorkflowHandle<TWorkflow, TResult>> StartWorkflowAsync<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>> workflowRunCall, WorkflowOptions options)
Parameters
workflowRunCallExpression<Func<TWorkflow, Task<TResult>>>Invocation of workflow run method with a result.
optionsWorkflowOptionsStart workflow options. ID and TaskQueue are required.
Returns
- Task<WorkflowHandle<TWorkflow, TResult>>
Workflow handle for the started workflow.
Type Parameters
TWorkflowWorkflow class type.
TResultWorkflow result type.
Exceptions
- ArgumentException
Invalid run call or options.
- WorkflowAlreadyStartedException
Workflow was already started according to ID reuse policy.
- RpcException
Server-side error.
UpdateWorkerBuildIdCompatibilityAsync(string, BuildIdOp, RpcOptions?)
Use to add new Build IDs or otherwise update the relative compatibility of Build IDs as defined on a specific task queue for the Worker Versioning feature. For more on this feature, see https://docs.temporal.io/workers#worker-versioning .
[Obsolete("Use the Worker Deployment API instead. See https://docs.temporal.io/worker-deployments")]
Task UpdateWorkerBuildIdCompatibilityAsync(string taskQueue, BuildIdOp buildIdOp, RpcOptions? rpcOptions = null)
Parameters
taskQueuestringThe Task Queue to target.
buildIdOpBuildIdOpThe operation to perform.
rpcOptionsRpcOptionsRPC options.
Returns
- Task
Completion task.