Skip to main content

RpcConfig

RpcConfig = { mode: "core"; timeout?: number; } | { ackExtension?: AckExtensionConfig; concurrency?: number; consume?: Partial<ConsumeOptions>; consumer?: Partial<ConsumerConfig>; management?: EntityManagement; mode: "jetstream"; stream?: StreamConfigOverrides; subjectPrefix?: string; timeout?: number; }

Defined in: src/interfaces/options.interface.ts:53

RPC transport configuration.

Discriminated union on mode:

  • 'core': NATS native request/reply. Lowest latency.
  • 'jetstream': Commands persisted in JetStream. Responses via Core NATS inbox.

When mode is 'core', only timeout is available. When mode is 'jetstream', additional stream/consumer overrides are exposed.

Union Members

Type Literal

{ mode: "core"; timeout?: number; }

mode

mode: "core"

timeout?

optional timeout?: number

Request timeout in ms. Default: 30_000.


Type Literal

{ ackExtension?: AckExtensionConfig; concurrency?: number; consume?: Partial<ConsumeOptions>; consumer?: Partial<ConsumerConfig>; management?: EntityManagement; mode: "jetstream"; stream?: StreamConfigOverrides; subjectPrefix?: string; timeout?: number; }

ackExtension?

optional ackExtension?: AckExtensionConfig

Auto-extend ack deadline via msg.working() during RPC handler execution. The RPC handler timeout (setTimeout + msg.term()) still acts as the hard cap.

concurrency?

optional concurrency?: number

Maximum number of concurrent RPC handler executions.

consume?

optional consume?: Partial<ConsumeOptions>

Options passed to the nats.js consumer.consume() call for the command consumer.

consumer?

optional consumer?: Partial<ConsumerConfig>

Raw NATS ConsumerConfig overrides for the command consumer.

management?

optional management?: EntityManagement

Provisioning control for RPC stream/consumer. Falls back to provisioning.management.

mode

mode: "jetstream"

stream?

optional stream?: StreamConfigOverrides

Raw NATS StreamConfig overrides for the command stream.

subjectPrefix?

optional subjectPrefix?: string

Custom subject prefix (trailing dot normalized), e.g. 'company.orders.'.

timeout?

optional timeout?: number

Handler timeout in ms. Default: 180_000 (3 min).