I'm trying to use the camel-quartz
Camel component to schedule jobs on our application server (this technology selection is final and is above my paygrade), and the only documentation Apache provides (here) is de minimis and is ultra compacted 开发者_开发问答without any real helpful examples for camel/quartz newbies.
I'm trying to understand the big picture here, before I can drill down into my specific jobs' needs. The documentation states that - via Camel - Quartz timers are set up as endpoints. So I'm assuming (please correct me if I'm wrong) that this means that you code up jobs to be ran, along with their config/properties files, and then set up a Quartz timer as a Camel endpoint; then when those jobs get ran, they somehow can communicate over Camel to other endpoints (?).
So is that the only benefit to using camel-quartz
instead of just Quartz (that it allows your jobs to communicate with other endpoints)?
Quartz can be configured with a quartz.properties
file, and requires other configuration to so that a Scheduler can be initialized. Does camel-quartz
take care of this for you? I'd like to just concentrate on writing the job, but not sure what sort of minimal XML or properties configurations are necessary.
Thanks in advance to anyone who can help clarify this camel-quartz
development process a little better.
Setting up a quartz end point is easy, the below quartz job triggers FileProcessor.process() at 1AM every day:
<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>
By default Quartz looks for quartz.properties in the class path, you can also provide the configuration details in the xml as shown below:
<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
<property name="propertiesFile" value="com/test/app/myquartz.properties"/>
</bean>
Have you already seen the camel-quartz documentation on the camel website? http://camel.apache.org/quartz.html
It is not very detailed but should get you started. The quartz.properties is searched at the base of the class path. You can also specify another file or use custom Properties. See the "Configuring quartz.properties file" section.
Camel-quartz has the simple purpose of triggering a camel route. So you can use all the other camel components to implement your requirements. If your job is about integration then camel-quartz is a good choice. If your job mainly calls internal APIs of your app then the normal quartz should be good enough.
精彩评论