I have the same problem.

I have not found any solution to this issue. I believe that Camel should be
able to shutdown itself in a graceful manner. My scenario:

1. process N messages (I´m able to detect which is the last)
2. once all messages are processed I want to gracefuly terminate the process
3. depending on the amount of possible errors I need to return non-zero exit
status code 

What I do:

- from a newly spawned thread I stop the initial route and then whole
context using camelContext.stop()
- this new thread dies - it is not hanging
- I´m using 2.11

Result:

- all the "graceful shutdown stuff" is done (I see log messages) but the
process is still running
- I was even able to reliably reproduce weird behaviour: when running with
INFO log level the camel java process exits as expected, however in case
DEBUG log level it continues to run forever
- also trying to connect via JVVM made the hanging process to finish with
exit status=0 which is also a bit weird
- except the "stopping thread" I do not create any of my own threads. 

I spent 2 days with various approaches and so far was not able to reliably
stop Camel application. 
I would prefer some standard way - for example via control bus I would like
to send command to stop everything (there are no more messages anyway). It
seems like Camel in not really designed with this in mind. 









--
View this message in context: 
http://camel.465427.n5.nabble.com/After-camelContext-shutdown-is-any-way-to-exit-the-Java-main-method-tp5735993p5739792.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to