FAQ
We have a custom exchange, which work great.

Now my requirement is that - Add a custom header to the every messages
which is delivered through the custom exchange.

Anybody can help me ?

--
Sujan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120531/92a1d9f2/attachment.htm>

Search Discussions

  • Simon MacMullen at May 31, 2012 at 9:56 am

    On 31/05/12 07:34, Sujan Dutta wrote:
    Now my requirement is that - Add a custom header to the every messages
    which is delivered through the custom exchange.
    I'm afraid there isn't a general API for that.

    The problem is that exchanges are just for routing - in a complex
    exchange-to-exchange scenario where a message gets routed like:

    /--> X2 --\
    v
    X1 X4 --> Q
    ^
    \--> X3 --/

    only one copy of the message ends up in Q - so did it pass through X2 or
    X3? Which one has the right to modify it?

    Having said that, if you know that you *won't* be using such complex
    routing, you could do this by:

    route(X, Delivery) ->
    case custom_header_exists(Delivery) of
    true -> route_as_normal(Delivery);
    false -> rabbit_basic:publish(X, add_custom_header(Delivery)),
    []
    end.

    i.e. if the header needs to be added, don't route it at all, but instead
    republish it to yourself with the header added.

    Cheers, Simon

    --
    Simon MacMullen
    RabbitMQ, VMware

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedMay 31, '12 at 6:34a
activeMay 31, '12 at 9:56a
posts2
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Simon MacMullen: 1 post Sujan Dutta: 1 post

People

Translate

site design / logo © 2022 Grokbase