On Thu, Jul 14, 2011 at 7:41 PM, Jeff Segal <jeffrey.se...@gmail.com> 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.
>

This is not really Camel specific as you have 2 java beans:
- MyRouteBuilder
- MyBean

And you need to access the instance of MyRouteBuilder from the
instance of MyBean.
For that you can do IoC stuff.



> Thanks,
> Jeff
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to