Claus Ibsen created CAMEL-25550:
-----------------------------------

             Summary: camel-jpa, camel-hazelcast - a transacted consumer 
commits an exchange that is marked rollback only
                 Key: CAMEL-25550
                 URL: https://issues.apache.org/jira/browse/CAMEL-25550
             Project: Camel
          Issue Type: Bug
          Components: camel-jpa, camel-hazelcast
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.23.0


When a route marks the exchange as rollback only (markRollbackOnly() / 
markRollbackOnlyLast() / exchange.setRollbackOnly(true)) there is no exception 
on the exchange, and these consumers treat it as success:

*camel-jpa* - JpaConsumer.processBatch only checks exchange.getException() 
before running the delete handler, so the @Consumed method is invoked (or the 
entity is removed with consumeDelete=true) and the transaction of the batch is 
committed. With transacted=true this contradicts the option, which says the 
whole batch is rolled back. The rollback() EIP is not affected as it sets a 
RollbackExchangeException.

*camel-hazelcast* - the hazelcast-seda consumer with transacted=true commits 
the Hazelcast transaction whenever the exchange has no exception, so a rollback 
only message is removed from the queue.

Other transactional consumers (jms, sjms, spring-rabbitmq, kafka transactions, 
jooq, and camel-mybatis/camel-sql via CAMEL-25527) honour rollback only. The 
fix is to treat a rollback only exchange as not consumed, the same way as 
camel-jooq (CAMEL-25511) and camel-mybatis/camel-sql (CAMEL-25527).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to