If you want to apply common decoration to all messages/routes, then use an
http://camel.apache.org/intercept.html interceptor strategy
Otherwise, using a Bean or Processor is fine and can be reused across routes
easily as well, etc.
Jeff Segal wrote:
>
> I'd like to know the best way to add domain-specific context information
> to
> Exchanges linked to a particular RouteBuilder. Let's say that I have the
> following:
>
> public class MyRouteBuilder extends RouteBuilder {
>
> String someProperty;
>
> @Override
> public void configure() throws Exception {
> from("direct:foo").to("bean:myBean");
> }
>
> }
>
> public class MyBean {
> public void handle(Exchange exchange) {
> // Want to access 'someProperty' of MyRouteBuilder here
> }
> }
>
> One way that I believe would work here would be to add a Processor to the
> Route which called exchange.setProperty(), then access it in MyBean via
> exchange.getProperty(). However, I'm curious if there is an easier/more
> preferred way of doing this.
>
> Thanks,
> Jeff
>
-----
Ben O'Day
IT Consultant -http://consulting-notes.com
--
View this message in context:
http://camel.465427.n5.nabble.com/Adding-properties-to-an-Exchange-tp4587592p4587635.html
Sent from the Camel - Users mailing list archive at Nabble.com.