Class: ActivityClient
client.ActivityClient
Client for starting and managing Activities, and for asynchronous completion and heartbeating of Activities. Includes all functionality of AsyncCompletionClient.
Typically this client should not be instantiated directly, instead create the high level Client and use Client.activity to interact with Activities.
Hierarchy
-
↳
ActivityClient
Implements
TypedActivityClient<any>
Constructors
constructor
• new ActivityClient(options?): ActivityClient
Parameters
| Name | Type |
|---|---|
options? | ActivityClientOptions |
Returns
Overrides
AsyncCompletionClient.constructor
Properties
connection
• Readonly connection: ConnectionLike
The underlying connection or NativeConnection | native connection used by this client.
Clients are cheap to create, but connections are expensive. Where it makes sense,
a single connection may and should be reused by multiple Clients.
Inherited from
AsyncCompletionClient.connection
options
• Readonly options: LoadedAsyncCompletionClientOptions
Inherited from
Accessors
workflowService
• get workflowService(): WorkflowService
Raw gRPC access to the Temporal service.
NOTE: The namespace provided in options is not automatically set on requests made via this service object.
Returns
Inherited from
AsyncCompletionClient.workflowService
Methods
complete
▸ complete(taskToken, result): Promise<void>
Complete an Activity by task token
Parameters
| Name | Type |
|---|---|
taskToken | Uint8Array |
result | unknown |
Returns
Promise<void>
Inherited from
AsyncCompletionClient.complete
▸ complete(fullActivityId, result): Promise<void>
Complete an Activity by full ID
Parameters
| Name | Type |
|---|---|
fullActivityId | FullActivityId |
result | unknown |
Returns
Promise<void>
Inherited from
AsyncCompletionClient.complete
count
▸ count(query): Promise<CountActivityExecutions>
Return the number of Activity executions matching the given query.
Note that the number of Activity executions returned is approximate and eventually consistent.
More info on the concept of "visibility" and the query syntax on the Temporal documentation site: https://docs.temporal.io/visibility
Standalone Activities are experimental. APIs may be subject to change.
Parameters
| Name | Type |
|---|---|
query | string |
Returns
Promise<CountActivityExecutions>
execute
▸ execute<R>(activity, options): Promise<R>
Executes a Standalone Activity until completion and returns the result.
Type parameters
| Name | Type |
|---|---|
R | any |
Parameters
| Name | Type | Description |
|---|---|---|
activity | string | Name of the activity to start. |
options | ActivityOptions | Options controlling the activity execution. |
Returns
Promise<R>
Result of the activity.
Standalone Activities are experimental. APIs may be subject to change.
Implementation of
fail
▸ fail(taskToken, err): Promise<void>
Fail an Activity by task token
Parameters
| Name | Type |
|---|---|
taskToken | Uint8Array |
err | unknown |
Returns
Promise<void>
Inherited from
▸ fail(fullActivityId, err): Promise<void>
Fail an Activity by full ID
Parameters
| Name | Type |
|---|---|
fullActivityId | FullActivityId |
err | unknown |
Returns
Promise<void>
Inherited from
getHandle
▸ getHandle<R>(activityId, runId?): ActivityHandle<R>
Creates an Activity handle from ID and optionally from run ID. If runId is not set, the handle will refer to the
newest Activity run with the given Activity ID.
Note 1: this function always succeeds. If the provided ID is invalid, an error will only be thrown when calling the handle's methods.
Note 2: if runID is not set when calling getHandle, then runId property of the returned handle will always
remain unset, even after method calls are performed. To get the run ID of the targeted activity execution, call
ActivityHandle.describe and read the activityRunId field of the returned ActivityExecutionDescription.
Type parameters
| Name | Type |
|---|---|
R | any |
Parameters
| Name | Type | Description |
|---|---|---|
activityId | string | ID of the Activity. |
runId? | string | Optional run ID of the specific Activity execution. |
Returns
Handle to the specified activity execution.
Standalone Activities are experimental. APIs may be subject to change.
heartbeat
▸ heartbeat(taskToken, details?): Promise<void>
Send Activity heartbeat by task token
Parameters
| Name | Type |
|---|---|
taskToken | Uint8Array |
details? | unknown |
Returns
Promise<void>
Inherited from
AsyncCompletionClient.heartbeat
▸ heartbeat(fullActivityId, details?): Promise<void>
Send Activity heartbeat by full ID
Parameters
| Name | Type |
|---|---|
fullActivityId | FullActivityId |
details? | unknown |
Returns
Promise<void>
Inherited from
AsyncCompletionClient.heartbeat
list
▸ list(query): AsyncIterable<ActivityExecutionInfo>
Return a list of Activity executions matching the given query.
Note that the list of Activity executions returned is approximate and eventually consistent.
More info on the concept of "visibility" and the query syntax on the Temporal documentation site: https://docs.temporal.io/visibility
Standalone Activities are experimental. APIs may be subject to change.
Parameters
| Name | Type |
|---|---|
query | string |
Returns
AsyncIterable<ActivityExecutionInfo>
reportCancellation
▸ reportCancellation(taskToken, details?): Promise<void>
Report Activity cancellation by task token
Parameters
| Name | Type |
|---|---|
taskToken | Uint8Array |
details? | unknown |
Returns
Promise<void>
Inherited from
AsyncCompletionClient.reportCancellation
▸ reportCancellation(fullActivityId, details?): Promise<void>
Report Activity cancellation by full ID
Parameters
| Name | Type |
|---|---|
fullActivityId | FullActivityId |
details? | unknown |
Returns
Promise<void>
Inherited from
AsyncCompletionClient.reportCancellation
start
▸ start<R>(activity, options): Promise<ActivityHandle<R>>
Starts new Standalone Activity execution.
Type parameters
| Name | Type |
|---|---|
R | any |
Parameters
| Name | Type | Description |
|---|---|---|
activity | string | Name of the activity to start. |
options | ActivityOptions | Options controlling the start and execution of the activity. |
Returns
Promise<ActivityHandle<R>>
Handle to the started activity. The handle's runId property will be set to the started run.
Standalone Activities are experimental. APIs may be subject to change.
Implementation of
typed
▸ typed<T>(): TypedActivityClient<T>
Returns this client as a TypedActivityClient. It enables strong type checking of Activity name, arguments and result based on the provided Activity interface. Note that no new client object is created - this method only affects type annotations.
Type parameters
| Name | Description |
|---|---|
T | Activity interface to use for type checking. The returned client can only start activities present in this interface. Standalone Activities are experimental. APIs may be subject to change. |