I can't read the format of the code but as Quinn pointed out you can use the control bus but I have to ask what is the purpose/reason for shutting the route down? Are you just running the batch once or are you re-enabling it at some other time?
Just from what I can see this looks like it is going to pull the file every 60 seconds regardless of whether you've previously processed it or not and the only difference is you won't process it a second time. But it appears that you'll continually re-read that file. Unfortunately I'm more familiar with Blueprint XML and not the route builder semantics. If I understand the issue I it seems you want to get a file and the disable the route/smb so it doesn't re-read the same file? from("smb://"+ inputXrtSmbDomain +";"+ inputXrtSmbUser +"@"+ inputXrtSmbServer +"/"+ inputXrtSmbFolder +"?password="+ inputXrtSmbPassword + "&delete=false&delay=60000") If I'm reading this correctly then every 60 seconds this is going to fire up and read whatever files are in that directory and not delete when it has finished processing. I've never used the JCIFS endpoint so may be off base there. That isn't an initialDelay and a better name for the flag would have been something like "period" or "poll". It is going to go off every 60 seconds. Is your file getting moved to a .camel directory when it is finished processing? If you just want to make sure it doesn't process files that have already been processed then use the idempotent flag. Then this route will poll every 60 seconds and pick up whatever new files it finds but ignore processing anything that it has already seen. Without knowing the exact business problem at hand it's hard to be definitive. On Fri, Jun 3, 2016 at 10:13 AM, Quinn Stevenson < qu...@pronoia-solutions.com> wrote: > You could use the control bus to stop the route ( > http://camel.apache.org/controlbus.html < > http://camel.apache.org/controlbus.html> ) > > > On Jun 2, 2016, at 5:06 AM, Daniel Pompa <pompadan...@gmail.com> wrote: > > > > If you see, I have a do-while monitoring the value of the var > > CamelBatchComplete, then when is true, stop and remove the route from > Camel > > Context. I don't like this. > > > > My question is, there a better way to stop and remove the route when the > > Batch finish? Using the RouteBuilder for example. > > > > Thanks. > > > > > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/How-to-stop-a-dynamic-route-tp5783385p5783389.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > >