Skip to content

Add ExternallyOwned() to RabbitMQ queues and exchanges (closes #3064)#3066

Merged
jeremydmiller merged 1 commit into
mainfrom
feat-3064-rabbitmq-externally-owned
Jun 10, 2026
Merged

Add ExternallyOwned() to RabbitMQ queues and exchanges (closes #3064)#3066
jeremydmiller merged 1 commit into
mainfrom
feat-3064-rabbitmq-externally-owned

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Closes #3064. Brings the ExternallyOwned() escape hatch added for Kafka topics (#3062) to the RabbitMQ transport, for queues and exchanges owned by another system where the connecting identity lacks configure/delete permissions.

Behavior

When a queue or exchange is marked ExternallyOwned(), Wolverine will:

  • never declare it at startup, even with AutoProvision() enabled
  • never delete it during a resources teardown
  • skip setting up or tearing down its bindings

API

ExternallyOwned() is available on:

  • RabbitMqListenerConfigurationopts.ListenToRabbitQueue("q").ExternallyOwned()
  • RabbitMqSubscriberConfigurationopts.PublishMessage<T>().ToRabbitQueue("q").ExternallyOwned() / .ToRabbitExchange("ex").ExternallyOwned()
  • RabbitMqExchangeConfiguration

…and as an IsExternallyOwned setter on RabbitMqExchangeConfigurationExpression, alongside the existing DeclarePassive setter.

opts.UseRabbitMq().AutoProvision();

opts.ListenToRabbitQueue("shared-orders").ExternallyOwned();
opts.PublishMessage<OrderPlaced>().ToRabbitExchange("shared-events").ExternallyOwned();

Included fix: DeclarePassive teardown asymmetry

A DeclarePassive exchange only makes a passive declaration at startup (verify-existence, never create). It was still being deleted on teardown, which is asymmetric — Wolverine would destroy a resource it deliberately never created. It is now left alone on teardown as well. (ExternallyOwned and DeclarePassive remain distinct flags: passive still touches the broker to verify existence; externally-owned never touches it at all.)

Tests

New externally_owned_rabbit_topology_is_skipped (6 facts, broker-side passive-declare existence checks):

  • queue / exchange are not created at startup under AutoProvision()
  • owned topology is still created alongside externally-owned (discriminator)
  • teardown leaves an externally-owned listener queue, exchange, and a DeclarePassive exchange alone

All 6 pass against the local broker; 52 related existing RabbitMQ tests stay green. wolverine.slnx -c Release builds clean (0 warnings, 0 errors).

Docs

New "Externally-Owned Queues and Exchanges" section in the RabbitMQ object-management guide, including the DeclarePassive distinction note.

🤖 Generated with Claude Code

Wolverine could already mark a Kafka topic as ExternallyOwned() (GH-3062) so
that the topic is never declared at startup nor deleted on teardown. This adds
the same escape hatch to the RabbitMQ transport for queues and exchanges that
are owned by another system, where the connecting identity lacks the
configure/delete permissions to create or remove the resource.

When an endpoint is marked ExternallyOwned():
- it is never declared at startup, even with AutoProvision() on
- it is never deleted during a resources teardown
- its bindings are neither set up nor torn down

Exposed as ExternallyOwned() on RabbitMqListenerConfiguration,
RabbitMqSubscriberConfiguration, and RabbitMqExchangeConfiguration, and as an
IsExternallyOwned setter on RabbitMqExchangeConfigurationExpression (alongside
the existing DeclarePassive setter).

Also fixes a teardown asymmetry surfaced by this work: a DeclarePassive
exchange only verifies existence at startup (it never creates the exchange), so
it is now left alone on teardown rather than being deleted.

Adds externally_owned_rabbit_topology_is_skipped with broker-side existence
checks covering queue/exchange setup-skip, owned-alongside-external, and the
listener/exchange/DeclarePassive teardown paths. Documents the feature in the
RabbitMQ object-management guide, including the DeclarePassive distinction.

Closes #3064

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Add ExternallyOwned() to RabbitMQ queues and exchanges (parity with #3062)

1 participant