camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Static method in route?
Date Sat, 27 Aug 2011 07:32:52 GMT
Hi

Yeah Camel should be able to invoke any public method on a bean.
However the logic may favor using a bean instance when invoking the
method. (Will have to check that).
So in case of a static method, the code could be optimized, in case it wasn't.

Let me create a JIRA ticket so we wont forget.


On Fri, Aug 26, 2011 at 1:22 AM, Tim <chengt@gmail.com> wrote:
> Is it possible to invoke a static method in the middle of the route without
> having to use a processor or other wrapper?
>
> Basically I have a simple static utility function that I want to invoke and
> use it's results as a header.
> Normally this would look like:
>
>        from(someInput)
>            .bean(someBean)
>            .setHeader("someheader",
> bean(willMakeHeaderInfoFromResultsOfSomeBean))
>            .filter().method(someFilter)
>            .bean(someOtherBean);
>
> The method in willMakeHeaderInfoFromResultsOfSomeBean is short and can come
> from a strategy enum which I want to use directly.
> Sorry I can't find anything in the docs that mentions this but is this
> possible directly from the route?
>



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

Mime
View raw message