Add support for Quorum Queues to RabbitMQ Broker #2
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.
This PR adds support for declaring queues as quorum queues. Quorum queues are the new standard for persistent queues in RabbitMQ. Rather than adding a lot more complexity to management of queues, I've opted to have quorum queues a broker level setting. Either all queues are expected to be quorum queues or none of them are (for the instantiated broker). Unfortunately, there's no built-in way of switching a classic mirrored queue over to being a quorum queue. Rather than forcing an opinion on users, it's left up to the users.
For the purposes of Dramatiq, the major feature that is supported by the RabbitMQ broker, but not by quorum queues is priorities. I've added an instantiation check to the RabbitMQ broker that raises an exception if it's passed both a
max_priority
& enablesquorum_queues
. I've chosen not to add any extra logic to messages that set a priority (you can imagine we silently swallow the message priority instead of erroring as would currently happen).Testing
To facilitate testing if the queue is in fact a quorum queue, I've added the requests library and send an API request over to RabbitMQ directly. The alternative is more magic of declaring queues with the expected parameters that feels like it's breaking through too many layers of abstraction for my own comfort. I'm open to switching back to that approach to avoid adding the extra test dependency.