[rabbitmq-discuss] configuring an header exchange binding in rabbitmq.cfg

Tom Cellucci tcellucci at apple.com
Fri Nov 11 00:28:38 GMT 2011


Thanks to Matt for the help;  I was able to get a queue binding configured per his advice.  Now I'd like to configure an exchange binding, which sadly is not working like I'd hoped.  Here's what I have:

                                  {'exchange.declare', [{exchange, <<"events_forwarding_exchange">>}, {type, <<"headers">>}, durable]},
                                  {'exchange.declare', [{exchange, <<"events_local_exchange">>}, {type, <<"topic">>}, durable]},
                                  {'queue.declare', [{queue, <<"dc1_events">>}, durable]},
                                  {'queue.bind', [
                                     {exchange, <<"events_forwarding_exchange">>},
                                     {queue, <<"dc1_events">>},
                                     {arguments, [
                                        {"route_to_dc1", longstr, "true"}
                                     ]}
                                  ]},
                                  {'exchange.bind', [
                                     {exchange, <<"events_forwarding_exchange">>},
                                     {exchange, <<"events_local_exchange">>},
                                     {arguments, [
                                        {"x-match", longstr, "any"},
                                        {"route_to_local", longstr, "true"},
                                        {"route_to_dc2", longstr, "true"}
                                     ]}
                                  ]}

With the above configuration, the broker fails to start and emits the following error:

=INFO REPORT==== 10-Nov-2011::16:03:35 ===
    application: rabbitmq_shovel
    exited: {{invalid_shovel_configuration,master_events_shovel,
                 {invalid_parameter_value,sources,
                     {unknown_fields,'exchange.bind',[exchange]}}},
             {rabbit_shovel,start,[normal,[]]}}
    type: permanent

What's the right way set up an exchange binding in rabbitmq.config?   - I am running RabbitMQ 2.6.1.

Thanks,
Tom

On Nov 10, 2011, at 9:27 AM, Matthew Sackman wrote:

> Hi Tom,
> 
> On Thu, Nov 10, 2011 at 07:23:19AM -0800, Tom Cellucci wrote:
>> I am trying to configure a header exchange and some shovels using
>> 'rabbitmq.cfg'.  In the shovel configuration, I declare a header
>> exchange, a queue for the shovel, and would like to add a binding rule
>> so that messages with a given header are routed into the shovel queue.
>> How can I declare the binding rule for exchange->queue for a given
>> header value?  It's trivial to do through the web admin, but seemingly
>> impossible through the rabbitmq.cfg.  I've tried many variations
>> without success, and searched all over the web without finding an
>> example. Please advise.
> 
> Which version of RabbitMQ are you using? "rabbitmq.cfg" isn't a file
> name that I recognise - I think you mean "rabbitmq.config", and indeed
> that's the file name that the shovel README talks about:
> http://hg.rabbitmq.com/rabbitmq-shovel/file/b9f4e6dc4fa3/README
> 
> The bind will look something like:
> 
> {'queue.bind',
>       [{exchange, <<"my_exchange">>},
>        {queue,    <<"my_queue">>},
>        {arguments, [{"x-match",         longstr, "any"},
>                     {"headerName",      longstr, "headerValue"},
>                     {"otherHeaderName", longstr, "otherHeaderValue"}]}]}
> 
> I think.
> 
> Matthew



More information about the rabbitmq-discuss mailing list