-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Single active consumer #1802
Single active consumer #1802
Conversation
This commit introduces exclusive consumer. A queue is declared with the x-exclusive-consumer argument set to true and it will dispatch messages to only one consumer at a time. This exclusive consumer is typically the first one to consume from the queue. Other consumers are simply ignored. If the exclusive consumer is cancelled, another consumer is picked up randomly. Subsequent commits will handle other cases than simple cancellation (e.g. the owning channel of the exclusive consumer is closed). [#161090309] References #1743
[#161090309] References #1743
[#161090309] References #1743
Instead of x-exclusive-consumer. [#161090309] References #1743
Conflicts: src/rabbit_amqqueue.erl src/rabbit_amqqueue_process.erl
Single active consumer will have its own info item. [#161090309] References #1743
Uses a buffer list for non-active consumers. The active consumer is stored in the usual consumers structure, so the logic around servicing consumers is kept the same. [#162582065] Fixes #1799
…r-in-qq Conflicts: src/rabbit_fifo.erl src/rabbit_quorum_queue.erl
…r-in-qq Conflicts: src/rabbit_quorum_queue.erl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed rabbit_fifo
- Looks good - a few minor corrections.
Also would love to see some unit tests inside rabbit_fifo
for these changes.
src/rabbit_fifo.erl
Outdated
S = return_all(State0, Checked0), | ||
Effects = cancel_consumer_effects(ConsumerId, S, Effects0), | ||
{Effects, #state{waiting_consumers = WaitingConsumers1}}; | ||
false -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prior function clause when it matches on the empty list should make this clause impossible.
Fixes #1799, supersedes #1744.
Depends on rabbitmq/rabbitmq-common#288.