Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Quorum Queues to RabbitMQ Broker #2

Open
wants to merge 1 commit into
base: es/add-support-for-deleting-queues
Choose a base branch
from

Conversation

es
Copy link

@es es commented Apr 14, 2023

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 & enables quorum_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.

This PR adds support for declaring queues as [quorum queues](https://www.rabbitmq.com/quorum-queues.html). 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](https://www.rabbitmq.com/quorum-queues.html#feature-matrix) is priorities. I've added an instantiation check to
the RabbitMQ broker that raises an exception if it's passed both a `max_priority` & enables `quorum_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.
@twooster
Copy link

/approve

@aW3st
Copy link

aW3st commented Sep 12, 2023

@es would love to get this change merged to the main dramatiq branch. Thoughts on opening a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants