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

   # Description
   
   [CAMEL-25733](https://issues.apache.org/jira/browse/CAMEL-25733)
   
   Follow-up of CAMEL-25710 (raised in the review of #27990). With an 
`idempotentRepository`, `processBatch` gives back the mails of a batch that are 
not routed when routing an exchange throws. The exchange that `processExchange` 
threw on was already taken from the batch, so it was not given back: its key 
stayed in the repository, and every later poll skipped that mail as a 
duplicate. Only an exception escaping `processExchange` reaches this path 
(routing errors normally land on the exchange), for example from a processor 
given to the consumer directly or a subclass that overrides it.
   
   Change (`MailConsumer.routeBatch` only): when `processExchange` throws, the 
key of that exchange is removed too, if the exchange was neither committed nor 
rolled back (both take the key from the exchange); the exception is rethrown as 
before.
   
   Tests (`MailIdempotentRepositoryPollErrorTest`, GreenMail IMAP):
   - New `mailWhoseProcessExchangeThrowsIsConsumedByTheNextPoll`: one mail, the 
first `processExchange` throws, the next poll routes the same mail. Fails on 
main (the key stays, the second poll routes nothing).
   - The two tests that throw from `processExchange` now expect only the key of 
the mail routed before it to remain.
   - The new test and the two changed ones fail on main and pass with the 
change (20 runs in a row, 80/80). Offline, the camel-mail tests pass: 242 run, 
0 failures, 3 skipped; `MailIdempotentRepositoryDuplicateTest` failed once and 
passed on the rerun, a timing flake that fails as often without the change (6 
of 55 runs on main, 10 of 55 with it; it asserts the repository size right 
after the mock is satisfied, before the last exchange completes).
   
   # 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): 
[CAMEL-25733](https://issues.apache.org/jira/browse/CAMEL-25733).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built camel-mail and the modules it depends on, including the formatter 
and import-sort plugins, and ran the camel-mail tests. No generated file 
changes. I did not run the full root build.)
   
   # 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 PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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