Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 4. Configuring the Narayana transaction manager
In Fuse, the built-in, global transaction manager is JBoss Narayana Transaction Manager, which is the same transaction manager that is used by Enterprise Application Platform (EAP) 7.
In the OSGi runtime, as in Fuse for Karaf, the additional integration layer is provided by the PAX TRANSX project.
The following topics discuss Narayana configuration:
4.1. About Narayana installation
The Narayana transaction manager is exposed for use in OSGi bundles under the following interfaces, as well as a few additional support interfaces:
-
javax.transaction.TransactionManager
-
javax.transaction.UserTransaction
-
org.springframework.transaction.PlatformTransactionManager
-
org.ops4j.pax.transx.tm.TransactionManager
The 7.13.0.fuse-7_13_0-00012-redhat-00001
distribution makes these interfaces available from the start.
The pax-transx-tm-narayana
feature contains an overridden bundle that embeds Narayana:
karaf@root()> feature:info pax-transx-tm-narayana Feature pax-transx-tm-narayana 0.3.0 Feature has no configuration Feature has no configuration files Feature depends on: pax-transx-tm-api 0.0.0 Feature contains followed bundles: mvn:org.jboss.fuse.modules/fuse-pax-transx-tm-narayana/7.0.0.fuse-000191-redhat-1 (overriden from mvn:org.ops4j.pax.transx/pax-transx-tm-narayana/0.3.0) Feature has no conditionals.
The services provided by the fuse-pax-transx-tm-narayana
bundle are:
karaf@root()> bundle:services fuse-pax-transx-tm-narayana Red Hat Fuse :: Fuse Modules :: Transaction (21) provides: ---------------------------------------------------------- [org.osgi.service.cm.ManagedService] [javax.transaction.TransactionManager] [javax.transaction.TransactionSynchronizationRegistry] [javax.transaction.UserTransaction] [org.jboss.narayana.osgi.jta.ObjStoreBrowserService] [org.ops4j.pax.transx.tm.TransactionManager] [org.springframework.transaction.PlatformTransactionManager]
Because this bundle registers org.osgi.service.cm.ManagedService
, it tracks and reacts to the changes in CM configurations:
karaf@root()> bundle:services -p fuse-pax-transx-tm-narayana Red Hat Fuse :: Fuse Modules :: Transaction (21) provides: ---------------------------------------------------------- objectClass = [org.osgi.service.cm.ManagedService] service.bundleid = 21 service.id = 232 service.pid = org.ops4j.pax.transx.tm.narayana service.scope = singleton ...
The default org.ops4j.pax.transx.tm.narayana
PID is:
karaf@root()> config:list '(service.pid=org.ops4j.pax.transx.tm.narayana)' ---------------------------------------------------------------- Pid: org.ops4j.pax.transx.tm.narayana BundleLocation: ? Properties: com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.communicationStore.localOSRoot = communicationStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.communicationStore.objectStoreDir = /data/servers/7.13.0.fuse-7_13_0-00012-redhat-00001/data/narayana com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.communicationStore.objectStoreType = com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.localOSRoot = defaultStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.objectStoreDir = /data/servers/7.13.0.fuse-7_13_0-00012-redhat-00001/data/narayana com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.objectStoreType = com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.stateStore.localOSRoot = stateStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.stateStore.objectStoreDir = /data/servers/7.13.0.fuse-7_13_0-00012-redhat-00001/data/narayana com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.stateStore.objectStoreType = com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore com.arjuna.ats.arjuna.common.RecoveryEnvironmentBean.recoveryBackoffPeriod = 10 felix.fileinstall.filename = file:/data/servers/7.13.0.fuse-7_13_0-00012-redhat-00001/etc/org.ops4j.pax.transx.tm.narayana.cfg service.pid = org.ops4j.pax.transx.tm.narayana
In summary:
- Fuse for Karaf includes the fully-featured, global, Narayana transaction manager.
- The transaction manager is correctly exposed under various client interfaces (JTA, Spring-tx, PAX JMS).
-
You can configure Narayana by using the standard OSGi method, Configuration Admin, which is available in
org.ops4j.pax.transx.tm.narayana
. -
The default configuration is provided in
$FUSE_HOME/etc/org.ops4j.pax.transx.tm.narayana.cfg
.
4.2. Transaction protocols supported
The Narayana transaction manager is the JBoss/Red Hat product that is used in EAP. Narayana is a transactions toolkit that provides support for applications that are developed using a broad range of standards-based transaction protocols:
- JTA
- JTS
- Web-Service Transactions
- REST Transactions
- STM
- XATMI/TX
4.3. About Narayana configuration
The pax-transx-tm-narayana
bundle includes the jbossts-properties.xml
file, which provides the default configuration of different aspects of the transaction manager. All of these properties may be overriden in the $FUSE_HOME/etc/org.ops4j.pax.transx.tm.narayana.cfg
file directly or by using the Configuration Admin API.
The basic configuration of Narayana is done through various EnvironmentBean
objects. Every such bean may be configured by using properties with different prefixes. The following table provides a summary of configuration objects and prefixes used:
Configuration Bean | Property Prefix |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The prefix can simplify the configuration. However, you should typically use either of the following formats:
NameEnvironmentBean.propertyName
(the preferred format), or
fully-qualified-class-name.field-name
For example, consider the com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean.commitOnePhase
field. It may be configured by using the com.arjuna.ats.arjuna.common.CoordinatorEnvironmentBean.commitOnePhase
property or it can be configured by using the simpler (preferred) form CoordinatorEnvironmentBean.commitOnePhase
. Full details of how to set properties and which beans can be configured can be found in the Narayana Product Documentation.
Some beans, such as the ObjectStoreEnvironmentBean
, may be configured multiple times with each named instance providing configuration for a different purposes. In this case, the name of the instance is used between the prefix (any of the above) and field-name
. For example, a type of object store for an ObjectStoreEnvironmentBean
instance that is named communicationStore
may be configured by using properties that are named:
-
com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.communicationStore.objectStoreType
-
ObjectStoreEnvironmentBean.communicationStore.objectStoreType
4.4. Configuring log storage
The most important configuration is the type and location of object log storage. There are typically three implementations of the com.arjuna.ats.arjuna.objectstore.ObjectStoreAPI
interface:
- com.arjuna.ats.internal.arjuna.objectstore.hornetq.HornetqObjectStoreAdaptor
-
Uses
org.apache.activemq.artemis.core.journal.Journal
storage from AMQ 7 internally. - com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore
- Uses JDBC to keep TX log files.
- com.arjuna.ats.internal.arjuna.objectstore.FileSystemStore (and specialized implementations)
- Uses custom file-based log storage.
By default, Fuse uses com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore
, which is a specialized implementation of FileSystemStore
.
There are three stores that are used by Narayana for which transaction/object logs are kept:
-
defaultStore
-
communicationStore
-
stateStore
See State management in Narayana documentation for more details.
The default configuration of these three stores is:
# default store com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.objectStoreType = com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.objectStoreDir = ${karaf.data}/narayana com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.localOSRoot = defaultStore # communication store com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.communicationStore.objectStoreType = com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.communicationStore.objectStoreDir = ${karaf.data}/narayana com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.communicationStore.localOSRoot = communicationStore # state store com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.stateStore.objectStoreType = com.arjuna.ats.internal.arjuna.objectstore.ShadowNoFileLockStore com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.stateStore.objectStoreDir = ${karaf.data}/narayana com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.stateStore.localOSRoot = stateStore
ShadowNoFileLockStore
is configured with the base directory (objectStoreDir
) and the particular store’s directory (localOSRoot
).
The many configuration options are contained in the Narayana documentation guide. However, the Narayana documentation states that the canonical reference for configuration options is the Javadoc for the various EnvironmentBean
classes.