[rabbitmq-discuss] Shovel config example with declare.queue with a x-ha-policy argument?

Jerry Kuch jerryk at vmware.com
Wed Feb 22 03:24:43 GMT 2012

Hi, Lance and Elias...

As you've surmised, the access_refused errors you're seeing are to be
expected when you try to declare an already existing queue or exchange
whose properties don't 100% match what you're now asking for.  To
avoid the problem, you'll need to make sure all of the easy fields in
the Shovel config's declaration of the queue are exactly equal and
then deal with the optional arguments list which requires a bit of
care to encode.

The arguments list can be a bit tricky since it ultimately gets passed
through to the RabbitMQ Erlang client under the covers and I'm not
sure we document how to properly populate the arguments list with the
appropriate structures and type annotations anywhere.

Here are a couple of examples corresponding to x-ha-policy settings of
"all" and "nodes".  In the case of the latter you also need a list of
nodes in the "x-ha-policy-params" argument.  The "nodes" example here
has a single node, but with a bit of care you can complete the pattern
using your own cluster's node names...  Snippets of the forms below
will replace the 'queue.declare' sections in your Shovel config:

Example 1:  "all" mirroring

            [{queue, <<"backup_orders">>},
             {arguments, [{<<"x-ha-policy">>,longstr,<<"all">>}]}]},

Example 2: specified "nodes" mirroring

          [{queue, <<"backup_orders">>},
           arguments, [{<<"x-ha-policy-params">>,
                        [{longstr,<<"rabbit at StrongMad">>}]},

The key thing to note in the "nodes" case is that the we encode the
node's names as Erlang binaries, wrap the binaries up in tuples with 
the atom-label longstr in first position, and then store them in a list,
tagged with the atom array.

While looking at this I also noticed that the "working shovel config"
example we refer to on our website probably isn't all that working
anymore due to the auto_ack and tx_size settings it contains.  I've
let the authors of that file (and the book in which it will appear)
know that things may have changed and that they might want to
sanity check it...

Best regards,

Lance-9 wrote:
> Hello all, I'm also looking for an example of Shovel with x-ha-policy.
>  Looks like I'm getting access_refused errors connecting to the
> destination
> queue because I'm missing this parameter.  Is this a supported
> configuration?
> Thanks
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
View this message in context: http://old.nabble.com/Shovel-config-example-with-declare.queue-with-a-x-ha-policy-argument--tp33258095p33368593.html
Sent from the RabbitMQ mailing list archive at Nabble.com.

More information about the rabbitmq-discuss mailing list