allthingssecurity commented on code in PR #28261:
URL: https://github.com/apache/camel/pull/28261#discussion_r4345330777


##########
components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java:
##########
@@ -71,14 +71,17 @@ protected void doStart() throws Exception {
 
     @Override
     protected void doStop() throws Exception {
+        if (executor != null) {
+            // wait for the consumer threads to end their current poll (at 
most pollTimeout) and route what it returned:
+            // a poll takes the item from the queue, so an item polled after 
the processor is stopped is lost
+            
endpoint.getCamelContext().getExecutorServiceManager().shutdownGraceful(executor);

Review Comment:
   Done in ee5eb3f0524e. A single poll now waits `Math.min(pollTimeout, 1000)` 
ms (`MAX_POLL_WAIT`, as in #28258). A null poll goes back round the loop and 
commits the empty transaction, so behaviour is the same and a stop is bounded 
to about a second for any `pollTimeout`. The `doStop` comment now says "at most 
MAX_POLL_WAIT". New test 
`longPollTimeoutStillStopsPromptlyAndLeavesTheItemInTheQueue` 
(`pollTimeout=60000`, fails without the cap: `Stopping the route took 10002 
ms`): an item is routed, the route stops in under 5 s, and an item offered 
afterwards stays in the queue. The `pollTimeout` option text ("Setting a lower 
value allows the consumer to react more quickly upon shutdown") is still true, 
so I left it and the generated metadata unchanged.
   
   _Claude Code on behalf of allthingssecurity_
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to