Skip to content

feat(rabbitmq): configurable error/audit queue arguments#21

Merged
twatson83 merged 1 commit into
masterfrom
feat/configurable-error-audit-queue-args
Jul 20, 2026
Merged

feat(rabbitmq): configurable error/audit queue arguments#21
twatson83 merged 1 commit into
masterfrom
feat/configurable-error-audit-queue-args

Conversation

@twatson83

Copy link
Copy Markdown
Collaborator

What

Adds two new consumer options to @serviceconnect/rabbitmq, mirroring the existing queueArguments / retryQueueArguments hooks:

  • consumer.errorQueueArguments?: Record<string, unknown>
  • consumer.auditQueueArguments?: Record<string, unknown>

These flow into the error and audit queue declarations, so they can be declared with RabbitMQ arguments — e.g. as quorum queues:

consumer: { errorQueueArguments: { 'x-queue-type': 'quorum' } }

Why

The main and retry queues already accept arguments, but the error and audit queues were hardcoded as { queue, durable: true } with no arguments hook, forcing them to stay classic queues. This closes that gap so all four declared queues expose the same configuration surface.

Changes

  • packages/rabbitmq/src/options.ts — new fields on the consumer interface and ResolvedConsumerOptions; default to {} in resolveConsumerOptions.
  • packages/rabbitmq/src/topology.ts — spread the resolved arguments into the error and audit QueueSpecs.

The consumer already forwards QueueSpec.arguments to queueDeclare, so no consumer change was needed.

Compatibility

Backward-compatible: empty args resolve to arguments: {}, which queueDeclare treats identically to no arguments. No wire-format or C# master-parity impact (queue arguments are a broker concern, not part of the message contract).

Operational note: x-queue-type is fixed at declare time — an existing classic error/audit queue must be deleted before it can be redeclared as quorum.

Testing

  • Added merge tests for both queues in topology.test.ts and pass-through/default tests in options.test.ts.
  • All 82 rabbitmq unit tests pass; tsc --noEmit and biome check clean.

🤖 Generated with Claude Code

Add consumer.errorQueueArguments and consumer.auditQueueArguments,
mirroring the existing queueArguments/retryQueueArguments hooks, so the
error and audit queues can be declared with RabbitMQ arguments (e.g.
{ 'x-queue-type': 'quorum' }). Previously both were hardcoded as
{ queue, durable: true } with no arguments hook, forcing them to stay
classic queues.

The consumer already forwards QueueSpec.arguments to queueDeclare, so
only options resolution and topology construction change. Empty args
resolve to arguments: {}, which queueDeclare treats identically to no
arguments, keeping the change backward-compatible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@twatson83
twatson83 merged commit 0ec1c21 into master Jul 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant