On Sat, Jun 20, 2009 at 12:49 AM, sriramch <
sriram@...> wrote:
>
> I am trying to route to a bean instance by specifying a method-name using
> Camel 1.6. This specific route is defined as below:
>
> <camel:bean ref="myBean" method="myMethod"/>
>
> The method myMethod is overloaded
>
> public void myMethod(){
> }
>
> public void myMethod(Date date){
> }
>
> Depending on how I order my methods in the class, either of these seem to
> be
> getting picked up by the BeanProcessor. Is there any way I can force it to
> use the method without any arguments? If this is not possible, what is a
> good way to always pass null as the date parameter to the myMethod
> invocation? Any pointers would be very helpful.
Hi
As there are 2 methods with the same name, you need to help Camel pick the
one.
You can add the @Body annotation to the one you want to invoke and Camel
will prefer this one.
But that would require you to define at least 1 parameter for the method.
public void myMethod(@Body Object body)
Otherwise you can always add a little delegate method that has a unique
name.
In Camel 2.0 we have added a @Handler annotation to the method itself as a
kind of "use this method please".
--
Claus Ibsen
Apache Camel Committer
Open Source Integration:
http://fusesource.comBlog:
http://davsclaus.blogspot.com/Twitter:
http://twitter.com/davsclaus