Table of Contents

Interface ITemporalNexusClient

Namespace
Temporalio.Nexus
Assembly
Temporalio.dll

Nexus-aware client wrapping the Temporal client. Provides methods for starting workflows from within a Nexus operation handler.

public interface ITemporalNexusClient

Remarks

WARNING: Nexus support is experimental.

Obtained via the FromHandleFactory<TInput, TResult>(Func<TemporalOperationStartContext, ITemporalNexusClient, TInput, Task<TemporalOperationResult<TResult>>>) start function parameter.

Example usage — starting a workflow from an operation handler:

await client.StartWorkflowAsync<MyWorkflow, MyResult>(
    wf => wf.RunAsync(input),
    new(id: "my-workflow-id", taskQueue: "my-task-queue"));

To perform a synchronous operation (e.g., sending a signal), use the underlying TemporalClient and return a sync result:

await client.TemporalClient
    .GetWorkflowHandle($"order-{input.OrderId}")
    .SignalAsync("requestCancellation", new[] { input });
return TemporalOperationResult<NoValue>.SyncResult(default);

Properties

TemporalClient

Gets the underlying Temporal client for advanced use cases such as sending signals or queries.

ITemporalClient TemporalClient { get; }

Property Value

ITemporalClient

Methods

StartWorkflowAsync<TWorkflow>(Expression<Func<TWorkflow, Task>>, WorkflowOptions)

Start a workflow via a lambda invoking the run method with no return value. Always returns an async result with a workflow-run operation token.

Task<TemporalOperationResult<NoValue>> 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<TemporalOperationResult<NoValue>>

An async operation result containing the workflow-run token.

Type Parameters

TWorkflow

Workflow class type.

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

Start a workflow by name. Always returns an async result with a workflow-run operation token.

Task<TemporalOperationResult<TResult>> StartWorkflowAsync<TResult>(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<TemporalOperationResult<TResult>>

An async operation result containing the workflow-run token.

Type Parameters

TResult

Workflow result type.

StartWorkflowAsync<TWorkflow, TResult>(Expression<Func<TWorkflow, Task<TResult>>>, WorkflowOptions)

Start a workflow via a lambda invoking the run method. Always returns an async result with a workflow-run operation token.

Task<TemporalOperationResult<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<TemporalOperationResult<TResult>>

An async operation result containing the workflow-run token.

Type Parameters

TWorkflow

Workflow class type.

TResult

Workflow result type.