Camel - Quartz2

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Camel - Quartz2

dpravin
Hello,

I am using quartz2 component to schedule a route that consumes messages from AMQ queue using consumer template.

The requirement is to schedule this route every 5 minutes, however if for some reason the server is down during the scheduled time, the job should run as soon as it is up.

I have tried following options, however it not working as intended.

Option 1-
<from uri="quartz2://MyGroup/myReportTimer?cron=0+0/5+*+*+*+?&amp;stateful=true&amp;recoverableJob=true" />

The configuration works by manually stopping the route before scheduled time and then starting the route after scheduled time. The quartz component triggers the route.

If I stop the container before the scheduled time and start the container, the route runs at the next scheduled time.


Options 2-
<from uri="quartz2://MyGroup/myReportTimer?cron=0+0/5+*+*+*+?&amp;deleteJob=false&amp;durableJob=true&amp;stateful=true&amp;recoverableJob=true" />

The scenario in option1 works as expected. However if I shutdown the server before the scheduled time and restart I get following errors,

Error occurred during starting Camel: CamelContext(aggregateCC) due Failed to create route consumerRoute: Route(consumerRoute)[[From[quartz2://MyGroup/aggregateRepor... because of Failed to resolve endpoint: quartz2://MyGroup/myReportTimer?cron=0+0%2F5+*+*+*+%3F&durableJob=true&recoverableJob=true&stateful=true due to: Unable to store Job : 'MyGroup.myReportTimer', because one already exists with this identification.
org.apache.camel.FailedToCreateRouteException: Failed to create route consumerRoute: Route(consumerRoute)[[From[quartz2://MyGroup/myRepor... because of Failed to resolve endpoint: quartz2://MyGroup/myReportTimer?cron=0+0/5+*+*+*+?&deleteJob=false&durableJob=true&stateful=true&recoverableJob=true due to: Unable to store Job : 'MyGroup.myReportTimer', because one already exists with this identification.
        at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:190)[198:org.apache.camel.camel-core:2.15.1.redhat-620133]

I am not able to understand why the component is trying to insert a record for the job again if it exists. I expected it to do this check and since I have marked it as recoverable and stateful the route should run at scheduled time(if the server is up) or after scheduled time when the server/container is up.

Server version - Jboss Fuse 6.2
Camel version - 2.15.1.redhat-620133

Appreciate if anyone could help resolve this issue.

Thanks,
D
- Pravin