Figure 9 shows an overview of the OSGi transaction architecture in Fuse ESB Enterprise. The core of the architecture is a JTA transaction manager based on Apache Geronimo, which exposes various transaction interfaces as OSGi services.
The JTA Transaction Services Specification section of the OSGi Service Platform Enterprise Specification describes the kind of transaction support that can (optionally) be provided by an OSGi container. Essentially, OSGi mandates that the transaction service is accessed through the Java Transaction API (JTA).
The transaction service exports the following JTA interfaces as OSGi services (the JTA services):
javax.transaction.UserTransactionjavax.transaction.TransactionManagerjavax.transaction.TransactionSynchronizationRegistry
Only one JTA provider should be made available in an OSGi container. In other words, the JTA services are registered only once and the objects obtained by importing references to the JTA services must be unique.
The Fuse ESB Enterprise transaction service exports the following Spring interface as an OSGi service:
org.springframework.transaction.PlatformTransactionManager
By obtaining a reference to the PlatformTransactionManager OSGi service,
it is possible to integrate application bundles written using the Spring transaction API
into the Fuse ESB Enterprise transaction architecture.
Fuse ESB Enterprise provides an OSGi-compliant implementation of the transaction service through
the Apache Aries transaction feature, which consists mainly of the
following bundles:
org.apache.aries.transaction.manager org.apache.aries.transaction.wrappers org.apache.aries.transaction.blueprint
The Aries transaction feature exports a variety of transaction interfaces as OSGi services (making them available to other bundles in the container), as follows:
JTA interfaces—the JTA
UserTransaction,TransactionManager, andTransactionSynchronizationRegistryinterfaces are exported, as required by the OSGi transaction specification.Spring transaction interface—the Spring
PlatformTransactionManagerinterface is exported, in order to facilitate bundles that are written using the Spring transaction APIs.
The PlatformTransactionManager OSGi service and the JTA services access
the same underlying transaction manager.
To access the Fuse ESB Enterprise transaction implementation, you must install the transaction feature. In a standalone container, enter the following console command:
karaf@root> features:install transaction
If you are deploying into a fabric, add the
transaction feature to your application's profile.
The underlying implementation of the Fuse ESB Enterprise transaction service is provided by the Apache Geronimo transaction manager. Apache Geronimo is a full implementation of a J2EE server and, as part of the J2EE implementation, Geronimo has developed a sophisticated transaction manager with the following features:
Support for enlisting multiple XA resources.
Support for 1-phase and 2-phase commit protocols.
Support for suspending and resuming transactions.
Support for automatic transaction recovery upon startup.
The transaction recovery feature depends on a transaction log, which records the status of all pending transactions in persistent storage.
Normally, the Geronimo transaction manager is accessed indirectly—for example, through the JTA wrapper layer or through the Spring wrapper layer. But if you need to access Geronimo directly, the following interface is also exposed as an OSGi service:
org.apache.geronimo.transaction.manager.RecoverableTransactionManager
The implementation of the transaction log is provided by HOWL, which is a high speed persistent logger that is optimized for XA transaction logs.
Normally, it is recommended that application bundles access the transaction service through the JTA interface. To use the transaction service in a JTA-based application bundle, import the relevant JTA service as an OSGi service and use the JTA service to begin, commit, or rollback transactions.
If you have already implemented an application bundle using the Spring transaction
API, you might find it more convenient to access the transaction service through the
Spring API (represented by the PlatformTransactionManager Java interface).
This means that you are able to deploy the same source code either in a pure Spring
container or in an OSGi container, by changing only the configuration snippet that
obtains a reference to the transaction service.
The following specifications are relevant to the transaction architecture in Fuse ESB Enterprise:
OSGi transaction specification—in section 123 JTA Transaction Services Specification v1.0 from the OSGi Service Platform Enterprise Specification v4.2
Spring transactions API—see the Transaction Management chapter from the current Spring Reference Manual.









