...
Stopping a route during routing an existing message is a bit tricky. The reason for that is Camel will graceful shutdown Graceful Shutdown the route you are stopping. And if you do that while a message is being routed the graceful shutdown Graceful Shutdown will try to wait until that message has been processed.
Now that message can easily be yourself. So to cater for that you have to tell Camel that you are done routing this message which you do by removing it from the in flight registry. The follow code shows how you can stop a route from a Processor:
...
- suspend/resume is faster than stop/start. For example a HTTP server will still run but deny any incoming requests.
Where as if it was stopped the HTTP listener would have been stopped. - shutdown means the route is being removed from CamelContext and cannot be started again. Its also removed from JMX.
A route must have been stopped prior to be shutdown.
See more details about the Lifecycle.