Configuring Quartz2 apache Camel and Fuse



我有Camel 中的下一部分代码

<route id="ROUTE-WK-OPSWEBGUSOXUA" streamCache="true">
<from id="_from1" uri="{{opsweb.gusoxUA.timer.Endpoint}}?cron={{opsweb.gusoxUA.cron.timer}}&amp;stateful=true">
<description>Principal Route of wk-opswebGusoxUA</description>
</from>
<bean id="_bean1" method="queryOpsweb" ref="jdbcTemplateOpsweb">
<description>query pesobalance.soc_users_opsweb where user_state = 'A'</description>
</bean>
<doTry id="_doTry1">
<choice id="_choice1">
<when id="_when1">
<simple>${body} == '[]'</simple>
<log id="_log2" loggerRef="loggerRef"
loggingLevel="INFO" message="Result query dbo.sistemas empty => ${body} "/>
<!-- Lanzar una Excepcion -->
</when>
<otherwise id="_otherwise1">
<log id="_log3" loggerRef="loggerRef"
loggingLevel="INFO" message="Empieza Splitter "/>
<split id="_split1" stopOnException="false">
<simple>${body}</simple>
<process id="_process2" ref="csvTrasformationProcessor"/>
<log id="_log6" loggerRef="loggerRef"
loggingLevel="INFO" message="Register of ApplicationAfter => ${body}"/>
<marshal id="_marshall1" ref="dataModel"/>
<to id="_to2" uri="file:{{opsweb.gusoxUA.file.location}}?fileName=${date:now:yyyyMMdd}_opsweb.csv&amp;fileExist=Append"/>
</split>

但是quartz创建了10个线程并执行了10次,我只想执行1次。

当我在保险丝中部署它时,我看到下一个:

2020-04-21 14:58:50,081 | INFO  | xtenderThread-46 | ManagedManagementStrategy        | 172 - org.apache.camel.camel-core - 2.15.1.redhat-621084 | JMX is enabled                            
2020-04-21 14:58:50,112 | INFO  | xtenderThread-46 | QuartzComponent                  | 222 - org.apache.camel.camel-quartz2 - 2.15.1.redhat-621084 | Create and initializing scheduler.     
2020-04-21 14:58:50,113 | INFO  | xtenderThread-46 | QuartzComponent                  | 222 - org.apache.camel.camel-quartz2 - 2.15.1.redhat-621084 | Setting org.quartz.scheduler.jmx.export=true to ensure QuartzScheduler(s) will be enlisted in JMX.                                                                                                                                  
2020-04-21 14:58:50,114 | INFO  | xtenderThread-46 | StdSchedulerFactory              | 272 - org.quartz-scheduler.quartz - 2.2.1 | Using default implementation for ThreadExecutor
2020-04-21 14:58:50,114 | INFO  | xtenderThread-46 | SimpleThreadPool                 | 272 - org.quartz-scheduler.quartz - 2.2.1 | Job execution threads will use class loader of thread: SpringOsgiExtenderThread-46
2020-04-21 14:58:50,115 | INFO  | xtenderThread-46 | SchedulerSignalerImpl            | 272 - org.quartz-scheduler.quartz - 2.2.1 | Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2020-04-21 14:58:50,115 | INFO  | xtenderThread-46 | QuartzScheduler                  | 272 - org.quartz-scheduler.quartz - 2.2.1 | Quartz Scheduler v.2.2.1 created.
2020-04-21 14:58:50,115 | INFO  | xtenderThread-46 | RAMJobStore                      | 272 - org.quartz-scheduler.quartz - 2.2.1 | RAMJobStore initialized.
2020-04-21 14:58:50,116 | INFO  | xtenderThread-46 | QuartzScheduler                  | 272 - org.quartz-scheduler.quartz - 2.2.1 | Scheduler meta-data: Quartz Scheduler (v2.2.1) 'DefaultQuartzScheduler-com.avianca.datacenter.sal.WK-opswebGusoxUA' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

如何配置Quartz只执行一次而不是10次。

我认为这在新版本的camel中得到了修复。你可以尝试使用更新的版本。

如果只想执行一次,则repeatCount=1:更适合使用计时器

timer://timerName?repeatCount=1

如果是每XX秒一次,请使用石英:

每60秒。

quartz2://timerName?cron=0 0/1 * 1/1 * ? *

取决于{{opswab.gusoxUA.cron.timer}}的内容

最新更新