第 4 章 配置 Narayana 事务管理器
在 Fuse 中,内置的全局事务管理器是 JBoss Narayana Transaction Manager,后者是企业应用平台(EAP) 7 使用的同一事务管理器。
在 OSGi 运行时中,与用于 Karaf 的 Fuse 一样,额外的集成层由 PAX TRANSX 项目提供。
以下主题讨论 Narayana 配置:
4.1. 关于 Narayana 安装
Narayana 事务管理器在以下接口下的 OSGi 捆绑包中公开使用,以及一些额外的支持接口:
-
javax.transaction.TransactionManager
-
javax.transaction.UserTransaction
-
org.springframework.transaction.PlatformTransactionManager
-
org.ops4j.pax.transx.tm.TransactionManager
7.5.0.fuse-750035-redhat-00001
发布使这些接口在启动时可用。
pax-transx-tm-narayana
功能包含一个覆盖捆绑包,用于嵌入 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.
fuse-pax-transx-tm-narayana
捆绑包提供的服务有:
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]
由于此捆绑包注册 org.osgi.service.cm.ManagedService
,所以它会跟踪并响应 CM 配置中的更改:
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 ...
默认的 org.ops4j.pax.transx.tm.narayana
PID 为:
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.5.0.fuse-750035-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.5.0.fuse-750035-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.5.0.fuse-750035-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.5.0.fuse-750035-redhat-00001/etc/org.ops4j.pax.transx.tm.narayana.cfg service.pid = org.ops4j.pax.transx.tm.narayana
概述:
- 用于 Karaf 的 Fuse 包括 Narayana 事务管理器的全功能全球。
- 事务管理器在各种客户端接口(JTA、Spring-tx、PAX JMS)下正确公开。
-
您可以使用标准 OSGi 方法 Configuration Admin 来配置 Narayana,该方法可在
org.ops4j.pax.transx.tm.narayana
中提供。 -
默认配置在
$FUSE_HOME/etc/org.ops4j.pax.transx.tm.narayana.cfg
中提供。