[rabbitmq-discuss] Why is the queue created on the consumer's side?
Alexandru Scvorţov
alexandru at rabbitmq.com
Mon Feb 13 10:43:11 GMT 2012
Hi,
> I've understood from the tutorials that the producer doesn't send any
> message directly to a queue, and that quite often doesn't even know if a
> message will be delivered to a queue.
Correct. It can use mandatory and immediate delivery modes to check if
the message has reached any queues, though.
> Does queue declaration means queue creation? If yes, I think that it is
> quite strange to create a queue on the consumer's side in real
> applications.If no, where is the created?
Queue declaration is an idempotent queue-creation. It's more like an
assertion that the queue exists (after the queue.declare, you *know* the
queue exists). So, you can declare a queue multiple times, but it will
only be created once.
Who should declare the queue depends from application to application.
For instance, in a work-queue scenario (where a producer enqueues tasks
for workers to execute), the producer should declare the queue (so that
tasks are queued even if there aren't any active workers). In many
pub-sub scenarios, where consumers subscribe to events from a producer
(and old events are not interesting), the consumers would declare queues
(probably, one each). In many other cases, both the consumer and the
producer would declare the queue (the producer to ensure that messages
aren't lost, and the consumer so that it can start consuming from the
queue even if the producer hasn't come online to declare the queue yet).
Hope this helps.
Cheers,
Alex
On Sun, Feb 12, 2012 at 05:32:36AM -0800, Bamboula wrote:
>
> Hello all,
>
> I've understood from the tutorials that the producer doesn't send any
> message directly to a queue, and that quite often doesn't even know if a
> message will be delivered to a queue.
>
> In the third tutorial (Publisher/Subscriber), the queue is declared on the
> consumer's side. I think that's for simplicity reasons in this particular
> example (since the number of consumers is equal to the number of queues).
> Does queue declaration means queue creation? If yes, I think that it is
> quite strange to create a queue on the consumer's side in real
> applications.If no, where is the created?
>
> I would appreciate if someone could give me some information.
>
> Thanks a lot,
>
> Bamboula
> --
> View this message in context: http://old.nabble.com/Why-is-the-queue-created-on-the-consumer%27s-side--tp33309859p33309859.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
More information about the rabbitmq-discuss
mailing list