In regards to startup and shutdown of routes, by default, our routes are automatically started when your Apache Camel application (ie. the CamelContext
instance) starts up. Consequently, these same routes are automatically shut down when your Apache Camel application stops.
For most of our non-critical deployments, the granular details of the shutdown process is usually not very important. However, in a production environment, in order to avoid data loss it is often crucial that existing tasks should run to completion during the shutdown process.
Also, as another consideration, we typically want to control the order in which routes shut down so that dependencies are not violated (which would prevent existing tasks from running to completion).
For this reason, Apache Camel provides a set of features to support graceful shutdown of applications. Graceful shutdown gives you full control over the stopping and starting of routes, enabling you to control the shutdown order of routes and enabling current tasks to run to completion.