Apache Camel-Quartz集成

IAm*_*aja 3 java integration scheduling apache-camel quartz-scheduler

我正在尝试使用camel-quartzCamel组件在我们的应用程序服务器上安排作业(这项技术选择是最终的,并且高于我的薪水级别),而Apache提供的唯一文档(此处)是微不足道的,并且是超紧凑的,没有任何真正有用的示例对于骆驼/石英新手.

在我深入了解我的具体工作需求之前,我试图了解这里的大局.文档说明 - 通过Camel - Quartz定时器被设置为端点.所以我假设(请纠正我,如果我错了)这意味着您编写要运行的作业及其配置/属性文件,然后将Quartz计时器设置为Camel端点; 然后,当这些工作运行时,它们会以某种方式通过Camel与其他端点进行通信(?).

那么使用camel-quartz而不仅仅是Quartz(它允许你的工作与其他端点通信)的唯一好处是什么?

Quartz可以配置一个quartz.properties文件,并需要其他配置,以便可以初始化Scheduler.camel-quartz照顾这对你?我想专注于编写工作,但不确定需要什么样的最小XML或属性配置.

提前感谢任何能够帮助澄清这一camel-quartz开发过程的人.

Sun*_*eri 6

设置石英终点很容易,下面的石英作业每天凌晨1点触发FileProcessor.process():

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <package>com.test.app</package>
    <template id="camelTemplate"/>
    <route>
        <from uri="quartz://fileProcessorJob?cron=0+0+1+*+*+?"/>
        <to uri="bean:fileProcessor?method=process"/>
    </route>
</camelContext>
Run Code Online (Sandbox Code Playgroud)

默认情况下,Quartz在类路径中查找quartz.properties,您还可以在xml中提供配置详细信息,如下所示:

<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
    <property name="propertiesFile" value="com/test/app/myquartz.properties"/>
</bean>
Run Code Online (Sandbox Code Playgroud)