[rabbitmq-discuss] Headers Exchange

Jason J. W. Williams jasonjwwilliams at gmail.com
Thu Jan 27 17:45:38 GMT 2011


Hi David,

Thank you for the explanation. Are there any docs on how to construct the bind string? 

Also, is the performance better than topic?

Thank you in advance. 

-J

Sent via iPhone

Is your e-mail Premiere?

On Jan 27, 2011, at 4:55, David Wragg <david at rabbitmq.com> wrote:

> "Jason J. W. Williams" <jasonjwwilliams at gmail.com> writes:
>> Is the headers exchange still supported?
> 
> Yes.
> 
>> Seems to be from the RabbitMQ
>> AMQP compatibility chart but it's hard to find any concrete
>> information on using it. What is the advantage if any over topic?
> 
> Short and fairly useless answer: Headers exchanges route based on the
> headers of the message.  Topic exchanges route based on the routing key
> usd to publish the mesage.
> 
> Longer answer:
> 
> - Headers exchanges can express an "any field matches" or an "all fields
>  match" condition.  Topic exchanges can only express an "all words
>  match" (e.g. a binding key of "*.x.*.y.*" will only match routing keys
>  where the second word is "x" and the fourth word is "y"; OTOH multiple
>  bindings provide a way to express disjunctions - you could bind a
>  queue twice to a topic exchange, once with binding key "*.x.*.*.*" and
>  once with "*.*.*.y.*").
> 
> - Topic exchanges can do hierarchical matching via the "#" operator
>  (e.g. a binding key of "a.b.#" matches any routing keys beginning with
>  "a.b").
> 
> The headers exchange is quite limited in terms of the queries it can
> express: It can only do equality and presence matching on fields.  It
> can only express an "and" and "or" combination over a set of field
> conditions, not more elaborate boolean expressions (and no negation).
> So while the header exchang might appear to offer a lot, in practice its
> uses are restricted to a fairly small niche.  A more general variant
> would be a lot more interesting.
> 
> David
> 
> -- 
> David Wragg
> Staff Engineer, RabbitMQ
> SpringSource, a division of VMware


More information about the rabbitmq-discuss mailing list