Hi Souciance,

If I stop the route, how do I start it later? I want it to run again later if 
the stop-file is removed. I might just want to stop it for a few minutes, or I 
want to stop it "indefinitely" (like, months). Either way, I don't want to have 
to change the config and restart Camel for the change to have effect.

Basically, I want the equivalence of a "stop/pause" and "start/continue" button 
for a singular route, but to be able to do it at a terminal. And I want the 
current state (ie running or paused) to remain unchanged even if Camel itself 
is restarted. In my mind, using a stop-file on disk to indicate this would be a 
perfectly simple solution to this.

And regarding your suggestions, how would they make sure that the payload file 
remains on disk, even when the file component (the entry point of the route) 
has delete=true set?

/Jimi

-----Original Message-----
From: souciance [mailto:[email protected]] 
Sent: Thursday, June 16, 2016 12:41 PM
To: [email protected]
Subject: Re: Only trigger route if condition is fulfilled?

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] <
[email protected]> 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-f
> ulfilled-tp5784112.html To start a new topic under Camel - Users, 
> email
> [email protected]
> To unsubscribe from Camel - Users, click here 
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsu
> bscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpb
> C5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macr
> o_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namesp
> aces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.vi
> ew.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%
> 3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%2
> 1nabble%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.

Reply via email to