Skip to content

fix: use exclusive transient queues for RabbitMQ 4.3+ compat#771

Merged
argoyle merged 1 commit into
opzkit:mainfrom
emilri:fix/transient-queues-exclusive
May 4, 2026
Merged

fix: use exclusive transient queues for RabbitMQ 4.3+ compat#771
argoyle merged 1 commit into
opzkit:mainfrom
emilri:fix/transient-queues-exclusive

Conversation

@emilri
Copy link
Copy Markdown
Contributor

@emilri emilri commented May 4, 2026

hey, ran into this when local broker hit 4.3, transientEventStreamListener consumers couldn't connect anymore.

what's happening

transientQueueDeclare declares queues with durable: false, autoDelete: true, exclusive: false. RabbitMQ 4.3.0 deprecated that combo (transient_nonexcl_queues) and now rejects it by default:

INTERNAL_ERROR - Feature transient_nonexcl_queues is deprecated.

so the connection just dies on startup.

the fix

flip exclusive: falseexclusive: true in transientQueueDeclare. that's it, one line.

       durable: false,
       autoDelete: true,
-      exclusive: false,
+      exclusive: true,
       expires: QUEUE_EXPIRATION,

why this is fine

  • exclusive: true = queue tied to the declaring connection, dies when it closes. that's what a transient queue should be doing anyway
  • fan-out still works since transientEventStreamListener already gives each consumer a unique queue name (serviceEventRandomQueueName), all bound to the same routing key. exclusive only restricts who consumes from a given queue, not the routing
  • works on every broker version that supports AMQP 0-9-1 so 3.x and 4.0-4.2 keep working too

tests

  • had to flip the matching assertion on lib/index.test.ts:472 (same exclusive: falseexclusive: true). all 32 pass, 100% coverage still
  • also tested locally with 4 backend pods against rabbitmq 4.3.0, one published event lands in all 4 like before

refs

RabbitMQ 4.3.0 deprecated the non-durable + non-exclusive combo
(transient_nonexcl_queues) and rejects it by default, so
transientEventStreamListener consumers can't connect anymore.

exclusive: true is what a transient queue should be anyway —
connection-scoped, auto-deleted on disconnect. fan-out still works
because each consumer already gets a UUID-named queue via
serviceEventRandomQueueName.

refs:
https://www.rabbitmq.com/docs/queues
rabbitmq/rabbitmq-server#12972
Copy link
Copy Markdown
Member

@argoyle argoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎖️ 🙇🏻

@argoyle argoyle enabled auto-merge (squash) May 4, 2026 12:26
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6c62c67) to head (4b8af10).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #771   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          488       488           
  Branches        56        56           
=========================================
  Hits           488       488           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argoyle argoyle merged commit 2646d79 into opzkit:main May 4, 2026
8 of 9 checks passed
@peter-svensson
Copy link
Copy Markdown
Member

Thanks for the contribution @emilri 🚀

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.

3 participants