Interface: ActivityContext
The context an activity function receives.
Properties
cancellationSignal
readonlycancellationSignal:AbortSignalLike
Aborted when the workflow requests cancellation or the worker shuts down.
info
readonlyinfo:ActivityInfo
Methods
completeAsync()
completeAsync():
Promise<string>
Hand completion to an outside system (11 §2.2): returns a task token and
ends this attempt without completing it. The outside system finishes it
with completeActivityAsync(token, result) or the activity webhook.
Returns
Promise<string>
connection()
connection(
name):Promise<Record<string,Json>>
Credentials of a connection the activity declares (H2 rules apply on self-hosted workers).
Parameters
name
string
Returns
Promise<Record<string, Json>>
heartbeat()
heartbeat(
details?):Promise<{cancelRequested:boolean;paused:boolean; }>
Record progress (at most 32 KiB of details, kept for the next attempt)
and learn whether to stop. When the attempt was paused (pauseActivity,
11 §2.28) paused is true; the activity should then throw
ActivityPausedError, which is not retried while the activity is paused.
Parameters
details?
unknown
Returns
Promise<{ cancelRequested: boolean; paused: boolean; }>