Hi, Depends, if you want to stop the route completely maybe use the controlbus component to send a stop action.
If you use the java dsl, after your condition == true you can add something like this: .to("controlbus:route?routeId=<yourRouteId>&action=stop") If you just want to stop the route from proceeding or stop consuming, use the stop statement .stop() in the java dsl or set the exchange property exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE); Best Souciance On Thu, Jun 16, 2016 at 12:28 PM, jimi.hullegard [via Camel] < ml-node+s465427n5784112...@n5.nabble.com> wrote: > Hi, > > I would like an easy way to stop a route from processing any more > messages, by defining some boolean condition so that the route should run > only if the condition is true. > > The condition doesn't have to be connected in any way with the payload. > Instead it could involve performing a http GET and only proceeding if the > result is a "200 OK", or check that some file exist, or doesn't exist, in > some folder somewhere. It is that last part I need in my project. I would > like to be able to stop a route by simply placing a file "camel.stop" or > similar in some folder. > > Adding this logic in a custom processor class doesn't help, because the > route in question starts with a File component that has delete=true, and if > the file "camel.stop" is present then I don't want any files deleted. > > What would you say is the best way to achieve this? > > Regards > /Jimi > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://camel.465427.n5.nabble.com/Only-trigger-route-if-condition-is-fulfilled-tp5784112.html > To start a new topic under Camel - Users, email > ml-node+s465427n465428...@n5.nabble.com > To unsubscribe from Camel - Users, click here > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=> > . > NAML > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://camel.465427.n5.nabble.com/Only-trigger-route-if-condition-is-fulfilled-tp5784112p5784113.html Sent from the Camel - Users mailing list archive at Nabble.com.