Skip to main content

Interface: TemporalNexusClient

nexus.TemporalNexusClient

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

Temporal Operation handlers are experimental.

Properties

client

Readonly client: Client

The Temporal Client for the active Nexus Operation.

Temporal Operation handlers are experimental.

Methods

getWorkflowHandle

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

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.

Temporal Operation handlers are experimental.

Type parameters

NameType
Textends Workflow

Parameters

NameType
workflowIdstring
runId?string

Returns

UpdatableWorkflowHandle<WorkflowResultType<T>>


signalWithStartWorkflow

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

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

Temporal Operation handlers are experimental.

Type parameters

NameType
Textends Workflow
SignalArgsextends any[] = []

Parameters

NameType
workflowTypeOrFuncstring | T
workflowOptionsWithWorkflowArgs<T, WorkflowSignalWithStartOptions<SignalArgs>>

Returns

Promise<void>


startActivity

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

Type parameters

NameType
Rany

Parameters

NameType
activitystring
optionsActivityOptions

Returns

Promise<TemporalOperationResult<R>>


startWorkflow

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

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

Temporal Operation handlers are experimental.

Type parameters

NameType
Textends Workflow

Parameters

NameType
workflowTypeOrFuncstring | T
workflowOptionsWorkflowStartOptions<T>

Returns

Promise<TemporalOperationResult<WorkflowResultType<T>>>


typedActivity

typedActivity<T>(): NexusTypedActivityClient<T>

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

NameDescription
TActivity 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>