Skip to main content

Class: ScheduleClient

Client for starting Workflow executions and creating Workflow handles

Extends​

  • BaseClient

Constructors​

Constructor​

new ScheduleClient(options?): ScheduleClient

Parameters​

options?​

ScheduleClientOptions

Returns​

ScheduleClient

Overrides​

BaseClient.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​

BaseClient.connection


options​

readonly options: LoadedScheduleClientOptions

Accessors​

workflowService​

Get Signature​

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​

WorkflowService

Methods​

create()​

create<W>(options): Promise<ScheduleHandle>

Create a new Schedule.

Type Parameters​

W​

W extends Workflow = Workflow

Parameters​

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​

scheduleId​

string

Returns​

ScheduleHandle


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​

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​

R​

R

Parameters​

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​

R​

R

Parameters​

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​

R​

R

Parameters​

metadata​

Metadata

fn​

() => Promise<R>

Returns​

Promise<R>

returned value of fn

Inherited from​

BaseClient.withMetadata