I need to dynamically set the quartz cron expression during runtime in my camel route. How can this be achieved?
Sample code for current implementation below:
<camel:route id="splitFileRoute">
<camel:from uri="file:{{file.input.dir}}?
preMove={{file.inprogress.dir}}&
move={{file.processed.dir}}&
scheduler=quartz2&
scheduler.cron={{file.split.cron.expression}}&
filter=#fileFilter" />
<camel:split streaming="true">
<camel:tokenize token="\n" group="{{file.split.size}}"/>
<camel:setHeader headerName="channel">
<camel:simple>{{so.filewrite.channel}}</camel:simple>
</camel:setHeader>
<camel:bean ref="fileProcessor" id="spiltFile" method="spiltFile" />
<camel:removeHeaders pattern="CamelFile*"></camel:removeHeaders>
<camel:setHeader headerName="CamelFileName">
<camel:simple>${header.fileName}</camel:simple>
</camel:setHeader>
<toD uri="file:${in.header.filePath}?
doneFileName=${file:name.noext}.eot&
fileExist=Append" />
</camel:split>
<camel:bean ref="fileProcessor" id="resetIndex" method="resetIndex" />
</camel:route>
In the above code, file.split.cron.expression=0+10+0+?+++* is defined in the properties file. Currently it is set to a predefined value, which is set during application startup. What I need to do is to dynamically set this value during runtime.
I need to set the value for cron expression in camel route, with respect to the input from an API call. By setting the value dynamically, I was pointing to this aspect.