Just to see if this is doing what you really want it to, put a lot statement right after the SMB read. I'm having difficulties reading the code due to the formatting issues in email and not being entirely sure of your goals here. I can say that I don't recall the last time I had to use Thread.sleep in routes to control behavior. I'd say that is a code smell indicating that there is probably another EIP you are missing out on or that there are flags on the endpoint that you can use like idempotent or delay or initial delay. Without fully understanding the context of your problem space I'd just say, for example,that I suspect what you're after might be attainable simply by something like the following (without look up I may have the exact syntax wrong.) Which should look for a new file every 60 seconds, process it, not delete but not re-process a file it has already seen. So you don't have to disable the processing route as you simply won't get the file more than the first time it is seen. But I'm not sure if that's what you are trying to attain here or not.
"&delay=60000&noop=true") http://people.apache.org/~dkulp/camel/file2.html idempotent false Option to use the Idempotent Consumer <http://people.apache.org/%7Edkulp/camel/idempotent-consumer.html> EIP pattern to let Camel skip already processed files. Will by default use a memory based LRUCache that holds 1000 entries. If noop=true then idempotent will be enabled as well to avoid consuming the same files over and over again. On Fri, Jun 3, 2016 at 10:55 AM, Daniel P22 <pompadan...@gmail.com> wrote: > Ranx explain to you, I have a route A, in that route you are going to put a > file with aaaaammdd date format. > > Then Im going to create a dinamic route in the Camel Context using that > date, this route is what you see in the example, I just wanna from the smb > endpoint the files according that date. > > When finish the batch, stop and remove the route. I just wanna execute > once. > > I use delay=60000 because I want this code to run. > > *The Stop Code * > > > if(context.getRouteStatus("sap-xrt-connect-interface-receive-" + > fileNameOnly).isStarted()){ // Se verifica si se inicio la ruta > > int CamelBatchValidator = 0; > do{ > > Thread.sleep(10000); // Se realiza la verificacion cada 10 > segundos si la interfaz culmino su procesamiento > > if (CamelBatchComplete=="true"){ > > Thread.sleep(20000); // Tiempo adicional para verificar > que > todo ha culminado > > context.stopRoute("sap-xrt-connect-interface-receive-" + > fileNameOnly); > > Thread.sleep(10000); > > context.removeRoute("sap-xrt-connect-interface-receive-" + > fileNameOnly); > > CamelBatchValidator=1; > CamelBatchComplete = null; > }else{ > > //Si la ruta esta vacia o hay error al conectar , esto hara > que entre en el IF de arriba y elimine la ruta > if(CamelBatchComplete == null){ > > CamelBatchComplete="true"; > } > > } > > > }while(CamelBatchValidator==0); > > > Thanks > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-to-stop-a-dynamic-route-tp5783385p5783460.html > Sent from the Camel - Users mailing list archive at Nabble.com. >