[rabbitmq-discuss] RabbitMQ persistence and multi producers- multi consumers

Simon MacMullen simon at rabbitmq.com
Fri Jul 9 12:56:50 BST 2010

On 09/07/10 12:49, Francisco Gonzalez-Blanch wrote:
> Thanks for the answers!  But If the producer is launched first and then
> the consumer, i'm losing all the initial messages until the consumer is
> created. I attach you the code snippets with the test.

I think contrary to what Andreas said, in your case you should have the 
producer create a queue with a well known name when it starts up, which 
the consumer can connect to. ATM with your code no queue exists until a 
consumer creates it, so all messages before that point are dropped.

<code snipped>

> In addition i have another question , is it possible to make that not
> all the consumers get all the messages  with a fanout exchange, i mean
> is it possible to balance the messages in between the consumers. Thanks
> a lot. regards!

If each consumer creates its own queue, each consumer will get all the 

If each consumer connects to the same queue, the messages will be 
balanced among the consumers.

NB this balancing will not be very fair if the consumers connect to a 
preexisting queue with a bunch of messages, unless you set the prefetch 
count using basic.qos. Once the existing messages are drained and the 
queue is empty it will round-robin subsequent messages.

Cheers, Simon
> Francisco González-Blanch Rodríguez
> On Fri, Jul 9, 2010 at 1:39 PM, Ovidiu Deac <ovidiudeac at gmail.com
> <mailto:ovidiudeac at gmail.com>> wrote:
>     If nobody extracts the message from the queue the message won't be lost.
>     On Fri, Jul 9, 2010 at 1:09 PM, Francisco Gonzalez-Blanch
>     <fblanch at gmail.com <mailto:fblanch at gmail.com>> wrote:
>      > Hi all,
>      > I'm a newbie in rabbitmq and i'm working on a distributed data
>     processing
>      > application using rabbitmq as distributed task queue. I want to
>     ask you
>      > about where can i find information about how to make persistent
>     queues, and
>      > how to make that, if a producer sends messages to queue and no
>     one is listen
>      > to it and then a consumer is attached , the consumer gets all the
>     messages,
>      > even the ones that were produced before the consumer was
>     attached. Thank you
>      > very much.
>      >
>      >
>      >
>      > _______________________________________________
>      > rabbitmq-discuss mailing list
>      > rabbitmq-discuss at lists.rabbitmq.com
>     <mailto:rabbitmq-discuss at lists.rabbitmq.com>
>      > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>      >
>      >
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Simon MacMullen
Staff Engineer, RabbitMQ
SpringSource, a division of VMware

More information about the rabbitmq-discuss mailing list