java - Camel File: Stop route when all files are processed -


i have camel route

<routes xmlns="http://camel.apache.org/schema/spring">    <route startuporder="1">     <from uri="file:d:\work\eclipse_workspace\dataengine_git_2\src\data" />       <unmarshal>         <csv delimiter="|" quotedisabled="true" />     </unmarshal>     <to uri="bean:csvprocessor?method=processnew" /> </route>  </routes> 

it continuously polls directory.

i want stop polling if job triggered once.

if files processed route should stop

how can ??

i tried below

<from uri="timer:foo?repeatcount=1" />             <pollenrich>                 <constant>file:d:\work\eclipse_workspace\dataengine_git_2\src\data</constant>             </pollenrich> 

but still polls continuously

note: using spring camel.

you can subscribe oncompletion callback (which invoked when exchange complete). , can stop route using control bus eip.

example:

<route startuporder="1" id="myroute">     <from uri="file:d:\work\eclipse_workspace\dataengine_git_2\src\data" />     <oncompletion>         <to uri="controlbus:route?routeid=myroute&amp;action=stop"/>     </oncompletion>     <unmarshal>         <csv delimiter="|" quotedisabled="true" />     </unmarshal>     <to uri="bean:csvprocessor?method=processnew" /> </route> 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -