Interface: TemporalOptions
Defined in: src/interfaces.ts:286
Main configuration options for Temporal module initialization.
Supports both client-only and worker configurations.
Now supports multiple workers via the workers array property.
Examples
Basic Setup with Single Worker (Legacy)
const options: TemporalOptions = {
connection: {
address: 'localhost:7233',
namespace: 'default'
},
taskQueue: 'my-task-queue',
worker: {
workflowsPath: './dist/workflows',
activityClasses: [MyActivityClass],
autoStart: true,
autoRestart: true,
maxRestarts: 5
}
};
Multiple Workers Setup
const options: TemporalOptions = {
connection: {
address: 'localhost:7233',
namespace: 'default'
},
autoRestart: true, // Global default for all workers
maxRestarts: 3, // Global default for all workers
workers: [
{
taskQueue: 'payments-queue',
workflowsPath: './dist/workflows/payments',
activityClasses: [PaymentActivity],
maxRestarts: 5 // Override for this worker
},
{
taskQueue: 'notifications-queue',
workflowsPath: './dist/workflows/notifications',
activityClasses: [EmailActivity]
}
]
};
Client-only Setup
const clientOptions: TemporalOptions = {
connection: {
address: 'localhost:7233',
namespace: 'default'
},
// Omit worker configuration for client-only mode
isGlobal: true
};
Extends
Properties
allowConnectionFailure?
optionalallowConnectionFailure?:boolean
Defined in: src/interfaces.ts:329
autoRestart?
optionalautoRestart?:boolean
Defined in: src/interfaces.ts:325
Enable auto-restart on worker failure for all workers (default: true)
connection?
optionalconnection?:ClientConnectionOptions
Defined in: src/interfaces.ts:288
Connection config — see ClientConnectionOptions.
correlation?
optionalcorrelation?:boolean|CorrelationOptions
Defined in: src/interfaces.ts:300
Propagate a correlation id (x-correlation-id) from the client call through the
workflow to every activity, and tag library logs with it. true uses defaults.
Off by default. Not applied to prebuilt workflowBundles (add
nestjs-temporal-core/dist/observability/workflow-interceptors to the bundle).
dataConverter?
optionaldataConverter?:DataConverter
Defined in: src/interfaces.ts:308
One DataConverter applied to both the client and the worker, so they always agree
(for example payload encryption from nestjs-temporal-core/encryption). A
connection.dataConverter or worker.workerOptions.dataConverter still wins for its side.
A custom payload converter running inside workflows also needs the bundler's
payloadConverterPath; payload codecs do not.
enableLogger?
optionalenableLogger?:boolean
Defined in: src/interfaces.ts:457
Inherited from
enableShutdownHooks?
optionalenableShutdownHooks?:boolean
Defined in: src/interfaces.ts:335
Not read by the module today. Call app.enableShutdownHooks() in main.ts so Nest
delivers SIGTERM/SIGINT to the worker's shutdown hooks.
Deprecated
Has no effect.
errorMapping?
optionalerrorMapping?:boolean|ErrorMappingOptions
Defined in: src/interfaces.ts:320
Map errors thrown by activities to retryable or non-retryable failures: @NonRetryable(),
a custom mapper, and by default Nest HttpException 4xx (except 408/429) as final.
Off by default: with it off, activity handlers reach the SDK untouched.
isGlobal?
optionalisGlobal?:boolean
Defined in: src/interfaces.ts:328
logLevel?
optionallogLevel?:LogLevel
Defined in: src/interfaces.ts:458
Inherited from
maxRestarts?
optionalmaxRestarts?:number
Defined in: src/interfaces.ts:327
Maximum restart attempts before giving up for all workers (default: 3)
muteErrors?
optionalmuteErrors?:boolean
Defined in: src/interfaces.ts:465
When true, suppresses error-level log output and prevents service methods from throwing on operational failures (they return structured error results instead).
Default
false
Inherited from
redactKeys?
optionalredactKeys?:string[]
Defined in: src/interfaces.ts:471
Extra object keys whose values are replaced with [REDACTED] when the library
logs structured data. Credentials, TLS material and payload bodies are always
redacted; see DEFAULT_REDACT_KEYS. Matching ignores case, - and _.
Inherited from
runtime?
optionalruntime?:TemporalRuntimeOptions
Defined in: src/interfaces.ts:293
Process-wide SDK runtime: route SDK/Core logs to the Nest logger, configure metrics. Installed once, before the first client or worker; later calls are no-ops.
shutdownTimeout?
optionalshutdownTimeout?:number
Defined in: src/interfaces.ts:341
Maximum time in milliseconds to wait for graceful worker shutdown. After this timeout, the shutdown process will complete anyway to prevent hanging.
Default
30000 (30 seconds)
strictSecurity?
optionalstrictSecurity?:boolean
Defined in: src/interfaces.ts:313
Turn security warnings (plaintext connection to a remote server, credentials without
TLS) into startup errors. Default false: warnings only.
taskQueue?
optionaltaskQueue?:string
Defined in: src/interfaces.ts:314
worker?
optionalworker?:Omit<WorkerDefinition,"taskQueue">
Defined in: src/interfaces.ts:322
Single-worker config. Equivalent to Omit<WorkerDefinition, 'taskQueue'>.
workers?
optionalworkers?:WorkerDefinition[]
Defined in: src/interfaces.ts:323