Skip to main content

Interface: WorkerPlugin

worker.WorkerPlugin

Plugin interface for worker functionality.

Plugins provide a way to extend and customize the behavior of Temporal workers. They allow you to intercept and modify worker configuration and worker execution.

Plugins is an experimental feature; APIs may change without notice.

Implemented by

Accessors

name

get name(): string

Gets the name of this plugin.

Returns

string

Methods

configureReplayWorker

configureReplayWorker(options): ReplayWorkerOptions

Hook called when creating a replay worker to allow modification of configuration.

This method is called during worker creation and allows plugins to modify the worker configuration before the worker is fully initialized. Plugins can add workflows, interceptors, or change other settings.

Parameters

NameType
optionsReplayWorkerOptions

Returns

ReplayWorkerOptions


configureWorker

configureWorker(options): WorkerOptions

Hook called when creating a worker to allow modification of configuration.

This method is called during worker creation and allows plugins to modify the worker configuration before the worker is fully initialized. Plugins can add activities, workflows, interceptors, or change other settings.

Parameters

NameType
optionsWorkerOptions

Returns

WorkerOptions


runWorker

runWorker(worker, next): Promise<void>

Hook called when running a worker.

This method is not called when running a replay worker, as activities will not be executed, and global state can't affect the workflow.

Parameters

NameType
workerWorker
next(w: Worker) => Promise<void>

Returns

Promise<void>