urunni88 opened a new pull request, #28039:
URL: https://github.com/apache/camel/pull/28039

   # Description
   
   Fixes [CAMEL-25647](https://issues.apache.org/jira/browse/CAMEL-25647).
   
   The test sends 5 files to a file consumer, whose route has a `delay(1000)` 
before `disruptor:foo`, and stops the context during processing with 
`ShutdownRunningTask.CompleteAllTasks`. The Delay EIP is asynchronous by 
default, so the poll returned while the 5 exchanges were still in their delay, 
and the next poll (every 500 ms) could pick up files that were not moved to 
`.camel` yet. Those files were then routed twice, so `mock:bar` received more 
than 5 messages.
   
   Reproduced locally with a repeated run (1 failure in 30 runs): `mock:bar` 
received `[b.txt, d.txt, c.txt, e.txt, a.txt, b.txt, d.txt, e.txt, c.txt]`, so 
9 messages instead of 5.
   
   Changes:
   - Use `.syncDelayed()`, so the poll thread processes the batch and no second 
poll starts while it is in flight. The test still stops the context during 
processing.
   - Set the shutdown timeout to `20`, which is the 20 seconds the comment says 
(the timeout is in seconds; `20 * 100000` was about 23 days).
   
   After the change, the test passed 100 out of 100 repeated runs locally.
   
   This PR was prepared with AI assistance (Claude); I reviewed and tested all 
changes.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.


-- 
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