Skip to main content

Interface: WorkflowOutboundCallsInterceptor

workflow.WorkflowOutboundCallsInterceptor

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

Implemented by

Properties

continueAsNew

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

Called when Workflow calls continueAsNew.

Type declaration

▸ (input, next): Promise<never>

Called when Workflow calls continueAsNew.

Parameters
NameType
inputContinueAsNewInput
nextOmitLastParam<(input: ContinueAsNewInput, next: OmitLastParam<...>) => Promise<never>>
Returns

Promise<never>


getLogAttributes

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

Called on each invocation of the workflow.log methods.

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

Type declaration

▸ (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
NameType
inputGetLogAttributesInput
nextOmitLastParam<(input: GetLogAttributesInput, next: OmitLastParam<...>) => Record<string, unknown>>
Returns

Record<string, unknown>


getMetricTags

Optional getMetricTags: (input: MetricTags, next: OmitLastParam<(input: MetricTags, next: OmitLastParam<...>) => MetricTags>) => 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.

Type declaration

▸ (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
NameType
inputMetricTags
nextOmitLastParam<(input: MetricTags, next: OmitLastParam<...>) => MetricTags>
Returns

MetricTags


scheduleActivity

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

Called when Workflow schedules an Activity.

Type declaration

▸ (input, next): Promise<unknown>

Called when Workflow schedules an Activity.

Parameters
NameType
inputActivityInput
nextOmitLastParam<(input: ActivityInput, next: OmitLastParam<...>) => Promise<unknown>>
Returns

Promise<unknown>

result of the activity execution


scheduleLocalActivity

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

Called when Workflow schedules a local Activity.

Type declaration

▸ (input, next): Promise<unknown>

Called when Workflow schedules a local Activity.

Parameters
NameType
inputLocalActivityInput
nextOmitLastParam<(input: LocalActivityInput, next: OmitLastParam<...>) => Promise<unknown>>
Returns

Promise<unknown>

result of the activity execution


signalWorkflow

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

Called when Workflow signals a child or external Workflow.

Type declaration

▸ (input, next): Promise<void>

Called when Workflow signals a child or external Workflow.

Parameters
NameType
inputSignalWorkflowInput
nextOmitLastParam<(input: SignalWorkflowInput, next: OmitLastParam<...>) => Promise<void>>
Returns

Promise<void>


startChildWorkflowExecution

Optional startChildWorkflowExecution: (input: StartChildWorkflowExecutionInput, next: OmitLastParam<(input: StartChildWorkflowExecutionInput, next: OmitLastParam<...>) => Promise<[Promise<string>, Promise<unknown>]>>) => 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.

Type declaration

▸ (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
NameType
inputStartChildWorkflowExecutionInput
nextOmitLastParam<(input: StartChildWorkflowExecutionInput, next: OmitLastParam<...>) => Promise<[Promise<string>, Promise<unknown>]>>
Returns

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


startNexusOperation

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

Called when Workflow starts a Nexus Operation.

Nexus support in Temporal SDK is experimental.

Type declaration

▸ (input, next): Promise<StartNexusOperationOutput>

Called when Workflow starts a Nexus Operation.

Nexus support in Temporal SDK is experimental.

Parameters
NameType
inputStartNexusOperationInput
nextOmitLastParam<(input: StartNexusOperationInput, next: OmitLastParam<...>) => Promise<StartNexusOperationOutput>>
Returns

Promise<StartNexusOperationOutput>


startTimer

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

Called when Workflow starts a timer.

Type declaration

▸ (input, next): Promise<void>

Called when Workflow starts a timer.

Parameters
NameType
inputTimerInput
nextOmitLastParam<(input: TimerInput, next: OmitLastParam<...>) => Promise<void>>
Returns

Promise<void>