Skip to main content

Class: Client

client.Client

High level SDK client.

Hierarchy

  • BaseClient

    Client

Constructors

constructor

new Client(options?): Client

Parameters

NameType
options?ClientOptions

Returns

Client

Overrides

BaseClient.constructor

Properties

activity

Readonly activity: AsyncCompletionClient

(Async) Activity completion sub-client - use to manually manage Activities


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: LoadedClientOptions


schedule

Readonly schedule: ScheduleClient

Schedule sub-client - use to start and interact with Schedules


taskQueue

Readonly taskQueue: TaskQueueClient

Task Queue sub-client - use to perform operations on Task Queues


workflow

Readonly workflow: WorkflowClient

Workflow sub-client - use to start and interact with Workflows

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

WorkflowService

Methods

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.

This method is only a convenience wrapper around Connection.withAbortSignal.

Type parameters

Name
R

Parameters

NameType
abortSignalAbortSignal
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.

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

NameTypeDescription
deadlinenumber | Datea 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

NameType
metadataMetadata
fn() => Promise<R>

Returns

Promise<R>

returned value of fn

Inherited from

BaseClient.withMetadata