What claus said. Also, you have to use a concurrentConsumers option on a FROM uri to consume with multiple instances of the same route from an endpoint.
*Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 <http://www.linkedin.com/pub/robert-simmons/40/852/a39>* On Fri, Feb 7, 2014 at 1:48 AM, Claus Ibsen <[email protected]> wrote: > When you add the 2nd route, 3rd route etc, then use a unique name, eg > test2, test3 etc. The direct component only allow one active consumer. > > > On Fri, Feb 7, 2014 at 8:17 AM, trilochan237 > <[email protected]> wrote: > > Hi, > > We have a requirement where in we have to add the routes at the runtime > to > > camel-context which is already running. > > > > The following piece of code works for the first time, but when i execute > it > > for the second time it causing mulitple consumer error. > > > > code: > > public void addroutestocontext(CamelContext camelContext){ > > String Rqendpoint=direct:test1; > > String Rsendpoint=direct:test2; > > MessageRouter router=new MessageRouter(); > > router.setRqendpoint(Rqendpoint); > > router.setRsendpoint(Rsendpoint); > > *camelContext.addRoutes(router);* > > -------------------- > > -------------------- > > producer.asyncRequestBodyAndHeaders(,Rqendpointbody, headers); > > > > ....... > > ..... > > } > > > > Issue:Cannot add a 2nd consumer to the same endpoint. Endpoint > > Endpoint[direct://test1] only allows one consumer > > > > > > Please provide me a solution. > > Thanks a lot. > > > > > > > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/Adding-Routes-at-the-runtime-cannot-add-multiple-consumer-to-the-same-endpoint-tp5746918.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: [email protected] > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > Make your Camel applications look hawt, try: http://hawt.io >
