Skip to main content

Interface: ActivityHandle<R>

client.ActivityHandle

Handle that can be used to perform operations on the associated Activity. Can be obtained by calling ActivityClient.start or ActivityClient.getHandle.

Type parameters

NameTypeDescription
RanyResult type of the activity. Use ActivityClient.typed to start activities in a type-safe way.

Properties

activityId

Readonly activityId: string

ID of the Activity this handle refers to.


runId

Optional Readonly runId: string

Run ID of the specific Activity execution this handle refers to. If empty, this handle refers to the latest execution of the Activity with given ID.

Methods

cancel

cancel(reason): Promise<void>

Requests cancellation of the Activity execution. Note that cancellations are cooperative and not guaranteed to happen.

Parameters

NameType
reasonstring

Returns

Promise<void>


describe

describe(options?): Promise<ActivityExecutionDescription>

Returns information about the Activity execution.

Parameters

NameType
options?ActivityDescribeOptions

Returns

Promise<ActivityExecutionDescription>


pause

pause(options?): Promise<void>

Requests Activity execution pause. Note that pausing is cooperative and not guaranteed to happen.

Activity Operator Commands are experimental. APIs may be subject to change.

Parameters

NameType
options?ActivityPauseOptions

Returns

Promise<void>


restoreOriginalOptions

restoreOriginalOptions(): Promise<ActivityOptionsUpdate>

Restores activity options of a running activity execution that it was originally started with.

Returns current options after restoring.

Activity Operator Commands are experimental. APIs may be subject to change.

Returns

Promise<ActivityOptionsUpdate>


result

result(): Promise<R>

Waits until the activity completes. If the activity is successful, returns the result of the activity. If the activity was not successful, throws ActivityExecutionFailedError. The activity failure is stored in the cause field.

Returns

Promise<R>


terminate

terminate(reason): Promise<void>

Terminates the Activity execution. Note that the worker is not immediately notified of termination and may continue running the activity.

Parameters

NameType
reasonstring

Returns

Promise<void>


unpause

unpause(options?): Promise<void>

Unpauses the Activity execution if it was previously paused.

Activity Operator Commands are experimental. APIs may be subject to change.

Parameters

NameType
options?ActivityUnpauseOptions

Returns

Promise<void>


updateOptions

updateOptions(options): Promise<ActivityOptionsUpdateResult>

Updates activity options of a running activity execution. See documentation for ActivityOptionsUpdate.

Returns current options after applying the update.

Activity Operator Commands are experimental. APIs may be subject to change.

Parameters

NameType
optionsActivityOptionsUpdate

Returns

Promise<ActivityOptionsUpdateResult>