SetupFabricCommand: Add --skip-anon-consumers option #739
+169
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds an
--skip-anon-consumersoption to theSetupFabricCommand(rabbitmq:setup-fabric).Which will skip the
setupFabric()method call onAnonConsumers if the option is set. The behaviour is the same as now if the option is not set.Our use case:
We have producer and consumer containers.
These run the
rabbitmq:setup-fabriccommand on startup.We have set the
auto_setup_fabricconfig tofalseon our producers & consumers.This way, we can ensure that all needed exchanges & queues exist after the container has started. And the exchanges & queues are not redeclared every time we publish a message or restart a consumer.
Problem we run into:
We also have anonymous consumers. For those, we observe that the anonymous / auto-delete queues that are created by the
rabbitmq:setup-fabriccommand are never deleted.This may be the case, because we use the same RabbitMQ bundle configuration for our producer & consumer containers (we'd like to keep it that way if possible, makes it easier). Thus, the anon consumers are also configured on the producer containers. And those create a new auto-delete queue when they run the
rabbitmq:setup-fabriccommand. I'm not 100% sure, but I suspect these queues are never deleted, because there's never a consumer for them.The easiest fix I see is, to just add the ability to ignore the anon consumers when running the command.