Skip to main content

Class: Worker

worker.Worker

The temporal worker connects to the service and runs workflows and activities.

Properties#

options#

Readonly options: CompiledWorkerOptions

Accessors#

numInFlightActivations$#

get numInFlightActivations$(): Observable<number>

An Observable which emits each time the number of in flight activations changes

Returns#

Observable<number>


numInFlightActivities$#

get numInFlightActivities$(): Observable<number>

An Observable which emits each time the number of in flight activity tasks changes

Returns#

Observable<number>


numRunningWorkflowInstances$#

get numRunningWorkflowInstances$(): Observable<number>

An Observable which emits each time the number of in flight activations changes

Returns#

Observable<number>

Methods#

getState#

getState(): State

Get the poll state of this worker

Returns#

State


run#

run(): Promise<void>

Start polling on tasks, completes after graceful shutdown. Throws on a fatal error or failure to shutdown gracefully.

see errors

To stop polling call shutdown or send one of {@link Worker.options.shutdownSignals}.

Returns#

Promise<void>


shutdown#

shutdown(): void

Start shutting down the Worker. Immediately transitions state to STOPPING and asks Core to shut down. Once Core has confirmed that it's shutting down the Worker enters DRAINING state unless the Worker has already been DRAINED. {@see State}.

Returns#

void


create#

Static create(options): Promise<Worker>

Create a new Worker. This method initiates a connection to the server and will throw (asynchronously) on connection failure.

Parameters#

NameType
optionsWorkerOptions

Returns#

Promise<Worker>