On 24 October 2015 at 16:25, helicopterman22
<[email protected]> wrote:
> Hi
>
> No, I was hoping that the headers that go with the message that the exchange
> will use to decide which queue to put the message on could be part of the
> destination string.
>
> Such as       (exchange name) (delimiter) (headers)     for example.
>
> I can use the destination string to publish and subscribe to other types of
> exchanges, it would be a bit of a nuisance if I have to create separate
> classes to cope with publishing to a headers exchange.
>
> As I said the documentation hints that I can do this but only gives examples
> for queues and topics.
>

The headers that the exchange uses to filter the messages onto its
bound queues are part of the messages sent rather than the destination
(which in this case would simply be the exchange itself), so you dont
include them in the destination string of the producer. Instead you
set the headers on the individual messages that you send; you
potentially might set different headers on every message such that
they might match different bindings. The headers are mentioned in the
destination string for the consumer because that is how you have
configured the exchange binding the consumer adds to say which headers
you want it to filter to the queue being bound to the exchange.

If you want the desitnation string itself to so closely govern where
the messages go when sent, you might be better using something other
than a headers exchange.

Robbie

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to