[rabbitmq-discuss] Pub/Sub -- block publisher until all acks received from subscribers?

Emile Joubert emile at rabbitmq.com
Thu Nov 8 11:01:50 GMT 2012


Hi,

On 06/11/12 19:17, Nick Martin wrote:
> Perhaps my wording wasn't clear. I do not want to lose the tasks that
> are in the queue. I wish to pause work, not simply throw away work. One
> way to achieve a pause effect is to empty the queue. This leads to the
> problem of what to do with the remaining tasks that had been in the
> queue. These still need to be stored somewhere and they need to be
> stored reliably so that when we resume work we can re-queue them and
> they can be handled by the workers.

By "draining the queue" I meant stop publishing any new work and wait 
until the last published work item has been completed. Then the work 
queue is empty and you can perform maintenance actions.

The problem becomes more difficult if you want in-progess work to be 
interrupted or if you can't wait for the work queue to drain. The best 
approach will depend on the specific features and requirements of your 
system.

The publisher could passively redeclare the work queue to obtain the 
number of active consumers and use this to wait for the same number of 
acknowledgements to a "pause" message sent to a dedicated control queue 
that all workers monitor. The publisher could also retain all work 
messages that are in flights to be able to resend them after "resume". 
It is a difficult problem and there is no one best answer.


-Emile







More information about the rabbitmq-discuss mailing list