You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by MarkS1900 <ma...@yahoo.com.au> on 2012/01/13 22:58:13 UTC
ServiceMix 4.4.0 (OSGi) + Blueprint + JTA/XA + Atomikos
I have some tests that seem to demonstrate that the below Blueprint xml
configuration does not enabled JTA/XA (Microsoft SqlServer + Apache
ActiveMq) as expected. I am expecting that if an Java Exception is thrown
and bubbles up through the container that the transaction gets rolled-back.
Does anyone have any ideas as to why I might be having issues with
Transaction Management?
<atomikos.version>3.7.0</atomikos.version>
<activemq.version>5.5.1</activemq.version>
<camel.version>2.8.3</camel.version>
<microsoft.sql-jdbc.version>3.0.1301</microsoft.sql-jdbc.version>
<slf4j.version>1.6.1</slf4j.version>
<spring.version>3.0.6.RELEASE</spring.version>
<spring.osgi.version>1.2.1</spring.osgi.version>
===================================================================
bundle/src/main/resources/OSGI-INF/blueprint/resource-context.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cm:property-placeholder persistent-id="resources"
update-strategy="reload">
<cm:default-properties>
<cm:property name="dbServerName" value="localhost" />
<cm:property name="dbServerPort" value="1433" />
<cm:property name="dbName" value="theDatbaseName" />
<cm:property name="dbUser" value="theDatabaseUser" />
<cm:property name="dbPassword" value="theDatabasePassword" />
<cm:property name="dbMaxConnectionPoolSize" value="30" />
</cm:default-properties>
</cm:property-placeholder>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="transactionManager" ref="jtaTransactionManager"/>
<property name="cacheLevelName" value="CACHE_NONE"/>
<property name="transacted" value="true"/>
</bean>
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="transactionManager" ref="jtaTransactionManager"/>
<property name="cacheLevelName" value="CACHE_NONE"/>
<property name="transacted" value="true"/>
</bean>
<bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="jdbc" class="org.apache.camel.component.jdbc.JdbcComponent">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="atomikosTransactionManager"
class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init"
destroy-method="close" >
<property name="forceShutdown" value="false" />
</bean>
<bean id="atomikosUserTransaction"
class="com.atomikos.icatch.jta.UserTransactionImp" >
<property name="transactionTimeout" value="150" />
</bean>
<bean id="jtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="atomikosTransactionManager"
/>
<property name="userTransaction" ref="atomikosUserTransaction" />
<property name="allowCustomIsolationLevels" value="true" />
</bean>
<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="jtaTransactionManager" />
<property name="transactionTemplate" ref="transactionTemplate" />
<property name="propagationBehaviorName"
value="PROPAGATION_REQUIRED" />
</bean>
<bean id="transactionTemplate"
class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager" ref="jtaTransactionManager" />
<property name="isolationLevelName"
value="ISOLATION_REPEATABLE_READ"/>
</bean>
<bean id="jmsXaConnectionFactory"
class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
<property name="redeliveryPolicy">
<bean class="org.apache.activemq.RedeliveryPolicy">
<property name="initialRedeliveryDelay" value="1000"/>
<property name="backOffMultiplier" value="5"/>
<property name="useExponentialBackOff" value="true"/>
<property name="maximumRedeliveries" value="6"/>
</bean>
</property>
</bean>
<bean id="atomikosConnectionFactory"
class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init"
destroy-method="close">
<property name="uniqueResourceName" value="amq1" />
<property name="xaConnectionFactory" ref="jmsXaConnectionFactory" />
<property name="localTransactionMode" value ="false" />
<property name="maxPoolSize" value="${dbMaxConnectionPoolSize}" />
</bean>
<bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean">
<property name="uniqueResourceName" value="ds1" />
<property name="testQuery" value="select 1" />
<property name="xaDataSource" ref="sqlServerXADataSource" />
</bean>
<bean id="sqlServerXADataSource"
class="com.microsoft.sqlserver.jdbc.SQLServerXADataSource">
<property name="serverName" value="${dbServerName}" />
<property name="portNumber" value="${dbServerPort}" />
<property name="selectMethod" value="cursor" />
<property name="databaseName" value="${dbName}" />
<property name="user" value="${dbUser}" />
<property name="password" value="${dbPassword}" />
</bean>
</blueprint>
===================================================================
--
View this message in context: http://servicemix.396122.n5.nabble.com/ServiceMix-4-4-0-OSGi-Blueprint-JTA-XA-Atomikos-tp5143855p5143855.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.