On Tue, Jul 14, 2009 at 11:03 AM, James Strachan<[email protected]> wrote: > How is Camel meant to decide which method you want; if they are both > annotated and both have the same name? >
Yeah @Handler should only be added at one of them. If the number of parameters differ we could add another option to bean component to give a hint that X parameters is expected in these rare cases where people have overloaded methods. > 2009/7/14 Charles Moulliard <[email protected]>: >> Even If I add the annotation @Handler on the two methods with the same name, >> the error is generated >> >> Exception: org.apache.camel.component.bean.AmbiguousMethodCallException: >> Ambiguous method invocations possible: [public java.util.List >> com.xpectis.x3s.core.util.ServiceHelper.updateRequestStatus(java.lang.String,java.lang.String,java.util.List), >> public void >> com.xpectis.x3s.core.util.ServiceHelper.updateRequestStatus(java.lang.String,java.lang.String,java.lang.String,org.apache.camel.Exchange)] >> >> Charles Moulliard >> Senior Enterprise Architect >> Apache Camel Committer >> >> ***************************** >> blog : http://cmoulliard.blogspot.com >> >> >> On Tue, Jul 14, 2009 at 10:27 AM, Claus Ibsen <[email protected]> wrote: >> >>> On Tue, Jul 14, 2009 at 10:25 AM, Charles Moulliard<[email protected]> >>> wrote: >>> > Hi, >>> > >>> > Is there any other workaround except renaming the method "updatStatus" to >>> > avoid to have an error : AmbiguousMethodCallException. >>> > >>> > In my example, I would like to allow to have two methods with the same >>> name >>> > but having different input parameters and return type >>> > >>> > Here is the route that I want to use : >>> > >>> > from(file) >>> > .to(beanA) // Create Request >>> > .to(beanB) // parse request >>> > .to(queueA) >>> > >>> > from(queueA) >>> > .to(beanC) // validate request >>> > .to(beanD method="updateStatus") // update Status (input parameter : Body >>> = >>> > Request.class, return type = void) >>> > .to(queueB) >>> > >>> > ... >>> > >>> > from(queueX) >>> > .to(beanX) >>> > .to(beanD method="updateStatus") // update Status (input parameter : Body >>> = >>> > Report.class, Header "requestId" String request ID, return type = void) >>> > >>> > Is it possible ? >>> > >>> >>> Add @Handle to the method you want Camel to choose. >>> >>> >>> > Regards, >>> > >>> > Charles Moulliard >>> > Senior Enterprise Architect >>> > Apache Camel Committer >>> > >>> > ***************************** >>> > blog : http://cmoulliard.blogspot.com >>> > >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >> > > > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://fusesource.com/ > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
