Interface: WorkerDefinition
Defined in: src/interfaces.ts:180
Configuration for a single worker instance. Allows defining multiple workers with different task queues.
Example
const workerDef: WorkerDefinition = {
taskQueue: 'payments-queue',
workflowsPath: './dist/workflows/payments',
activityClasses: [PaymentActivity],
autoStart: true,
autoRestart: true,
maxRestarts: 5,
workerOptions: {
maxConcurrentActivityTaskExecutions: 100
}
};
Properties
activityClasses?
optionalactivityClasses?:Type<object>[]
Defined in: src/interfaces.ts:200
autoBundle?
optionalautoBundle?:boolean|AutoBundleOptions
Defined in: src/interfaces.ts:193
Bundle workflowsPath at startup instead of leaving it to the SDK, and cache the result
by content hash so an unchanged source skips bundling on every restart. true uses
defaults. Requires workflowsPath; cannot be combined with workflowBundle.
autoRestart?
optionalautoRestart?:boolean
Defined in: src/interfaces.ts:203
Enable auto-restart on worker failure (default: inherits from global autoRestart)
autoStart?
optionalautoStart?:boolean
Defined in: src/interfaces.ts:201
maxRestarts?
optionalmaxRestarts?:number
Defined in: src/interfaces.ts:205
Maximum restart attempts before giving up (default: 3)
taskQueue
taskQueue:
string
Defined in: src/interfaces.ts:181
workerOptions?
optionalworkerOptions?:WorkerCreateOptions
Defined in: src/interfaces.ts:206
workflowBundle?
optionalworkflowBundle?:WorkflowBundleOption|Record<string,unknown>
Defined in: src/interfaces.ts:199
Workflow bundle. Prefer Temporal SDK's WorkflowBundleOption
({ code } or { codePath }). Loose shape accepted for backward
compatibility.
workflowsPath?
optionalworkflowsPath?:string
Defined in: src/interfaces.ts:187
Where the workflows live. Relative paths resolve against process.cwd(), and .ts /
.js are swapped when only the other exists, so one path works in dev and from dist/.
A wrong path fails at startup with a clear message.