如何在camel中的运行时动态设置quartz cron表达式?
我需要在运行时在驼峰路由中动态设置quartz cron表达式。如何做到这一点 当前实现的示例代码如下:如何在camel中的运行时动态设置quartz cron表达式?,cron,apache-camel,quartz,Cron,Apache Camel,Quartz,我需要在运行时在驼峰路由中动态设置quartz cron表达式。如何做到这一点 当前实现的示例代码如下: <camel:route id="splitFileRoute"> <camel:from uri="file:{{file.input.dir}}? preMove={{file.inprogress.dir}}& move={{file.processed.dir}}&
<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>
{{so.filewrite.channel}
${header.fileName}
在上述代码中,
file.split.cron.expression=0+10+0++++*
在属性文件中定义。当前,它被设置为预定义值,该值在应用程序启动期间设置。我需要做的是在运行时动态设置这个值
我需要在camel路由中设置cron表达式的值,该值与来自API调用的输入有关。通过动态设置该值,我指向了这一方面。您可以使用
cronScheduledOutPolicy
,触发路由触发:
CronScheduledRoutePolicy startPolicy = new CronScheduledRoutePolicy();
startPolicy.setRouteStartTime( this.getDynamicExpression() );
from("...")
.routePolicy(startPolicy)
.noAutoStartup()
.to("...");
更多信息,请访问:
我需要设置驼峰路由中cron表达式的值,该值与来自API调用的输入有关。通过动态设置值,我指向了这个方面。没有在前面的问题中添加此细节。