Skip to content

CAMEL-25550: camel-jpa, camel-hazelcast - a transacted consumer must not commit an exchange marked rollback only - #27681

Open
davsclaus wants to merge 1 commit into
mainfrom
fix/CAMEL-25550
Open

davsclaus wants to merge 1 commit into
mainfrom
fix/CAMEL-25550

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

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

  • camel-jpa: the consumer deleted the entity (or called @Consumed) and committed the poll. Now the entity is not consumed. With transacted=true a RollbackExchangeException rolls back the whole poll, as a failed exchange does. With transacted=false the entity is skipped quietly (DEBUG log, no WARN for a deliberate rollback) and the rest of the batch is still consumed; the next poll consumes it again.
  • camel-hazelcast (seda, transacted=true): the transaction was committed, so the message was removed from the queue. Now the transaction is rolled back.

Same semantics as CAMEL-25511 (camel-jooq) and CAMEL-25527 (camel-mybatis / camel-sql, #27677).

Tests: JpaConsumerRollbackOnlyTest (non-transacted, transacted, @Consumed; embedded Derby, poll() called directly) and HazelcastSedaTransactedRollbackOnlyTest (mocked transaction context); all fail without the fix. Docs: jpa component doc + 4.23 upgrade guide.

Fixes CAMEL-25550

Claude Code on behalf of davsclaus

🤖 Generated with Claude Code

…not commit an exchange marked rollback only

An exchange marked rollback only (markRollbackOnly(), markRollbackOnlyLast()) has no exception, so the JPA consumer deleted the entity (or called @consumed) and committed the poll, and the transacted Hazelcast SEDA consumer committed its transaction, removing the message from the queue. The JPA consumer now does not consume such an entity: with transacted=true it throws a RollbackExchangeException so the whole poll is rolled back, with transacted=false it skips the entity and continues with the rest of the batch. The Hazelcast SEDA consumer rolls back its transaction.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-hazelcast
  • components/camel-jpa
  • docs

🔬 Scalpel shadow comparison — Scalpel: 10 of 704 tested, 25 compile-only — current: 10 all tested

Maveniverse Scalpel detected 10 affected modules (current approach: 10).

Skip-tests mode would test 10 modules (4 direct + 8 downstream), skip tests for 25 (generated code, meta-modules)

Modules Scalpel would test (10)
  • camel-hazelcast ← components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java, components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaTransactedRollbackOnlyTest.java
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-route-parser ← downstream of org.apache.camel:camel-route-parser
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-jpa ← components/camel-jpa/src/main/docs/jpa-component.adoc, components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java, components/camel-jpa/src/test/java/org/apache/camel/component/jpa/JpaConsumerRollbackOnlyTest.java
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-catalog
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (25)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (37 modules, 4m 32s total)

Total reactor time: 4m 32s

Module Duration Status
Camel :: JBang :: Plugin :: TUI 50.8s SUCCESS
Camel :: JPA 50.5s SUCCESS
Camel :: Launcher 20.6s SUCCESS
Camel :: JBang :: MCP 15.8s SUCCESS
Camel :: Catalog :: Camel Catalog 13.6s SUCCESS
Camel :: YAML DSL :: Validator 13.0s SUCCESS
Camel :: YAML DSL 12.9s SUCCESS
Camel :: Component DSL 12.5s SUCCESS
Camel :: JBang :: Plugin :: Validate 12.0s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 10.0s SUCCESS
Camel :: Docs 9.9s SUCCESS
Camel :: JBang :: Plugin :: Testing 9.9s SUCCESS
Camel :: Kamelet Main 6.2s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 5.6s SUCCESS
Camel :: Catalog :: Camel Route Parser 4.7s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 4.3s SUCCESS
Camel :: YAML DSL :: Deserializers 4.1s SUCCESS
Camel :: All Components Sync point 3.0s SUCCESS
Camel :: YAML DSL :: Maven Plugins 1.8s SUCCESS
Camel :: Catalog :: Maven 1.6s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 1.4s SUCCESS
Camel :: JBang :: Plugin :: Edit 0.9s SUCCESS
Camel :: Assembly 0.9s SUCCESS
Camel :: JBang :: Integration tests 0.8s SUCCESS
Camel :: Catalog :: Dummy Component 0.7s SUCCESS
Camel :: JBang :: Plugin :: Generate 0.7s SUCCESS
Camel :: JBang :: Plugin :: MCP 0.7s SUCCESS
Camel :: Coverage 0.6s SUCCESS
Camel :: Catalog :: Console 0.6s SUCCESS
Camel :: Endpoint DSL :: Support 0.5s SUCCESS
Camel :: JBang :: Main 0.5s SUCCESS
Camel :: JBang :: Plugin :: Route Parser 0.4s SUCCESS
Camel :: Launcher :: Container 0.3s SUCCESS
Camel :: Endpoint DSL n/a
Camel :: HazelCast n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a

Top 20 slowest modules:

  • Camel :: JBang :: Plugin :: TUI (50.8s)
  • Camel :: JPA (50.5s)
  • Camel :: Launcher (20.6s)
  • Camel :: JBang :: MCP (15.8s)
  • Camel :: Catalog :: Camel Catalog (13.6s)
  • Camel :: YAML DSL :: Validator (13.0s)
  • Camel :: YAML DSL (12.9s)
  • Camel :: Component DSL (12.5s)
  • Camel :: JBang :: Plugin :: Validate (12.0s)
  • Camel :: JBang :: Plugin :: Kubernetes (10.0s)
  • Camel :: Docs (9.9s)
  • Camel :: JBang :: Plugin :: Testing (9.9s)
  • Camel :: Kamelet Main (6.2s)
  • Camel :: YAML DSL :: Validator Maven Plugin (5.6s)
  • Camel :: Catalog :: Camel Route Parser (4.7s)
  • Camel :: Catalog :: Camel Report Maven Plugin (4.3s)
  • Camel :: YAML DSL :: Deserializers (4.1s)
  • Camel :: All Components Sync point (3.0s)
  • Camel :: YAML DSL :: Maven Plugins (1.8s)
  • Camel :: Catalog :: Maven (1.6s)

⚙️ View full build and test results

@davsclaus
davsclaus requested a review from gnodet October 11, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant