1
votes

So Apache camel has this graceful shutdown feature that waits 300 seconds, and it's really annoying. I say this because I'm running local testing and I get errors where a request will hang, and I want to abort it by shutting my app down. But then I get stuck waiting for 5 mins for all inflight transactions to finish.

I want the ability to disable this graceful shutdown waiting period for my local testing so I can just kill the whole process and start over. Any advice would be appreciated.

2

2 Answers

3
votes

You can set shutdown timeout to some lower value. There are many options to set shutdown timeout value:

  • Spring Boot property - camel.springboot.shutdownTimeout = 1
  • ShutdownStrategy property - getContext().getShutdownStrategy().setTimeout(1)
  • With environment variable (camel-main only) - java -DCAMEL_MAIN_SHUTDOWNTIMEOUT=1 ...
  • At runtime with JMX operation setTimeout() on MBean org.apache.camel:context=MyCamel,type=context,name="MyCamel"

For more details see Graceful shutdown. In Camel 3.1 and later will be default shutdown timeout reduced to 45s - CAMEL-14336.

0
votes

Here's the documentation of the spring boot property: https://camel.apache.org/camel-spring-boot/3.7.x/spring-boot.html

camel.springboot.shutdown-timeout | Timeout in seconds to graceful shutdown Camel. | 300 | Integer

Setting camel.springboot.shutdownTimeout = 1 in the application test properties was the easiest way to adjust this.