Skip to main content

Interface: WorkflowOutboundCallsInterceptor

Implement any of these methods to intercept Workflow code calls to the Temporal APIs, like scheduling an activity and starting a timer.

Extends​

  • SystemNexusWorkflowOutboundCallsInterceptor

Properties​

continueAsNew?​

optional continueAsNew?: (input, next) => Promise<never>

Called when Workflow calls continueAsNew.

Parameters​

input​

ContinueAsNewInput

next​

OmitLastParam<(input: ContinueAsNewInput, next: OmitLastParam<...>) => Promise<never>>

Returns​

Promise<never>


getLogAttributes?​

optional getLogAttributes?: (input, next) => Record<string, unknown>

Called on each invocation of the workflow.log methods.

The attributes returned in this call are attached to every log message.

Parameters​

input​

GetLogAttributesInput

next​

OmitLastParam<(input: GetLogAttributesInput, next: OmitLastParam<...>) => Record<string, unknown>>

Returns​

Record<string, unknown>


getMetricTags?​

optional getMetricTags?: (input, next) => MetricTags

Called once every time a metric is emitted from a Workflow metric (ie. a metric created from workflow.metricMeter).

Tags returned by this hook are prepended to tags defined at the metric level and tags defined on the emitter function itself.

Parameters​

input​

GetMetricTagsInput

next​

OmitLastParam<(input: MetricTags, next: OmitLastParam<...>) => MetricTags>

Returns​

MetricTags


scheduleActivity?​

optional scheduleActivity?: (input, next) => Promise<unknown>

Called when Workflow schedules an Activity.

Parameters​

input​

ActivityInput

next​

OmitLastParam<(input: ActivityInput, next: OmitLastParam<...>) => Promise<unknown>>

Returns​

Promise<unknown>

result of the activity execution


scheduleLocalActivity?​

optional scheduleLocalActivity?: (input, next) => Promise<unknown>

Called when Workflow schedules a local Activity.

Parameters​

input​

LocalActivityInput

next​

OmitLastParam<(input: LocalActivityInput, next: OmitLastParam<...>) => Promise<unknown>>

Returns​

Promise<unknown>

result of the activity execution


signalWithStartWorkflow?​

optional signalWithStartWorkflow?: (input, next) => Promise<NexusOperationHandle<SignalWithStartWorkflowResponse>>

Parameters​

input​

SignalWithStartWorkflowRequest

next​

(input) => Promise<NexusOperationHandle<SignalWithStartWorkflowResponse>>

Returns​

Promise<NexusOperationHandle<SignalWithStartWorkflowResponse>>

Inherited from​

SystemNexusWorkflowOutboundCallsInterceptor.signalWithStartWorkflow


signalWorkflow?​

optional signalWorkflow?: (input, next) => Promise<void>

Called when Workflow signals a child or external Workflow.

Parameters​

input​

SignalWorkflowInput

next​

OmitLastParam<(input: SignalWorkflowInput, next: OmitLastParam<...>) => Promise<void>>

Returns​

Promise<void>


startChildWorkflowExecution?​

optional startChildWorkflowExecution?: (input, next) => Promise<[Promise<string>, Promise<unknown>]>

Called when Workflow starts a child workflow execution.

The interceptor function returns 2 promises:

  • The first resolves with the runId when the child workflow has started or rejects if failed to start.
  • The second resolves with the workflow result when the child workflow completes or rejects on failure.

Parameters​

input​

StartChildWorkflowExecutionInput

next​

OmitLastParam<(input: StartChildWorkflowExecutionInput, next: OmitLastParam<...>) => Promise<[Promise<string>, Promise<unknown>]>>

Returns​

Promise<[Promise<string>, Promise<unknown>]>


startNexusOperation?​

optional startNexusOperation?: (input, next) => Promise<StartNexusOperationOutput>

Called when Workflow starts a Nexus Operation.

Parameters​

input​

StartNexusOperationInput

next​

OmitLastParam<(input: StartNexusOperationInput, next: OmitLastParam<...>) => Promise<StartNexusOperationOutput>>

Returns​

Promise<StartNexusOperationOutput>


startSystemNexusOperation?​

optional startSystemNexusOperation?: (input, next) => Promise<StartNexusOperationOutput>

Called when Workflow starts a Temporal System Nexus operation.

Parameters​

input​

StartNexusOperationInput

next​

OmitLastParam<(input: StartNexusOperationInput, next: OmitLastParam<...>) => Promise<StartNexusOperationOutput>>

Returns​

Promise<StartNexusOperationOutput>


startTimer?​

optional startTimer?: (input, next) => Promise<void>

Called when Workflow starts a timer.

Parameters​

input​

TimerInput

next​

OmitLastParam<(input: TimerInput, next: OmitLastParam<...>) => Promise<void>>

Returns​

Promise<void>