Skip to main content

StreamConsumerOverrides

@horizon-republic/nestjs-jetstream


@horizon-republic/nestjs-jetstream / StreamConsumerOverrides

StreamConsumerOverrides

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

Overrides for JetStream stream and consumer configuration.

Properties​

ackExtension?​

optional ackExtension?: AckExtensionConfig

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

Auto-extend the NATS ack deadline via msg.working() during handler execution.

  • false (default): disabled; NATS redelivers after ack_wait if not acked.
  • true: auto-extend at ack_wait / 2 interval (calculated from consumer config).
  • number: explicit extension interval in milliseconds.
  • { interval?, maxDuration? }: the same, plus how long one message may be extended.

A message stops being extended after 5 minutes unless maxDuration says otherwise.


concurrency?​

optional concurrency?: number

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

Maximum number of handler executions in flight at once. Messages beyond the limit queue FIFO and drain as handlers settle.

Default: undefined (unlimited, naturally bounded by max_ack_pending). Set this to protect downstream systems from overload.

If concurrency < max_ack_pending, messages buffer in RxJS while their NATS ack timer ticks. Increase ack_wait proportionally to prevent unnecessary redeliveries.


consume?​

optional consume?: Partial<ConsumeOptions>

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

Options passed to the nats.js consumer.consume() call. Controls prefetch buffer size, idle heartbeat interval, and auto-refill thresholds.

nats.js supports two consumption modes (message-based and byte-based). Do not mix max_bytes/threshold_bytes with threshold_messages; use one mode or the other.

See​

https://github.com/nats-io/nats.js ConsumeOptions


consumer?​

optional consumer?: Partial<ConsumerConfig>

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


management?​

optional management?: EntityManagement

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

Provisioning control for this kind's stream/consumer. Falls back to provisioning.management.


retry?​

optional retry?: RetryConfig

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

Delay before each redelivery after a handler throws or calls ctx.retry(). See RetryConfig.


stream?​

optional stream?: Partial<Omit<StreamConfig, "retention" | "subjects" | "description">>

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


subjectPrefix?​

optional subjectPrefix?: string

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

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