We are intending to build up a one way network of exchange-to-exchange bindings. Our requirement is to attach the route a message took to its header, but there seems to be no way to find out which exchange handled a message last.
I already tried looking up the information using the tracing functionality and there also exists a plugin that subscribes to the internal basic.publish event. Yet, all these ways just give me the exchange of first entry.
I even took a look at the rabbitmq-server source code and it seems like there is no possible extension point inside the routing function (see headers exchange routing for example). I am not an Erlang dev, so maybe there is an Erlang way of intercepting/extending functions to be called?
Example
+---------+
| |
| POE |
| |
+--+--+---+
| |
+-------+ | | +-------+
| | | | | |
| EX1 +---+ +----+ EX2 |
| | | |
+--+----+ +---+---+
| |
| |
| |
+--+----+ +---+---+
| | | |
| QU1 | | QU2 |
| | | |
+-------+ +-------+
For a message that ends up in QU2 we would like to have a header field like this:
{...
x-route, ["POE", "EX2"]
}