Skip to main content

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?​

optional allowConnectionFailure?: boolean

Defined in: src/interfaces.ts:329


autoRestart?​

optional autoRestart?: boolean

Defined in: src/interfaces.ts:325

Enable auto-restart on worker failure for all workers (default: true)


connection?​

optional connection?: ClientConnectionOptions

Defined in: src/interfaces.ts:288

Connection config — see ClientConnectionOptions.


correlation?​

optional correlation?: 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?​

optional dataConverter?: 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?​

optional enableLogger?: boolean

Defined in: src/interfaces.ts:457

Inherited from​

LoggerConfig.enableLogger


enableShutdownHooks?​

optional enableShutdownHooks?: 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?​

optional errorMapping?: 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?​

optional isGlobal?: boolean

Defined in: src/interfaces.ts:328


logLevel?​

optional logLevel?: LogLevel

Defined in: src/interfaces.ts:458

Inherited from​

LoggerConfig.logLevel


maxRestarts?​

optional maxRestarts?: number

Defined in: src/interfaces.ts:327

Maximum restart attempts before giving up for all workers (default: 3)


muteErrors?​

optional muteErrors?: 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​

LoggerConfig.muteErrors


redactKeys?​

optional redactKeys?: 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​

LoggerConfig.redactKeys


runtime?​

optional runtime?: 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?​

optional shutdownTimeout?: 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?​

optional strictSecurity?: 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?​

optional taskQueue?: string

Defined in: src/interfaces.ts:314


worker?​

optional worker?: Omit<WorkerDefinition, "taskQueue">

Defined in: src/interfaces.ts:322

Single-worker config. Equivalent to Omit<WorkerDefinition, 'taskQueue'>.


workers?​

optional workers?: WorkerDefinition[]

Defined in: src/interfaces.ts:323