RabbitMQ - Does one consumer block the other consumers of the same queue?

前端 未结 1 1378
挽巷
挽巷 2021-02-15 17:55

I\'m in a phase of learning RabbitMQ/AMQP from the RabbitMQ documentation. Something that is not clear to me that I wanted to ask those who have hands-on experience. I want to h

相关标签:
1条回答
  • 2021-02-15 18:13

    No, the other consumers don't get blocked. Other messages will get delivered even if they have unacknowledged but delivered predecessors. If a channel closes while holding unacknowledged messages, those messages get returned to the queue.

    See RabbitMQ Broker Semantics

    Messages can be returned to the queue using AMQP methods that feature a requeue parameter (basic.recover, basic.reject and basic.nack), or due to a channel closing while holding unacknowledged messages.


    EDIT In response to your comment:

    Time to dive a little deeper into the AMQP specification then perhaps:

    3.1.4 Message Queues

    A message queue is a named FIFO buffer that holds message on behalf of a set of consumer applications. Applications can freely create, share, use, and destroy message queues, within the limits of their authority. Note that in the presence of multiple readers from a queue, or client transactions, or use of priority fields, or use of message selectors, or implementation-specific delivery optimisations the queue MAY NOT exhibit true FIFO characteristics. The only way to guarantee FIFO is to have just one consumer connected to a queue. The queue may be described as “weak-FIFO” in these cases. [...]

    3.1.8 Acknowledgements

    An acknowledgement is a formal signal from the client application to a message queue that it has successfully processed a message.[...]

    So acknowledgement confirms processing, not receipt. The broker will hold on to the message until it's gotten acknowleged, so that it can redeliver them. But it is free to deliver more messages to consumers even if the prededing messages have not yet been acknowledged. The consumers will not be blocked.

    0 讨论(0)
提交回复
热议问题