[rabbitmq-discuss] Insertion of message into RabbitMQ without queues defined

David Wragg david at rabbitmq.com
Tue Jun 22 08:14:04 BST 2010


Hi Andreas,

Andreas Jung <lists at zopyx.com> writes:
> Imagine the follow scenario:
>
> - fresh RabbitMQ installation, fresh database, no queues defined
>
> - a producer inserts a bunch of messages into RabbitMQ to some exchange
>
> - later a consumer attaches and defines a queue and attached to the same
> exchange
>
> In this scenario the consumer will not see the message that were
> inserted earlier - intentional?

Yes.  That is how AMQP is designed: Exchanges have no buffering
behaviour, and do not store messages.  Instead, that is the function of
queues.

> How can the consumer get hold of those messages or is it necessary
> to declare the queues in any case before attaching the producers?

Yes, you should declare the necessary queues before the producers
publish.

> If yes: is it possible to define the queues through rabbitmqctl
> (and not by firing all producers with their queue definitions
> first)?

rabbitmqctl cannot declare queues.  But there are many other ways that
you could declare the queues.  For example, you could modify your
consumer applications to separate out the queue declaration
functionality, so you can run that separately.

If you'd really like a command line tool to create the queues,
rabbitmq-c <http://hg.rabbitmq.com/rabbitmq-c/> includes an
amqp_declare_queue command, although currently you need to build it from
source.

David

-- 
David Wragg
Staff Engineer, RabbitMQ
SpringSource, a division of VMware


More information about the rabbitmq-discuss mailing list