Class: ScheduleClient
client.ScheduleClient
Client for starting Workflow executions and creating Workflow handles
Hierarchy
-
BaseClient
↳
ScheduleClient
Constructors
constructor
• new ScheduleClient(options?
): ScheduleClient
Parameters
Name | Type |
---|---|
options? | ScheduleClientOptions |
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: LoadedScheduleClientOptions
Accessors
workflowService
• get
workflowService(): WorkflowService
Raw gRPC access to the Temporal service. Schedule-related methods are included in WorkflowService.
NOTE: The namespace provided in options is not automatically set on requests made to the service.
Returns
Methods
create
▸ create<W
>(options
): Promise
<ScheduleHandle
>
Create a new Schedule.
Type parameters
Name | Type |
---|---|
W | extends Workflow = Workflow |
Parameters
Name | Type |
---|---|
options | ScheduleOptions <ScheduleOptionsStartWorkflowAction <W >> |
Returns
Promise
<ScheduleHandle
>
a ScheduleHandle to the created Schedule
Throws
ScheduleAlreadyRunning if there's a running (not deleted) Schedule with the given id
getHandle
▸ getHandle(scheduleId
): ScheduleHandle
Get a handle to a Schedule
This method does not validate scheduleId
. If there is no Schedule with the given scheduleId
, handle
methods like handle.describe()
will throw a ScheduleNotFoundError error.
Parameters
Name | Type |
---|---|
scheduleId | string |
Returns
list
▸ list(options?
): AsyncIterable
<ScheduleSummary
>
List Schedules with an AsyncIterator
:
for await (const schedule: Schedule of client.list()) {
const { id, memo, searchAttributes } = schedule
// ...
}
To list one page at a time, instead use the raw gRPC method WorkflowService.listSchedules:
await { schedules, nextPageToken } = client.scheduleService.listSchedules()
Parameters
Name | Type |
---|---|
options? | ListScheduleOptions |
Returns
AsyncIterable
<ScheduleSummary
>
withAbortSignal
▸ withAbortSignal<R
>(abortSignal
, fn
): Promise
<R
>
Set an AbortSignal that, when aborted, cancels any ongoing service requests executed in
fn
's scope. This will locally result in the request call throwing a _grpc.ServiceError|ServiceError
with code _grpc.status.CANCELLED|CANCELLED; see isGrpcCancelledError.
This method is only a convenience wrapper around Connection.withAbortSignal.
Type parameters
Name |
---|
R |
Parameters
Name | Type |
---|---|
abortSignal | AbortSignal |
fn | () => Promise <R > |
Returns
Promise
<R
>
value returned from fn
See
https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
Inherited from
BaseClient.withAbortSignal
withDeadline
▸ withDeadline<R
>(deadline
, fn
): Promise
<R
>
Set a deadline for any service requests executed in fn
's scope.
The deadline is a point in time after which any pending gRPC request will be considered as failed; this will locally result in the request call throwing a _grpc.ServiceError|ServiceError with code _grpc.status.DEADLINE_EXCEEDED|DEADLINE_EXCEEDED; see isGrpcDeadlineError.
It is stronly recommended to explicitly set deadlines. If no deadline is set, then it is possible for the client to end up waiting forever for a response.
This method is only a convenience wrapper around Connection.withDeadline.
Type parameters
Name |
---|
R |
Parameters
Name | Type | Description |
---|---|---|
deadline | number | Date | a point in time after which the request will be considered as failed; either a Date object, or a number of milliseconds since the Unix epoch (UTC). |
fn | () => Promise <R > | - |
Returns
Promise
<R
>
the value returned from fn
See
https://grpc.io/docs/guides/deadlines/
Inherited from
BaseClient.withDeadline
withMetadata
▸ withMetadata<R
>(metadata
, fn
): Promise
<R
>
Set metadata for any service requests executed in fn
's scope.
This method is only a convenience wrapper around Connection.withMetadata.
Type parameters
Name |
---|
R |
Parameters
Name | Type |
---|---|
metadata | Metadata |
fn | () => Promise <R > |
Returns
Promise
<R
>
returned value of fn
Inherited from
BaseClient.withMetadata