We are already running Dockerised Apache Camel/Spring Boot containers and have been looking at deploying them inside Kubernetes, and using the Kubernetes Cron Job to create a Jobs on a time-based schedule.
Since the scheduling will happen "outside" Camel for our (ETL) Camel route I have replaced the scheduled interval with a timer that fires just once: from("timer://foo?repeatCount=1") .routePolicy(myPolicy) .routeId("timer in action") .to("mock:foo"); Because the Kubernetes Job needs to complete, we need not just stop the route, but the SpringBoot application context. For that purpose we define a Policy - mostly noop - except for the OnExchangeComplete method, which closes the autowired appContext: public void onExchangeDone(Route route, Exchange exchange) { appContext.close(); } That works, but I still get a warning before the Spring Container shuts down: o.a.c.i.DefaultInflightRepository | Shutting down while there are still 1 inflight exchanges. Spring Container is destroyed! If I put the extra logging below in, it confirms there is 1 Exchange for the "timer in action" route camelContext.getInflightRepository().browse().iterator().next().getFromRouteId()); camelContext.getInflightRepository().browse().size()); My question is: given this is fire-once timer route, and the Exchange is done being routed, why would there still be 1 inflight exchange? And if above is not correct approach, what would be a correct way/time to close the spring context? This e-mail may contain information which is confidential, subject to legal privilege and /or protected by copyright. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy all copies of this email.