Class: WorkflowClient
client.WorkflowClient
Client for starting Workflow executions and creating Workflow handles.
Typically this client should not be instantiated directly, instead create the high level Client and use Client.workflow to interact with Workflows.
Hierarchy
-
BaseClient
↳
WorkflowClient
Constructors
constructor
• new WorkflowClient(options?
): WorkflowClient
Parameters
Name | Type |
---|---|
options? | WorkflowClientOptions |
Returns
Overrides
BaseClient.constructor
Properties
connection
• Readonly
connection: ConnectionLike
The underlying connection used by this client.
Clients are cheap to create, but connections are expensive. Where that make sense,
a single connection may and should be reused by multiple Client
.
Inherited from
BaseClient.connection
options
• Readonly
options: LoadedWorkflowClientOptions
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
Methods
execute
▸ execute<T
>(workflowTypeOrFunc
, options
): Promise
<WorkflowResultType
<T
>>
Starts a new Workflow execution and awaits its completion.
Type parameters
Name | Type |
---|---|
T | extends Workflow |
Parameters
Name | Type |
---|---|
workflowTypeOrFunc | string | T |
options | WorkflowStartOptions <T > |
Returns
Promise
<WorkflowResultType
<T
>>
the result of the Workflow execution
getHandle
▸ getHandle<T
>(workflowId
, runId?
, options?
): WorkflowHandle
<T
>
Create a handle to an existing Workflow.
- If only
workflowId
is passed, and there are multiple Workflow Executions with that ID, the handle will refer to the most recent one. - If
workflowId
andrunId
are passed, the handle will refer to the specific Workflow Execution with that Run ID. - If
workflowId
and GetWorkflowHandleOptions.firstExecutionRunId are passed, the handle will refer to the most recent Workflow Execution in the Chain that started withfirstExecutionRunId
.
A Chain is a series of Workflow Executions that share the same Workflow ID and are connected by:
- Being part of the same Cron
- Continue As New
- Retries
This method does not validate workflowId
. If there is no Workflow Execution with the given workflowId
, handle
methods like handle.describe()
will throw a WorkflowNotFoundError error.
Type parameters
Name | Type |
---|---|
T | extends Workflow |
Parameters
Name | Type |
---|---|
workflowId | string |
runId? | string |
options? | GetWorkflowHandleOptions |
Returns
list
▸ list(options?
): AsyncWorkflowListIterable
List workflows by given query
.
⚠️ To use advanced query functionality, as of the 1.18 server release, you must use Elasticsearch based visibility.
More info on the concept of "visibility" and the query syntax on the Temporal documentation site: https://docs.temporal.io/visibility
Parameters
Name | Type |
---|---|
options? | ListOptions |