Hi Read this FAQ how to stop a running route http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
eg you need to spin off a new thread to do this, as that would be the cleanest way. On Thu, Jun 14, 2012 at 6:47 PM, gilboy <josephoto...@gmail.com> wrote: > Thanks again > > 1 final question on this. If an exception occurs in the run method of the > consumer, I want the endpoint, producer and consumer to be re-started. > > I was thinking of handling this as follows: > > class CustomConsumer extends DefaultConsumer implements Runnable{ > ...... > > public void run(){ > > try{ > > } catch (Exception exc){ > getCamelContext().stopRoute("routeName"); > getCamelContext().startRoute("routeName"); > } > > ..... > } > > However, from the documentation it says I need to call > getCamelContext().getInflightRepository().remove(Exchange) before calling > getCamext().stopRoute("routeName"). Unfortunately, in the consumer I do not > have access to the Exchange object, i.e. I can only create a new Exchange > object. Any suggestions? > > My custom component is a singleton and its referenced in different routes > > Thanks > Joe > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-Component-Consumer-Threading-Question-tp5714233p5714489.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen