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
| Name | Type | Description |
|---|---|---|
R | any | Result type of the activity. Use ActivityClient.typed to start activities in a type-safe way. Standalone Activities are experimental. APIs may be subject to change. |
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
| Name | Type |
|---|---|
reason | string |
Returns
Promise<void>
describe
▸ describe(): Promise<ActivityExecutionDescription>
Returns information about the Activity execution.
Returns
Promise<ActivityExecutionDescription>
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
| Name | Type |
|---|---|
reason | string |
Returns
Promise<void>