Table of Contents

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

ITemporalConnection

OperatorService

Gets the raw gRPC operator service for self-hosted servers. Most users do not need this.

OperatorService OperatorService { get; }

Property Value

OperatorService

OutboundInterceptor

Gets the outbound interceptor in use.

ClientOutboundInterceptor OutboundInterceptor { get; }

Property Value

ClientOutboundInterceptor

WorkflowService

Gets the raw gRPC workflow service. Most users do not need this.

WorkflowService WorkflowService { get; }

Property Value

WorkflowService

Methods

CountWorkflowsAsync(string, WorkflowCountOptions?)

Count workflows with the given query.

Task<WorkflowExecutionCount> CountWorkflowsAsync(string query, WorkflowCountOptions? options = null)

Parameters

query string

Query to use for counting.

options WorkflowCountOptions

Options for the count call.

Returns

Task<WorkflowExecutionCount>

Count information for the workflows.

CreateScheduleAsync(string, Schedule, ScheduleOptions?)

Create a schedule and return its handle.

Task<ScheduleHandle> CreateScheduleAsync(string scheduleId, Schedule schedule, ScheduleOptions? options = null)

Parameters

scheduleId string

Unique ID for the schedule.

schedule Schedule

Schedule to create.

options ScheduleOptions

Options for creating the schedule.

Returns

Task<ScheduleHandle>

Handle to the created schedule.

Remarks

This can throw ScheduleAlreadyRunningException if the ID already exists.

GetAsyncActivityHandle(byte[])

Get a handle to complete an activity asynchronously using its task token.

AsyncActivityHandle GetAsyncActivityHandle(byte[] taskToken)

Parameters

taskToken byte[]

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

workflowId string

ID for the activity's workflow.

runId string

Run ID for the activity's workflow.

activityId string

ID for the activity.

Returns

AsyncActivityHandle

Async activity handle.

GetScheduleHandle(string)

Gets the schedule handle for the given ID.

ScheduleHandle GetScheduleHandle(string scheduleId)

Parameters

scheduleId string

Schedule 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 .

Task<WorkerBuildIdVersionSets?> GetWorkerBuildIdCompatibilityAsync(string taskQueue, int maxSets = 0, RpcOptions? rpcOptions = null)

Parameters

taskQueue string

The Task Queue to target.

maxSets int

The maximum number of sets to return. If not specified, all sets will be returned.

rpcOptions RpcOptions

RPC 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 .

Task<WorkerTaskReachability> GetWorkerTaskReachabilityAsync(IReadOnlyCollection<string> buildIds, IReadOnlyCollection<string> taskQueues, TaskReachability? reachability = null, RpcOptions? rpcOptions = null)

Parameters

buildIds IReadOnlyCollection<string>

The Build IDs to query the reachability of. At least one must be specified.

taskQueues IReadOnlyCollection<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 NotFetched entry in TaskQueueReachability. The caller may issue another call to get the reachability for those task queues.

reachability TaskReachability?

The kind of reachability this request is concerned with.

rpcOptions RpcOptions

RPC 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

id string

ID of the workflow.

runId string

Run ID of the workflow or null for latest.

firstExecutionRunId string

Optional 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

id string

ID of the workflow.

runId string

Run ID of the workflow or null for latest.

firstExecutionRunId string

Optional first execution ID used for cancellation and termination.

Returns

WorkflowHandle<TWorkflow>

Created workflow handle.

Type Parameters

TWorkflow

Workflow 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

id string

ID of the workflow.

runId string

Run ID of the workflow or null for latest.

firstExecutionRunId string

Optional first execution ID used for cancellation and termination.

Returns

WorkflowHandle<TWorkflow, TResult>

Created workflow handle.

Type Parameters

TWorkflow

Workflow class type.

TResult

Result type of the workflow.

ListSchedulesAsync(ScheduleListOptions?)

List schedules.

IAsyncEnumerable<ScheduleListDescription> ListSchedulesAsync(ScheduleListOptions? options = null)

Parameters

options ScheduleListOptions

Options 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

query string

Query to use for filtering.

options WorkflowListOptions

Options for the list call.

Returns

IAsyncEnumerable<WorkflowExecution>

Async enumerator for the workflows.

StartWorkflowAsync(string, IReadOnlyCollection<object?>, WorkflowOptions)

Start a workflow by name.

Task<WorkflowHandle> StartWorkflowAsync(string workflow, IReadOnlyCollection<object?> args, WorkflowOptions options)

Parameters

workflow string

Workflow type name.

args IReadOnlyCollection<object>

Arguments for the workflow.

options WorkflowOptions

Start 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

workflowRunCall Expression<Func<TWorkflow, Task>>

Invocation of workflow run method with no result.

options WorkflowOptions

Start workflow options. ID and TaskQueue are required.

Returns

Task<WorkflowHandle<TWorkflow>>

Workflow handle for the started workflow.

Type Parameters

TWorkflow

Workflow 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

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

Invocation of workflow run method with a result.

options WorkflowOptions

Start workflow options. ID and TaskQueue are required.

Returns

Task<WorkflowHandle<TWorkflow, TResult>>

Workflow handle for the started workflow.

Type Parameters

TWorkflow

Workflow class type.

TResult

Workflow 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 .

Task UpdateWorkerBuildIdCompatibilityAsync(string taskQueue, BuildIdOp buildIdOp, RpcOptions? rpcOptions = null)

Parameters

taskQueue string

The Task Queue to target.

buildIdOp BuildIdOp

The operation to perform.

rpcOptions RpcOptions

RPC options.

Returns

Task

Completion task.

See Also