1.
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManager"> <bean class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close"> <property name="forceShutdown"> <value>true</value> </property> <property name="transactionTimeout"> <value>600</value> </property> </bean> </property> <property name="userTransaction"> <bean class="com.atomikos.icatch.jta.UserTransactionImp" /> </property> </bean> <bean id="dataSource" class="com.springsource.open.db.AtomikosDataSourceFactoryBean"> <property name="uniqueResourceName" value="data-source" /> <property name="xaDataSource"> <bean class="test.jdbc.datasource.DerbyDataSourceFactoryBean"> <property name="databaseName" value="derbydb" /> </bean> </property> <property name="exclusiveConnectionMode" value="true" /> <property name="connectionPoolSize" value="1" /> </bean> <bean id="otherDataSource" class="com.springsource.open.db.AtomikosDataSourceFactoryBean"> <property name="uniqueResourceName" value="other-data-source" /> <property name="xaDataSource"> <bean class="test.jdbc.datasource.DerbyDataSourceFactoryBean"> <property name="databaseName" value="otherdb" /> </bean> </property> <property name="exclusiveConnectionMode" value="true" /> <property name="connectionPoolSize" value="1" /> </bean>
2.
<bean id="brokerService" class="org.apache.activemq.broker.BrokerService" init-method="start" destroy-method="stop"> <property name="brokerName" value="broker" /> <!-- Enable this if you need to inspect with JMX --> <property name="useJmx" value="false" /> <property name="transportConnectorURIs"> <list> <value>vm://localhost</value> </list> </property> <property name="persistenceAdapter"> <bean class="org.apache.activemq.store.jdbc.JDBCPersistenceAdapter"> <property name="dataSource"> <bean class="com.springsource.open.jms.JmsTransactionAwareDataSourceProxy"> <property name="targetDataSource" ref="dataSource"/> <property name="jmsTemplate" ref="jmsTemplate"/> </bean> </property> <property name="createTablesOnStartup" value="true" /> </bean> </property> </bean>
3.
<bean id="connectionFactory" class="org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy"> <property name="targetConnectionFactory"> <bean class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="brokerService"> <property name="brokerURL" value="vm://localhost"/> </bean> </property> <property name="synchedLocalTransactionAllowed" value="true" /> </bean>
时间: 2024-10-11 13:03:14