allthingssecurity opened a new pull request, #27644: URL: https://github.com/apache/camel/pull/27644
# Description [CAMEL-25511](https://issues.apache.org/jira/browse/CAMEL-25511) With `consumeDelete=true` (the default) `JooqConsumer.poll()` deleted every entity it had fetched after the batch, whatever happened to the exchanges. A failed route leaves the exception on the exchange instead of throwing it, so a row whose processing failed (or whose exchange was marked rollback only) was deleted and lost; when a graceful shutdown started after the fetch, the batch was not processed but its rows were deleted as well. Now the consumer records, right after processing each exchange, whether it completed successfully (not failed, not rollback only) and deletes only those entities, as the camel-jpa consumer does. A failed entity stays in the table and is consumed again by the next poll, so an entity that always fails is processed at every poll. Docs updated (with the catalog copy) and an upgrade guide note added for 4.23. Tests: - New `JooqConsumerDeleteFailedTest`: one poll (scheduler not started) over two authors, where the route fails for one of them, marks one exchange rollback only, or the poll runs after `deferShutdown(CompleteCurrentTaskOnly)` (as at the start of a graceful shutdown). - Without the change all three fail: `expected: <[2]> but was: <[]>` twice and `expected: <2> but was: <0>` (the rows are gone). - With the change: camel-jooq 16 tests, 0 failures. Found with a Lean 4 model of the poll: "an entity is deleted only if its exchange succeeded" fails for one failed entity, and the fix is proved to satisfy it and to delete the same entities as before when every exchange succeeds. I then reproduced it with the consumer. # 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. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built and tested camel-jooq, including the formatter and import-sort plugins. 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]
