spring-retry icon indicating copy to clipboard operation
spring-retry copied to clipboard

Graceful Shutdown

Open Rajh opened this issue 7 years ago • 1 comments

Is it possible to stop retries when the application is shutting down ? When configuring retry for a long period of time, it blocks the application shutdown until every retries are finished.

In my case, I'm using a JMS listener, which is closed after 30 seconds, but @Retryable annotation keeps retrying message, which even if the process would have succeed, won't be able to commit the JMS ack.

Rajh avatar Oct 08 '18 12:10 Rajh

My understanding is that on shutdown the listener threads should be interrupted, and that would be picked up by the backoff policy at the end of the current backoff. So it shouldn't be the case that "every retry" has to finish - they just all have to get to the next attempt. If your backoffs can be longer than 30s, then you probably need to adjust the timeout in the listener container.

Stateful retry is probably better for JMS (then you won't block during the retry).

dsyer avatar Nov 08 '18 11:11 dsyer