Auto Creating Mirrored Queues in RabbitMQ

460 views
Skip to first unread message

Vinay Manda

unread,
Dec 3, 2011, 1:02:33 PM12/3/11
to masstransit-discuss
We are using RabbitMQ for middle-ware. When a queue is bound, if it
doesn't exist it is automatically created by MassTransit

servicebusconfigurator.ReceiveFrom(<QueueName uri>);

However we are trying to setup a clustered RabbitMQ with mirrored
queues and I do not see an option to specify to create a mirrored
queues using MT. Am I right in assuming so or is there a way to do
that?

I came to this conclusion as I see the below in the method
RabbitMqEndpointManagement.BindQueue
model.QueueDeclare(queueName, true, false, false, null);

Which means it cannot take in the argument to add a policy to the
queue. It is set to null

I couldn't find this anywhere documented and hence thought it would be
a good thing to post this and get clarified.

Thanks in advance for any assistance.

Dru Sellers

unread,
Dec 3, 2011, 1:18:41 PM12/3/11
to masstrans...@googlegroups.com
you are correct. we currently do not support this concept.
how would you want it implemented from the config syntax?

shouldn't be too hard to add (i wouldn't think) if you wanted to take a stab at a pull request.

-d

-d

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=en.

Jeremy Patton

unread,
Dec 3, 2011, 3:33:57 PM12/3/11
to masstrans...@googlegroups.com
i ran into the same thing a couple weeks ago and implemented the ha-policy by adding a query string to the queue's uri. we've been using in staging environment and haven't seen any issues. there's a pull request for this in github already.  

example of usage:
 rabbitmq://someServer/SomeQueue?ha=true

one note from our research on rabbit and high availability options is that the "nodes" option for x-ha-policy was not ready for prime-time, maybe this will be fixed in 2.7. the pull request sets "all" for the x-ha-policy so every node in the cluster will receive a copy of the queue. 

you can find my fork at : https://github.com/pattonjp/MassTransit

Vinay Manda

unread,
Dec 5, 2011, 2:07:39 PM12/5/11
to masstransit-discuss
Thanks Dru for the quick response.

Thanks Jeremy, I checked your code base and it works for this.

I was thinking more of have additional method in the configurator
which can take the arguments for the RabbitMQ queue. On the RabbitMQ
client API's they have the argument parameter exposed and specifying
the mirroring is via free form text parameters and hence I didn't want
to had code any methods for the specific functionality.

Please put your thoughts if this is what the community would like. I
will make changes test it locally and see if I can do a pull request
(I am new to using github, so might take some time) But I would love
to take a stab at it.

Dru Sellers

unread,
Dec 5, 2011, 3:09:02 PM12/5/11
to masstrans...@googlegroups.com
CFG Api I am thinking 

var bus = ServiceBusFactory.New(sbc=>
{
    sbc.ReceiveFrom("rabbitmq://localhost/aaa");
    sbc.UseRabbitMq(rm=>
    {
        rm.MirrorQueue( /*any args for mirroring */ );
    });
});

Chris Patterson

unread,
Dec 5, 2011, 4:03:47 PM12/5/11
to masstrans...@googlegroups.com
I merged the pull request to support HA into /develop.

If people can work with it and figure out what makes sense from a configuration method aspect we can work that in to clean it up before it goes public.

Jeremy Patton

unread,
Dec 6, 2011, 9:32:51 AM12/6/11
to masstrans...@googlegroups.com
agree the query string isn't ideal but didn't have the time to implement through the configurator. it would be helpful down the line to pass a hash to specify the nodes of the cluster to mirror the queue.

this would be ideal:

var bus = ServiceBusFactory.New(sbc=>
{
    sbc.ReceiveFrom("rabbitmq://localhost/aaa");
    sbc.UseRabbitMq(rm=>
    {
        rm.MirrorQueue( ); //for mirroring on all nodes
        //OR
        rm.MirrorQueue("node1", "node2","node3" ); // to specify the nodes explicitly
    });
});

Eric Swann

unread,
Nov 9, 2012, 10:04:22 AM11/9/12
to masstrans...@googlegroups.com
I should clarify, that I see the query string implementation, but nothing in the configurator.

On Friday, November 9, 2012 8:07:11 AM UTC-6, Eric Swann wrote:
Just curious if this was ever implemented in some way or pulled into the trunk as I didn't see anything there.

Thanks!
Reply all
Reply to author
Forward
0 new messages