Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Ce contenu n'est pas disponible dans la langue sélectionnée.
6.5. Transaction Policy
6.5.1. Transaction Interaction Policy Copier lienLien copié sur presse-papiers!
requires
attribute. Here is an example:
<service name="WorkService" requires="propagatesTransaction">
<service name="WorkService" requires="propagatesTransaction">
propagatesTransaction
: Indicates that a global transaction is required when a service is invoked. If no transaction is present, the SwitchYard generates an error at runtime.suspendsTransaction
: Indicates that if a transaction exists, the SwitchYard runtime suspends it before the service implementation is invoked and resumes it after the service invocation. This setting allows you to separate a gateway binding's transactional context from the transactional context of the service implementation.
propagatesTransaction
and suspendsTransaction
intents either to an interface or explicitly to a service and reference XML element in order to describe how any client transaction context is made available and used by the target service component.
Figure 6.1. Transaction Interaction Policy
6.5.2. Transaction Implementation Policy Copier lienLien copié sur presse-papiers!
requires
attribute. Here is an example:
<implementation.bean class="org.switchyard.quickstarts.demo.policy.transaction.WorkServiceBean" requires="managedTransaction.Global">
<implementation.bean class="org.switchyard.quickstarts.demo.policy.transaction.WorkServiceBean" requires="managedTransaction.Global">
managedTransaction.Global
: Indicates that this service implementation runs under a global transaction. If no transaction is present, the SwitchYard runtime creates a new JTA transaction before the execution. The SwitchYard runtime commits this newly created transaction at the end of service execution.managedTransaction.Local
: Indicates that this service implementation runs under a local transaction. If a transaction exists, the SwitchYard runtime suspends it. SwitchYard always creates a new JTA transaction before execution. The SwitchYard runtime commits this newly created transaction and resumes the suspended transcation after the service invocation.NoteAs the local transaction does not propagate its transaction through the reference, you must mark all of the component reference assuspendsTransaction
. If not, the SwitchYard runtime generates an error.noManagedTransaction
: Indicates that this service implementation does not run under any managed transaction. If a transaction exists, the SwitchYard runtime suspends it before the service implementation is invoked and resumes it after the service invocation.
managedTransaction
and noManagedTransaction
intents to describe the transactional environment required by a service component.
Scope of Support
Currently, the following gateways are transaction aware:
- Camel JMS Gateway (binding.jms)
- Camel JPA Gateway (binding.jpa)
- Camel SQL Gateway (binding.sql)
- JCA Gateway (binding.jca)
- SCA Gateway (binding.sca)
Figure 6.2. Transaction Implementation Policy