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
