Reputation: 337
I have a camel application where I create below structure
main thread
create Camel Context
addRoute(routeBuilder1)
addRoute(routeBuilder2)
context.start
RouteBuilder1
R11
R12
R13
R14
RouteBuilder2
R21
R22
In very specific situation, I need to stop the context(stop all processing right now). When I use context.shutdown,I noticed that if a route processing is in progress, camel is not able to stop it(called as gracefull shutdown), and that route continue processing. Whereas,in my case I need to hard stop everything immediately.
How can we achieve that?
Upvotes: 2
Views: 2894
Reputation: 2667
Set the timeout
field of DefaultShutdownStrategy.
Example:
context.getShutdownStrategy().setTimeout(0);
context.getShutdownStrategy().setShutdownNowOnTimeout(true);
UPDATE:
I'm not sure, but maybe it should work with 1 millisec timeout (you can set the TimeUnit on the shutdownStrategy)
context.getShutdownStrategy().setTimeUnit(TimeUnit.MILLISECONDS);
context.getShutdownStrategy().setTimeout(1);
context.getShutdownStrategy().setShutdownNowOnTimeout(true)
Upvotes: 1
Reputation: 408
Have you seen this related question?
How to properly stop camelContext from being killed in a standalone application
Maybe you can try it in the same way using "kill -9".
Upvotes: 1