| // Do not edit directly! |
| // This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page |
| = JTA |
| :page-aliases: extensions/jta.adoc |
| :linkattrs: |
| :cq-artifact-id: camel-quarkus-jta |
| :cq-native-supported: true |
| :cq-status: Stable |
| :cq-status-deprecation: Stable |
| :cq-description: Enclose Camel routes in transactions using Java Transaction API (JTA) and Narayana transaction manager |
| :cq-deprecated: false |
| :cq-jvm-since: 1.0.0 |
| :cq-native-since: 1.0.0 |
| |
| [.badges] |
| [.badge-key]##JVM since##[.badge-supported]##1.0.0## [.badge-key]##Native since##[.badge-supported]##1.0.0## |
| |
| Enclose Camel routes in transactions using Java Transaction API (JTA) and Narayana transaction manager |
| |
| == What's inside |
| |
| * xref:{cq-camel-components}:others:jta.adoc[JTA] |
| |
| Please refer to the above link for usage and configuration details. |
| |
| == Maven coordinates |
| |
| https://code.quarkus.io/?extension-search=camel-quarkus-jta[Create a new project with this extension on code.quarkus.io, window="_blank"] |
| |
| Or add the coordinates to your existing project: |
| |
| [source,xml] |
| ---- |
| <dependency> |
| <groupId>org.apache.camel.quarkus</groupId> |
| <artifactId>camel-quarkus-jta</artifactId> |
| </dependency> |
| ---- |
| |
| Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. |
| |
| == Usage |
| |
| This extension should be added when you need to use the `transacted()` EIP in the router. It leverages the transaction capabilities provided by the narayana-jta extension in Quarkus. |
| |
| Refer to the https://quarkus.io/guides/transaction[Quarkus Transaction guide] for the more details about transaction support. For a simple usage: |
| |
| [source,java] |
| ---- |
| from("direct:transaction") |
| .transacted() |
| .to("sql:INSERT INTO A TABLE ...?dataSource=ds1") |
| .to("sql:INSERT INTO A TABLE ...?dataSource=ds2") |
| .log("all data are in the ds1 and ds2") |
| ---- |
| |
| Support is provided for various transaction policies. |
| |
| [cols="50,.^50] |
| |=== |
| |Policy | Description |
| |
| | `PROPAGATION_MANDATORY` |
| |
| | Support a current transaction; throw an exception if no current transaction exists. |
| |
| | `PROPAGATION_NEVER` |
| |
| | Do not support a current transaction; throw an exception if a current transaction exists. |
| |
| | `PROPAGATION_NOT_SUPPORTED` |
| |
| | Do not support a current transaction; rather always execute non-transactionally. |
| |
| | `PROPAGATION_REQUIRED` |
| |
| | Support a current transaction; create a new one if none exists. |
| |
| | `PROPAGATION_REQUIRES_NEW` |
| |
| | Create a new transaction, suspending the current transaction if one exists. |
| |
| | `PROPAGATION_SUPPORTS` |
| |
| | Support a current transaction; execute non-transactionally if none exists. |
| |
| |=== |
| |