On Thu, Mar 5, 2009 at 9:40 AM, ee7arh <andrew.hu...@2e-systems.com> wrote: > > Thanks for the feedback, > > It looks like we are talking about the same use case. In my example, all my > methods had the same name, but each method had a different parameter > (Object1, 2 and 3). Each of these parameter types inheritted from "Objectn". > So each method did have a different concrete sub-type although all are > instances of Objectn. In your example, your 3rd method has a different > name... was that a typo? Yeah probably. > > I could certainly use different method names, it would just mean I have to > have some more logic in my RouteBuilder. At the moment, I just send objects > off the queue to the same bean method and ask it to take care of selecting > the correct one by overloading. You can send it to an indirect method that will check the type and invoke the correct method of the 3. Then you route can stay simple.
> > Thanks and Regards > Andrew > > > ee7arh wrote: >> >> Hi, >> >> I have a bean defined which has 3 methods all with same name but with >> different arguements. I would like to route messages from a queue to this >> bean and depending on the object type I was hoping that the correct method >> would get called by overloading. >> >> Instead i get the error: >> >> org.apache.camel.NoTypeConversionAvailableException: No type converter >> available to convert from type:..... >> >> I noticed that the first method defined in my bean caused this error so it >> looks like Camel takes the 1st method and tries (and fails) to convert the >> message. >> >> here is my bean definition: >> >> @Service(value = "serviceEventGenerator") >> public class ServiceEventGenerator { >> >> public ArrayList<ServiceEvent> generateServiceEvents(Object1 event) {} >> >> public ArrayList<ServiceEvent> generateServiceEvents(Object2 event) {} >> >> public ArrayList<ServiceEvent> generateServiceEvents(Object3 event) {} >> >> } >> >> (Incidentally in my example, Object 1,2 and 3 all extend from a parent >> class "Objectn".) >> >> And my route: >> >> from("jms:queue:unmarshalledEventsQueue") >> .to("log:unmarshalledEventLogger?level=INFO") >> >> .to("bean:serviceEventGenerator?methodName=generateServiceEvents") >> >> Thanks in advance for any help >> >> Andrew >> > > -- > View this message in context: > http://www.nabble.com/Is-it-possible-to-overload-a-bean-method--tp22338316p22347357.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/