[rabbitmq-discuss] Exclusive Producers?
Eric Arendt
ejarendt at gmail.com
Tue Feb 18 18:52:56 GMT 2014
You could also use the exclusive queue consuming functionality instead of
having to maintain a token message. Make sure you're the exclusive
consumer of a queue before you connect as a producer.
On Tue, Feb 18, 2014 at 2:23 AM, Alvaro Videla <videlalvaro at gmail.com>wrote:
> Hi,
>
> Maybe there's an easier solution, but you could try this:
>
> - Create a queue called "lock" (or whatever name suits you) and
> publish just one message to it, which will be the token producers need
> to obtain in order to publish messages.
> - Start your producers and make them consume just one message from
> that queue, ie basic_qos(prefetch-count=1), also tell RabbitMQ that
> you will ack the messages. The first producer arriving at the queue
> will grab the "token". The other producers will sit idle, waiting for
> said token.
> - When the producer receives the "token", then it can start publishing
> to the actual queue where you want the messages.
> - If that consumer crashes or is shut down, then the "token" will be
> requeued and some other of your backup producers will grab it, so it
> can start publishing.
> - if the producer wishes to stop, it can basic_reject(requeue=true)
> the "token", so another producer can grab it and start publishing.
>
> Regards,
>
> Alvaro
>
> On Tue, Feb 18, 2014 at 3:06 AM, Tarun Mistry <tarun.mistry at gmail.com>
> wrote:
> > Hi all,
> >
> > i'm new to RabbitMQ/AMQP. I am trying to solve an application level
> > high-availability problem and belive i'm not thinking about things in the
> > right way, I could use some advice!
> >
> > Here is what I would like to achieve, I could use some help understanding
> > the RabbitMQ way of doing it.
> >
> > 1) I have several message producers, only 1 of these is the primary, the
> > remainder as all backups.
> > 2) The primary is defined as the process that controls a single queue and
> > can post messages to it.
> > 3) If the primary process fails, I want a backup to take over
> immediately.
> > 4) All backups are in a race to get control of the queue (from 2)
> > 5) Once a backup gains control, it is now the primary.
> >
> > Using Rabbit speak, I feel like I need something called an "exclusive
> > producer".
> >
> > Do I need to fudge this by introducing a second queue and having all the
> > processes connect to this using the "exclusive consumer" pattern, and
> then
> > use this to determine who can control the main queue?
> >
> > Appreciate any advice
> >
> > Cheers
> > TM
> >
> >
> >
> >
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-discuss at lists.rabbitmq.com
> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "rabbitmq-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rabbitmq-discuss+unsubscribe at googlegroups.com.
> To post to this group, send email to rabbitmq-discuss at googlegroups.com.
> Visit this group at http://groups.google.com/group/rabbitmq-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140218/0651c5ff/attachment.html>
More information about the rabbitmq-discuss
mailing list