[ 
https://issues.apache.org/jira/browse/CAMEL-7215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13903390#comment-13903390
 ] 

David Keen commented on CAMEL-7215:
-----------------------------------

Pull request to unschedule jobs: https://github.com/apache/camel/pull/98

> Stop and un-schedule jobs on removal of route
> ---------------------------------------------
>
>                 Key: CAMEL-7215
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7215
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-quartz, camel-quartz2
>    Affects Versions: 2.12.2
>         Environment: Using job-store 'org.quartz.simpl.RAMJobStore'
>            Reporter: David Keen
>
> When using SimpleScheduledRoutePolicy, jobs are not deleted when a route is 
> removed.
> I got the following exception when removing a route and re-adding it to a 
> running context.
> {code}
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------
> org.apache.camel.FailedToCreateRouteException: Failed to create route foo: 
> Route(foo)[[From[quartz... because of 
> org.quartz.ObjectAlreadyExistsException: Unable to store Job : 
> 'jobGroup-foo.job-STOP-foo', because one already exists with this 
> identification.
>         at 
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:182) 
> ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:770)
>  ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1914)
>  ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:707)
>  ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337) 
> ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:264)
>  ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:669)
>  ~[camel-core-2.12.2.jar:2.12.2]
> ...
> Caused by: org.apache.camel.RuntimeCamelException: 
> org.quartz.ObjectAlreadyExistsException: Unable to store Job : 
> 'jobGroup-foo.job-STOP-foo', because one already exists with this 
> identification.
>         at 
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1352)
>  ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.routepolicy.quartz2.SimpleScheduledRoutePolicy.onInit(SimpleScheduledRoutePolicy.java:48)
>  ~[camel-quartz2-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.impl.DefaultRouteContext.commit(DefaultRouteContext.java:202)
>  ~[camel-core-2.12.2.jar:2.12.2]
>         at 
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:916) 
> ~[camel-core-2.12.2.jar:2.12.2]
> ...
> Caused by: org.quartz.ObjectAlreadyExistsException: Unable to store Job : 
> 'jobGroup-foo.job-STOP-foo', because one already exists with this 
> identification.
>         at org.quartz.simpl.RAMJobStore.storeJob(RAMJobStore.java:279) 
> ~[quartz-2.2.1.jar:na]
>         at 
> org.quartz.simpl.RAMJobStore.storeJobAndTrigger(RAMJobStore.java:251) 
> ~[quartz-2.2.1.jar:na]
>         at 
> org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:886) 
> ~[quartz-2.2.1.jar:na]
>         at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249) 
> ~[quartz-2.2.1.jar:na]
>         at 
> org.apache.camel.routepolicy.quartz2.ScheduledRoutePolicy.scheduleRoute(ScheduledRoutePolicy.java:116)
>  ~[camel-quartz2-2.12.2.jar:2.12.2]
> {code}
> The SimpleScheduledRoutePolicy should remove the scheduled jobs on route 
> removal. This is what CronScheduledRoutePolicy does.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to