What you can do is store MyObject as a property on the exchange and pass
this property as a variable to the process method. E.g:
from( "file:./src/inbox").setProperty("myobj", constant(myObject)).bean(
MyBean.class, "process(${property.myobj})" ).to( "file:./src/outbox" );
Regards,
Richard
On Thu, Jan 9, 2014 at 3:07 PM, Chirag Dewan <[email protected]>wrote:
> Hi all,
>
> This may be a very straight forward thing,but I was not able to find it.
>
> I have a route like:
>
> public class MyRouteBuilder extends RouteBuilder
> {
>
> private MyObject myObject;
>
> public MyRouteBuilder(MyObject myObject)
> {
>
> this.myObject = myObject;
>
> }
>
> @Override
> public void configure() throws Exception
> {
>
> from( "file:./src/inbox").bean( MyBean.class, "process(myObject)"
> ).to( "file:./src/outbox" );
>
> }
>
> And my bean:
>
> public class MyBean{
>
> public void process(MyObject myObject){
>
> //some processing on myObject
>
> }
>
> Now I want to pass myObject instance to the bean. But somehow I was not
> able to do that.
>
> Any help is much appreciated.
>
> Thanks.
>
> Chirag