-
Notifications
You must be signed in to change notification settings - Fork 636
Considerations regarding shutdown timeout #3039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's exactly why that I'll think about moving However I still would like to understand why do you insist in using transactional channel? Have you considered to use a |
Fixes: #3039 Issue link: #3039 Currently, the `BlockingQueueConsumer` initiates a Basic Recovery command on the channel for transactional consumer immediately after Basic Cancel. However, it is possible still to try to handle in-flight messages during `shutdownTimeout` in the listener container * Leave only Basic Cancel command in the `BlockingQueueConsumer.basicCancel()` API * Revert `BlockingQueueConsumer.nextMessage(timeout)` method logic to normal loop until message pulled from the in-memory cache is `null` * Call `basicCancel(true)` from the `stop()` is not cancelled yet * Perform `channel.basicRecover()` for transactional channel in the `stop()`. This `stop()` is usually called from the listener container when in-flight messages have not been processed during `shutdownTimeout` (cherry picked from commit 14fe215)
Fixes: #3039 Issue link: #3039 Currently, the `BlockingQueueConsumer` initiates a Basic Recovery command on the channel for transactional consumer immediately after Basic Cancel. However, it is possible still to try to handle in-flight messages during `shutdownTimeout` in the listener container * Leave only Basic Cancel command in the `BlockingQueueConsumer.basicCancel()` API * Revert `BlockingQueueConsumer.nextMessage(timeout)` method logic to normal loop until message pulled from the in-memory cache is `null` * Call `basicCancel(true)` from the `stop()` is not cancelled yet * Perform `channel.basicRecover()` for transactional channel in the `stop()`. This `stop()` is usually called from the listener container when in-flight messages have not been processed during `shutdownTimeout` (cherry picked from commit 14fe215)
I have pushed some fix according to your request. Thanks |
Hi, I have successfully tested it in the demo project, confirming that the shutdown process now waits correctly. I did not observe any We will integrate the new version into our production projects as soon as it becomes available, for further testing. I am currently maintaining a large, decade-old project that has consistently utilized transactional channels. Before removing this configuration we need to fully understand the implications of the change. Our primary requirement is to ensure no message loss occurs. We process several million messages daily, with traffic loads fluctuating hourly. Consequently, we maintain a dynamically varying number of consumers, leveraging the auto-scaling capabilities of the |
Hi Artem, Thank you once more for your support! |
Hi,
following the resolution of issues #2941 and #3032, we have conducted a further analysis concerning the shutdown process within our custom requirements.
In our custom usage scenario, we customize the
ShutdownTimeout
, which is used within theshutdownAndWaitOrCallback()
method to allow time for processing messages after theBasicCancel
before the consumers stop.However, the commit 02db80b has introduced a modification to the
basicCancel()
method's behavior. The invocation ofRabbitUtils.closeMessageConsumer()
now triggers a sequential execution of both theCancel
and theRecover
operations.To restore the previous behavior (with a timeout on shutdown), one potential solution would involve the introduction of a distinct timeout period between the execution of the
BasicCancel
andRecover
commands.Or, better yet, in our opinion, the
basicCancel()
method should be restored to its state before the change, and theRecover
command should be added after waiting for the shutdown timeout.I am referring to the
shutdownAndWaitOrCallback()
method after the instruction:boolean finished = this.cancellationLock.await(this.getShutdownTimeout(), TimeUnit.MILLISECONDS);
if the result is false.
We are unaware of the reasoning behind the aforementioned change, so we are unsure of the most appropriate approach.
We do agree that, before the change, unacknowledged messages were never requeued in the case of channel transacted, but we think that the shutdown timeout should be anyway considered before the
Recover
.What are your thoughts on this?
The text was updated successfully, but these errors were encountered: