[rabbitmq-discuss] Question about configuration of queues

Edwin Fine rabbitmq-discuss_efine at usa.net
Wed Nov 5 03:46:20 GMT 2008

On Tue, Nov 4, 2008 at 5:41 PM, Beene, William R.
<beenewilliamr at gmail.com>wrote:

> On Tue, Nov 4, 2008 at 4:34 PM, Ben Hood <0x6e6562 at gmail.com> wrote:
> > William,
> >
> > On Tue, Nov 4, 2008 at 10:05 PM, Beene, William R.
> > <beenewilliamr at gmail.com> wrote:
> >> Is there anyway to preconfigure a queue in rabbitmq before my app that
> >> needs the queue starts up.
> >> I want data sent to the queue to be persisted so that the app can get
> >> it when it starts up.
> >> Does this use case make sense? Is this possible? Any pointers would be
> >> greatly appreciated.
> >
> > Why don't just declare the queue, send the messages that you want to
> > pre-populate the queue with (setting the persistent flag when sending)
> > and then after this has occurred, start a consumer to receive the
> > messages?
> >
> > HTH,
> >
> > Ben
> >
> Because then the producers would have to know about all of the consumers.
> I would rather put this in a property file or something. It looks like
> I may have to write a small program that reads a property file and creates
>  the queues I need.


If I understood your question correctly, I don't see why the producers would
need to know all about the consumers.

The producers publish to an exchange using a routing key. In a simple
scenario, the routing key is just a queue name. The producers would have to
know the key to be able to publish to that queue.

You can set it up so that whichever actor (consumer or producer) first tries
to access the queue creates it (if the flags are set up to do this). If the
consumer gets there first, it will create an empty queue and sit and wait on
it, or come back later and try again. If it's the producer that first starts
up, it will create the queue, and as long as the messages you deliver are
flagged as persistent (assuming you want them to survive the rabbit server
restart), and not flagged for immediate delivery, the producer can happily
throw stuff in the queue (within reasonable memory limitations). The
consumer(s) may start up at any time and collect the messages. An
application I wrote works very much like this.

It may seem strange to let the consumers create the queues but, security
aspects aside (assuming that consumers are trusted), it's a very convenient
way to do what you want to do. (It can be confusing if the consumer uses the
wrong queue name, because it may create an empty queue and sit there forever
wondering why nobody is talking to it, but that's true of a lot of things in

Does this help?

Edwin Fine

> Thanks,
> William Beene
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20081104/c2d9bf3e/attachment.htm 

More information about the rabbitmq-discuss mailing list