Camel uses a simple lifecycle interface called Service which has a single start() and stop() method.
When you use Camel you typically have to start the CamelContext which will start all the various components and endpoints and activate the routing rules until the context is stopped again.
If you are working with Spring you may wish to read the Camel Spring documentation.
The CamelContext provides methods to control its lifecycle:
The operations is paired: start/stop and suspend/resume.
Stop is performing a Graceful Shutdown which means all its internal state, cache, etc is cleared. And the routes is being stopped in a graceful manner to ensure messages is given time to complete. If you start a CamelContext after a stop, then its performing a cold start, recreating all the state, cache etc. again.
Instead you can use the suspend/resume operations. They will keep the CamelContext warm and only suspend/stop routes using the same Graceful Shutdown feature. This ensures messages is given time to complete.
End users is encouraged to use suspend/resume if you are temporary stopping a Camel application.
All these operations is available in JMX as well, so you can control Camel from a management console.
A service (org.apache.camel.Service) in Camel adheres to the following lifecycle states as illustrated in the diagram below:
Notice: A service can optimally support suspend/resume by the org.apache.camel.SuspendableService. This means not all services in Camel supports suspension. It's encouraged that consumers support suspension which allows to suspend/resume routes.
Routes in Camel have the following operations to control its lifecycle
The remove operation will remove the route, for example in JMX the route will then be unregistered and its gone. So only use remove if you really want to remove the route. The route must have been stopped before you can remove.
The start and resume operations in JMX checks the state beforehand. So if a route is stopped and you click resume, it will know to invoke start. And likewise if a route has been suspended and you click start it knows to resume instead. This makes management a bit easier.
If a route consumer does not support suspension, it will fallback and stop the route instead.