Skip to main content

Interface: TemporalNexusClient

Experimental

A Nexus-aware Temporal Client for use inside TemporalOperationHandler implementations.

Temporal Operation handlers are experimental.

Properties​

client​

readonly client: Client

Experimental

The Temporal Client for the active Nexus Operation.

Temporal Operation handlers are experimental.

Methods​

getWorkflowHandle()​

getWorkflowHandle<T>(workflowId, runId?): UpdatableWorkflowHandle<WorkflowResultType<T>>

Experimental

Create a Nexus-aware handle to an existing Workflow.

  • If only workflowId is passed, and there are multiple Workflow Executions with that ID, the handle will refer to the most recent one.
  • If workflowId and runId are passed, the handle will refer to the specific Workflow Execution with that Run ID.

This method does not validate workflowId. If there is no Workflow Execution with the given workflowId, handle methods like handle.signal() will throw a WorkflowNotFoundError error.

The handle's signal() shares the one-signal-per-invocation limit and request ID deduplication described on signalWithStartWorkflow.

Temporal Operation handlers are experimental.

Type Parameters​

T​

T extends Workflow

Parameters​

workflowId​

string

runId?​

string

Returns​

UpdatableWorkflowHandle<WorkflowResultType<T>>


signalWithStartWorkflow()​

signalWithStartWorkflow<T, SignalArgs>(workflowTypeOrFunc, workflowOptions): Promise<void>

Experimental

Signals a Workflow, starting it first if it is not already running, forwarding the Nexus Operation's request links and propagating the response link the server returns (when supported).

The signal carries the operation's request ID so a retried Nexus task does not deliver it twice. Only one signal may be sent per invocation in total through this method and getWorkflowHandle's signal(); a second one throws a BAD_REQUEST handler error unless an earlier one already failed. Signals sent through client are not limited or deduplicated.

Temporal Operation handlers are experimental.

Type Parameters​

T​

T extends Workflow

SignalArgs​

SignalArgs extends any[] = []

Parameters​

workflowTypeOrFunc​

string | T

workflowOptions​

WithWorkflowArgs<T, WorkflowSignalWithStartOptions<SignalArgs>>

Returns​

Promise<void>


startActivity()​

startActivity<R>(activity, options): Promise<TemporalOperationResult<R>>

Experimental

Type Parameters​

R​

R = any

Parameters​

activity​

string

options​

ActivityOptions

Returns​

Promise<TemporalOperationResult<R>>


startWorkflow()​

startWorkflow<T>(workflowTypeOrFunc, workflowOptions): Promise<TemporalOperationResult<WorkflowResultType<T>>>

Experimental

Starts a workflow run as the asynchronous backing operation for the current Nexus Operation.

Temporal Operation handlers are experimental.

Type Parameters​

T​

T extends Workflow

Parameters​

workflowTypeOrFunc​

string | T

workflowOptions​

WorkflowStartOptions<T>

Returns​

Promise<TemporalOperationResult<WorkflowResultType<T>>>


typedActivity()​

typedActivity<T>(): NexusTypedActivityClient<T>

Experimental

Returns this client as a NexusTypedActivityClient. It enables strong type checking of Activity name, arguments and result based on the provided Activity interface. Note that no new client object is created - this method only affects type annotations.

Type Parameters​

T​

T

Activity interface to use for type checking. The returned client can only start activities present in this interface.

Nexus support in Temporal SDK is experimental.

Returns​

NexusTypedActivityClient<T>