[rabbitmq-discuss] How to declare mirrored queue using pika?

Simon MacMullen simon at rabbitmq.com
Tue Nov 19 09:37:25 GMT 2013


Hi Ivan.

The use of queue arguments to declare a queue as HA dates from RabbitMQ 
2.x. In 3.x we changed this to use policies as you've already seen - 
since applications should not have to know about whether their queues 
are HA.

So use rabbitmqctl set_policy (or the management plugin).

Cheers, Simon

On 19/11/2013 06:57, HongXuan Ji wrote:
> Hi all,
>
> I am wondering how to declare a mirrored queue through the code level. I
> use the following code to declare the queue.
>
>
>         queue_args = {"x-ha-policy" : "all" } #/(hwcmq.4) Set queue
>         mirroring policy
>         channel.queue_declare(queue="hello-queue", arguments=queue_args)
>         #/(hwcmq.5) Declare the queue
>
>
>   which is referenced from
> the https://github.com/rabbitinaction/sourcecode/blob/master/python/chapter-5/hello_world_mirrored_queue_consumer.py.
>
> And after the operation, the "hello-queue" on the management interface
> shows :
>
> <https://lh6.googleusercontent.com/-3l9fEvEOwlk/UosKOZEthyI/AAAAAAAAAfY/b99UIQhIrPI/s1600/Untitled.png>
>
>
>
> I am not sure I succeed or not. Because I try the different way to
> delcare mirrored queue by the command:
>
> rabbitmqctl set_policy ha-all "^ha\." '{"ha-mode":"all"}'
>
> which is reference from the official page. And the result is more
> convinced which shows "ha-all" in the Policy field when I declare some
> queue whose name is prefixed by "ha.". And I also do some tests on it.
> it seems work.
>
> So I am wondering the simply adding parameter in the python command:
> *queue_declare *like the first paragraph is effective or not?
>
> Any idea?
>
> Regards,
>
> Ivan
>
>
> _______________________________________________
> 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