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

   ## Motivation
   
   CAMEL-25550 (#27681) made the JPA and Hazelcast SEDA consumers leave a 
message unconsumed when the route marks the exchange rollback only, with 
`markRollbackOnly()` **or** `markRollbackOnlyLast()`. The SQL and MyBatis 
(CAMEL-25527) and jOOQ (CAMEL-25511) consumers check only `isRollbackOnly()`, 
so an exchange marked with `markRollbackOnlyLast()` is still treated as a 
success there and the row is consumed.
   
   `markRollbackOnlyLast()` reaches the consumer only when no `transacted()` 
EIP has consumed the flag (`TransactionErrorHandler` clears it), and then the 
consumer's own transaction is the last one, so it should be rolled back as well.
   
   ## Change
   
   Honor `isRollbackOnlyLast()` alongside `isRollbackOnly()` in `SqlConsumer`, 
`MyBatisConsumer` and `JooqConsumer`, as the JPA and Hazelcast SEDA consumers 
already do:
   - a non-transacted consumer leaves the row unconsumed (no `onConsume`; 
SQL/MyBatis still run `onConsumeFailed` if set), so the next poll reads it 
again;
   - a transacted consumer breaks out of the batch and rolls back.
   
   ## Testing
   
   Extended the existing rollback-only consumer tests with a rollback-only-last 
case (deterministic single `poll()`, no scheduler):
   - `SqlConsumerRollbackOnlyTest`, `MyBatisOnConsumeFailedTest`, 
`JooqConsumerDeleteFailedTest` — each now also asserts a 
`markRollbackOnlyLast()` row is not consumed.
   
   All three modules build green. The 4.24 upgrade guide notes the change.
   
   _Claude Code on behalf of oscerd_
   
   🤖 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