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

Single active consumer #1802

Merged

Conversation

acogoluegnes
Copy link
Contributor

@acogoluegnes acogoluegnes commented Dec 14, 2018

Fixes #1799, supersedes #1744.

Depends on rabbitmq/rabbitmq-common#288.

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
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
@michaelklishin michaelklishin changed the title Single active consumer in quorum queue Single active consumer Dec 20, 2018
…r-in-qq

Conflicts:
	src/rabbit_quorum_queue.erl
Copy link
Contributor

@kjnilsson kjnilsson left a 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 Show resolved Hide resolved
src/rabbit_fifo.erl Outdated Show resolved Hide resolved
src/rabbit_fifo.erl Outdated Show resolved Hide resolved
S = return_all(State0, Checked0),
Effects = cancel_consumer_effects(ConsumerId, S, Effects0),
{Effects, #state{waiting_consumers = WaitingConsumers1}};
false ->
Copy link
Contributor

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.

src/rabbit_fifo.erl Outdated Show resolved Hide resolved
src/rabbit_fifo.erl Outdated Show resolved Hide resolved
src/rabbit_fifo.erl Outdated Show resolved Hide resolved
@michaelklishin michaelklishin merged commit a375473 into master Jan 9, 2019
@michaelklishin michaelklishin deleted the rabbitmq-server-1799-single-active-consumer-in-qq branch January 9, 2019 00:03
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.

None yet

3 participants