Hi Willem,
I have defined one quartz2 endpoint route and one sub route in
camel-context.xml file . Whenever the quartz scheduler triggers , the quartz
end point will call the sub route using direct component. I am printing some
text in console using bean processor(QueryBuilderProcessor) which is defined
in sub route.
<bean id="QueryBuilderProcessor"
class="cluster.quartz.QueryBuilderProcessor" />
<route id="quartz" trace="true">
<from
uri="quartz2://cluster/quartz?cron=0+0/4+++*+?&durableJob=true&stateful=true&recoverableJob=true">
<to uri="direct:queryProcessor" />//calling sub rout
here.
...
</route>
<route id="queryProcessor" startupOrder="1">
<from uri="direct:queryProcessor" />
<to uri="bean:QueryBuilderProcessor" />
</route>
My cluster configuration:
I have followed below Link to set up Clustering with the JDBC-Jobstore.
http://www.quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering
I have quartz.properties file in resource folder like
org/quartz/quartz.properties.
org.quartz.scheduler.instanceName = ClusteredScheduler
org.quartz.scheduler.instanceId = AUTO
org.quartz.jobStore.isClustered = true
...
org.quartz.plugin.triggerHistory.class=org.quartz.plugins.history.LoggingTriggerHistoryPlugin
org.quartz.plugin.triggerHistory.triggerFiredMessage=Trigger [{1}.{0}] fired
job [{6}.{5}] scheduled at: {2, date, dd-MM-yyyy HH:mm:ss.SSS}, next
scheduled at: {3, date, dd-MM-yyyy HH:mm:ss.SSS}
org.quartz.plugin.triggerHistory.triggerCompleteMessage=Trigger [{1}.{0}]
completed firing job [{6}.{5}] with resulting trigger instruction code: {9}.
Next scheduled at: {3, date, dd-MM-yyyy HH:mm:ss.SSS}
org.quartz.plugin.triggerHistory.triggerMisfiredMessage=Trigger [{1}.{0}]
misfired job [{6}.{5}]. Should have fired at: {3, date, dd-MM-yyyy
HH:mm:ss.SSS}
org.quartz.plugin.jobHistory.class=org.quartz.plugins.history.LoggingJobHistoryPlugin
org.quartz.plugin.jobHistory.jobToBeFiredMessage=Job [{1}.{0}] to be fired
by trigger [{4}.{3}], re-fire: {7}
org.quartz.plugin.jobHistory.jobSuccessMessage=Job [{1}.{0}] execution
complete and reports: {8}
org.quartz.plugin.jobHistory.jobFailedMessage=Job [{1}.{0}] execution failed
with exception: {8}
org.quartz.plugin.jobHistory.jobWasVetoedMessage=Job [{1}.{0}] was vetoed.
It was to be fired by trigger [{4}.{3}] at: {2, date, dd-MM-yyyy
HH:mm:ss.SSS}
QueryBuilderProcessor.java
public void process(Exchange exchange) throws Exception {
LOGGER.info("Started");
System.out.println(****processor started******");
Thread.sleep(10000);
System.out.println(****processor Ends******);
}
Test case:
I am running the same camel application as standalone using
org.apache.camel.spring.Main class in two eclipse instance in same machine,
So by default clock is sync.
Two Node:
1. Eclipse Instance 1:(Node1) First I am starting application from eclipse
instance 1 , based on quartz properties file Quartz tables are populated
with the job details.
2.Eclipse Instance 2:(Node2) I am starting same application from eclipse
instance 2.
Both instance are started and could see their scheduler entries (Node1 &
Node2) in qrtz_scheduler_state table.
Stopping Job:
Constantly I watching the TRIGGER_STATE column of job in *qrtz_triggers*
table & console for two camel application.
step1 : Initially Trigger state will be "WAITING"
stept2: Once the Trigger state changed to "AQUIRED" , I go back to console
find the which node picked the job.
step3: Assume ****processor started******" printed from
QueryBuilderProcessor.java(Node1) and Immediately terminate the Node1 by
clicking terminate button in eclipse.
step4: Now current TRIGGER state is "BLOCKED".
step5: I could see the recovery logs in Node2 console.(Which is mentioned in
the above question).
*My doubt is , if you see the Recovering job trigger details in
*qrtz_triggers* table above question, TRIGGER_TYPE is SIMPLE, but we defined
in our route is CRON type*.
Please refer the section "*Captured in qrtz_triggers table*" in above
question.
I think the problem is CRON type, Recovery Job Tigger type should be CRON
right?
Thanks,
--
View this message in context:
http://camel.465427.n5.nabble.com/Quartz-clustering-in-camel-spring-DSL-JIRA-CAMEL-8076-tp5759589p5759614.html
Sent from the Camel - Users mailing list archive at Nabble.com.