Thankx Souciance. I guess I was a bit optimistic in my thinking that this might 
already be available out-of-the-box in Camel :)

I will go with the first solution you mentioned, although I think that a 
RoutePolicy is more suitable for my needs, compared to having a separate route 
to manage the other routes.

Although, I'm still not sure how I force a route to become suspended first 
thing on initiation, programatically. I tried calling suspendRoute(route) from 
within the onInit method in my subclass to RoutePolicySupport, but that did 
nothing. The route still started, and consumed files.

So, can you, or someone else, tell me how I can programatically (ie in java 
code) make sure that a specific route is suspended right from the start of the 
camel context?

/Jimi

-----Original Message-----
From: souciance [mailto:souciance.eqdam.ras...@gmail.com] 
Sent: Thursday, June 16, 2016 1:19 PM
To: users@camel.apache.org
Subject: Re: Only trigger route if condition is fulfilled?

I think if you want to have that kind of fine tuning of the route stop/start 
mechanism it is better to have that control outside of the route. That is, 
control the route stop/start from another route, that way you can start/stop it 
based on some condition. Doing it this way doesn't require Camel to be 
restarted.

As for file not getting deleted, I am not sure if the available parameters 
allow you to poll a specific file and also not delete it if delete is enabled. 
I guess one way is to write the file back to the same folder.
Another way would be to split this in two routes. One route that polls that 
folder for that specific file but the delete parameter is disabled. The second 
route polls the same folder but has an exclusionFilter for that file but has 
delete enabled.

On Thu, Jun 16, 2016 at 12:58 PM, jimi.hullegard [via Camel] <
ml-node+s465427n5784115...@n5.nabble.com> wrote:

> 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:[hidden email] 
> <http:///user/SendEmail.jtp?type=node&node=5784115&i=0>]
> Sent: Thursday, June 16, 2016 12:41 PM
> To: [hidden email] 
> <http:///user/SendEmail.jtp?type=node&node=5784115&i=1>
> 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] < [hidden 
> email] <http:///user/SendEmail.jtp?type=node&node=5784115&i=2>>
> 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 [hidden email] 
> > <http:///user/SendEmail.jtp?type=node&node=5784115&i=3>
> > To unsubscribe from Camel - Users, click here 
> > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=un
> > su 
> > bscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWF
> > pb
> > C5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > .
> > NAML
> > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=ma
> > cr 
> > o_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.name
> > sp 
> > aces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.
> > vi 
> > ew.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabbl
> > e%
> > 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-f
> ulfilled-tp5784112p5784113.html Sent from the Camel - Users mailing 
> list archive at Nabble.com.
>
>
> ------------------------------
> 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-tp5784112p5784115.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=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-tp5784112p5784117.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to