Reputation: 665
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.
Upvotes: 3
Views: 3695
Reputation: 55750
You can use the @Simple
annotation bean parameter binding
public void foo(@Simple("exchangeId") String id,
@Simple("routeId") String routeId,
Object body) {
...
}
Some links
Upvotes: 6