Skip to main content

Interface: WorkerPlugin

Experimental

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.

Accessors​

name​

Get Signature​

get name(): string

Experimental

Gets the name of this plugin.

Returns​

string

Methods​

configureReplayWorker()?​

optional configureReplayWorker(options): ReplayWorkerOptions | Promise<ReplayWorkerOptions>

Experimental

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​

options​

ReplayWorkerOptions

Returns​

ReplayWorkerOptions | Promise<ReplayWorkerOptions>


configureWorker()?​

optional configureWorker(options): WorkerOptions | Promise<WorkerOptions>

Experimental

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​

options​

WorkerOptions

Returns​

WorkerOptions | Promise<WorkerOptions>


runWorker()?​

optional runWorker(worker, next): Promise<void>

Experimental

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​

worker​

Worker

next​

(w) => Promise<void>

Returns​

Promise<void>