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, options?): Promise<void>
Complete an Activity by task token
Parameters
| Name | Type |
|---|---|
taskToken | Uint8Array |
result | unknown |
options? | AsyncCompletionCompleteOptions & AsyncCompletionOperationOptions |
Returns
Promise<void>
Inherited from
AsyncCompletionClient.complete
▸ complete(fullActivityId, result, options?): Promise<void>
Complete an Activity by full ID
Parameters
| Name | Type |
|---|---|
fullActivityId | FullActivityId |
result | unknown |
options? | AsyncCompletionCompleteOptions |
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
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.
Implementation of
fail
▸ fail(taskToken, err, options?): Promise<void>
Fail an Activity by task token
Parameters
| Name | Type |
|---|---|
taskToken | Uint8Array |
err | unknown |
options? | AsyncCompletionOperationOptions |
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.
getHandleWithOptions
▸ getHandleWithOptions<R>(activityId, options): ActivityHandle<R>
Creates an Activity handle using options that may include result TypeInfo.
Type parameters
| Name | Type |
|---|---|
R | any |
Parameters
| Name | Type | Description |
|---|---|---|
activityId | string | ID of the Activity. |
options | GetActivityHandleOptions | Options identifying the Activity run and describing its result type. |
Returns
Handle to the specified Activity execution.
heartbeat
▸ heartbeat(taskToken, details?, options?): Promise<void>
Send Activity heartbeat by task token