Skip to main content

Interface: LocalActivityOptions

Options for local activity invocation.

Extended by​

Properties​

cancellationType?​

optional cancellationType?: ActivityCancellationType

Determines:

  • whether cancellation requests should be propagated from the current Workflow to the Activity; and
  • when should the Activity cancellation be reported to Workflow (i.e. at which moment should the Activity call's promise fail with an ActivityFailure, with cause set to a CancelledFailure).

Note that this setting only applies to cancellation originating from cancellation being externally requested on the Workflow itself, or from internal cancellation of the CancellationScope in which the Activity call was made. Termination of a Workflow Execution always results in cancellation of its outstanding Activity executions, regardless of those Activities' ActivityCancellationType settings.

Unlike Child Workflows and Nexus Operations, which wait for the cancellation to complete by default, an Activity call fails as soon as its cancellation is requested unless this is set to WAIT_CANCELLATION_COMPLETED.

Default​

ActivityCancellationType.TRY_CANCEL

eventGroups?​

optional eventGroups?: EventGroup[]

Experimental

Event Groups to attach to this local activity. They will be reflected on the corresponding workflow history events, and may be used by tooling (UI/CLI) to group related events together. See EventGroup and createEventGroup.

Event Groups is an experimental API and may change without notice.


localRetryThreshold?​

optional localRetryThreshold?: Duration

If the activity is retrying and backoff would exceed this value, a server side timer will be scheduled for the next attempt. Otherwise, backoff will happen internally in the SDK.

Default​

1 minute

Format​

number of milliseconds or ms-formatted string


retry?​

optional retry?: RetryPolicy

RetryPolicy that defines how an activity is retried in case of failure. If this is not set, then the SDK-defined default activity retry policy will be used. Note that local activities are always executed at least once, even if maximum attempts is set to 1 due to Workflow task retries.


scheduleToCloseTimeout?​

optional scheduleToCloseTimeout?: Duration

Indicates how long the caller is willing to wait for local activity completion. Limits how long retries will be attempted.

Either this option or startToCloseTimeout is required.

Default​

unlimited

Format​

number of milliseconds or ms-formatted string


scheduleToStartTimeout?​

optional scheduleToStartTimeout?: Duration

Limits time the local activity can idle internally before being executed. That can happen if the worker is currently at max concurrent local activity executions. This timeout is always non retryable as all a retry would achieve is to put it back into the same queue. Defaults to scheduleToCloseTimeout if not specified and that is set. Must be <= scheduleToCloseTimeout when set, otherwise, it will be clamped down.

Default​

unlimited

Format​

number of milliseconds or ms-formatted string


startToCloseTimeout?​

optional startToCloseTimeout?: Duration

Maximum time the local activity is allowed to execute after the task is dispatched. This timeout is always retryable.

Either this option or scheduleToCloseTimeout is required. If set, this must be <= scheduleToCloseTimeout, otherwise, it will be clamped down.

Format​

number of milliseconds or ms-formatted string


summary?​

optional summary?: string

A fixed, single-line summary for this workflow execution that may appear in the UI/CLI. This can be in single-line Temporal markdown format.