Я настроил конечную точку следующим образом:
from("quartz://GroupName/TimerName?stateful=true&cron=0 0/1 * * * ?")
.to("someProcessorBean");
Чтобы убедиться, что нет статических конечных точек, я делаю:
for (Endpoint endpoint : camelContext.getEndpoints()) {
camelContext.removeEndpoint(endpoint);
}
При попытке программного удаления маршрута я делаю следующее:
camelContext.stop();
camelContext.removeRoute(routeId);
Однако здесь не возвращаются конечные точки.
Даже после этого задание продолжает выполняться по расписанию. Как я могу отменить планирование при удалении маршрута?
Я использую верблюжий кварц 2.22.2 с кварцем 1.8.6
Вот журналы от выключения и затем запуска контекста.
Закрытие конечной точки
12:22:13,008 DEBUG [DefaultManagementAgent] Unregistered MBean with ObjectName: org.apache.camel:context=CamelContext-MyContext_6.1.1-SNAPSHOT,type=endpoints,name="quartz://MY_GROUP/MY_NAME\?cron=0+0%2F1+\*+\*+\*+%3F&stateful=true"
12:22:13,008 INFO [SpringCamelContext] Apache Camel 2.22.2 (CamelContext: CamelContext-MyContext_6.1.1-SNAPSHOT) is shutting down
12:22:13,008 INFO [DefaultShutdownStrategy] Starting to graceful shutdown 1 routes (timeout 300 seconds)
Маршрут остановки
12:22:13,033 INFO [DefaultShutdownStrategy] Starting to graceful shutdown 1 routes (timeout 300 seconds)
12:22:13,033 DEBUG [DefaultExecutorServiceManager] Created new ThreadPool for source: org.apache.camel.impl.DefaultShutdownStrategy@3a44287c with name: ShutdownTask. -> org.apache.camel.util.concurrent.RejectableThreadPoolExecutor@3fc7873f[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0][ShutdownTask]
12:22:13,034 DEBUG [DefaultShutdownStrategy] There are 1 routes to shutdown
12:22:13,034 INFO [DefaultShutdownStrategy] Graceful shutdown of 1 routes completed in 0 seconds
12:22:13,034 INFO [SpringCamelContext] Route: MY_CATEGORY.MY_NAME is stopped, was consuming from: quartz://MY_GROUP/MY_NAME?cron=0+0%2F1+*+*+*+%3F&stateful=true
12:22:13,034 DEBUG [RouteService] Shutting down services on route: MY_CATEGORY.MY_NAME
12:22:13,034 DEBUG [RouteService] Shutting down child service on route: MY_CATEGORY.MY_NAME -> FatalFallbackErrorHandler[Channel[DelegateSync[com.crlcorp.oasis.routing.utils.LauncherErrorHandler@7ccfd046]]]
12:22:13,034 DEBUG [RouteService] Shutting down child service on route: MY_CATEGORY.MY_NAME -> DelegateSync[com.crlcorp.oasis.routing.utils.LauncherErrorHandler@7ccfd046]
12:22:13,034 DEBUG [RouteService] Shutting down child service on route: MY_CATEGORY.MY_NAME -> Channel[DelegateSync[com.crlcorp.oasis.routing.utils.LauncherErrorHandler@7ccfd046]]
12:22:13,034 INFO [SpringCamelContext] Route: MY_CATEGORY.MY_NAME is shutdown and removed, was consuming from: quartz://MY_GROUP/MY_NAME?cron=0+0%2F1+*+*+*+%3F&stateful=true
Стартовый контекст с "нет маршрутов"
12:22:13,078 INFO [QuartzScheduler] Scheduler meta-data: Quartz Scheduler (v1.8.6) 'DefaultQuartzScheduler-CamelContext-MyContext_6.1.1-SNAPSHOT' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
12:22:13,078 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler-CamelContext-MyContext_6.1.1-SNAPSHOT' initialized from an externally provided properties instance.
12:22:13,078 INFO [StdSchedulerFactory] Quartz scheduler version: 1.8.6
12:22:13,078 DEBUG [QuartzComponent] Using SchedulerFactory org.quartz.impl.StdSchedulerFactory@5efaa50e to get/create Scheduler org.quartz.impl.StdScheduler@6d39162c(0x6d39162c)
12:22:13,078 INFO [QuartzComponent] Starting Quartz scheduler: DefaultQuartzScheduler-CamelContext-MyContext_6.1.1-SNAPSHOT
12:22:13,078 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler-CamelContext-MyContext_6.1.1-SNAPSHOT_$_NON_CLUSTERED started.
12:22:13,078 DEBUG [DefaultManagementLifecycleStrategy] Load performance statistics disabled
12:22:13,078 INFO [SpringCamelContext] Total 0 routes, of which 0 are started
12:22:13,078 INFO [SpringCamelContext] Apache Camel 2.22.2 (CamelContext: CamelContext-MyContext_6.1.1-SNAPSHOT) started in 0.036 seconds
Кварцевая работа возвращается из мертвых
12:22:13,507 DEBUG [SimpleThreadPool] WorkerThread is shut down.
12:23:00,002 DEBUG [SimpleJobFactory] Producing instance of Job 'DEFAULT.quartz-endpoint1', class=org.apache.camel.component.quartz.StatefulCamelJob
12:23:00,002 DEBUG [JobRunShell] Calling execute on job DEFAULT.quartz-endpoint1
12:23:00,002 DEBUG [CamelJob] Looking up existing QuartzEndpoint with trigger MY_NAME.MY_GROUP
12:23:00,002 DEBUG [QuartzEndpoint] Firing Quartz Job with context: JobExecutionContext: trigger: 'MY_GROUP.MY_NAME job: DEFAULT.quartz-endpoint1 fireTime: 'Mon Jan 07 12:23:00 CST 2019 scheduledFireTime: Mon Jan 07 12:23:00 CST 2019 previousFireTime: 'Mon Jan 07 12:22:00 CST 2019 nextFireTime: Mon Jan 07 12:24:00 CST 2019 isRecovering: false refireCount: 0