Exchange interface has getExchangeId() method which returns ID of an exchange. Is there a way to pass this value to a method of a bean when calling the bean from a route?
The same question is about ID of a route which originated an exchange. This value is returned by getFromRouteId() method of Exchange interface.
I know I could pass an Exchange object to the bean entirely. But it's undesirable to bind a bean to Camel API in my case.
You can use the @Simple annotation bean parameter binding
public void foo(@Simple("exchangeId") String id,
@Simple("routeId") String routeId,
Object body) {
...
}
Some links
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With