Apache camel graceful route shutdown

2.3k views Asked by At

I have a Camel route which Consumes messages from a Queue and stores the message into a Database. Now I wanted to shut down running camel route manually in a graceful manner. I have a RestEndpoint to be triggered whenever I need to stop Camel route. This endpoint should stop the route. But if there is any in-flight message or transaction running during the shutdown it has to be completed successfully without consuming any new messages from from("") endpoint of camel route and shut down after completing inflight message or transaction. Can anyone help me how Can I code this?

2

There are 2 answers

0
Poorya Hosseini On
shutdownRunningTask(ShutdownRunningTask.CompleteCurrentTaskOnly)
0
Murli On

Below are the few options to control/monitor camel routes

  • CamelContext API's

  • Control bus component

  • JMX API's

You can go through below two sites to get started

http://camel.apache.org/controlbus.html

https://dzone.com/articles/apache-camel-monitoring