On Mon, Apr 30, 2012 at 9:26 PM, Purple Tea <maisa_man...@hotmail.com> wrote:
> Hi,
>
> I have a route that returns a bean, and I would like to call a method in the
> bean that was returned (which isn't in the registry).
> I've been looking at the bean binding documentation but I didn't find this
> scenario.
>
> Bellow is a sample code:
>
> <bean id="myBean" class="com.MyBean">
> </bean>
>
> <route>
>      <from uri="direct:start" />
>      <to ref="myBean" method="getBean" />
>
>      <to ref="myReturnedBean" method="doSomething" />
> </route>
>

You would need to use a dynamic language or simple language to invoke
a method on the message body.
And use the message translator EIP

For example the simple language supports OGNL like method invocation
chains. See more at
http://camel.apache.org/simple

And for bean parameter bindings you can see details at
http://camel.apache.org/bean-binding.html

So you should be able to do something a like this:

 <route>
      <from uri="direct:start" />
      <to ref="myBean" method="getBean" />
      <transform><simple>${body.doSomething}</simple></transform>
 </route>


>
> class MyBean  {
>     MyReturnedBean getBean () {
>         return new MyReturnedBean();
>    }
> }
>
> class MyReturnedBean {
>     void doSomething() {
>     }
> }
>
> I really appreciate your help.
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Invoking-a-bean-returned-by-a-previous-bean-invocation-tp5676696.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
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