Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-835

Create a JTA addon

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 2.0.0.M2
    • Component/s: PERSISTENCE
    • Labels:
      None

      Description

      Create a JTA addon to configure a standalone JTA tx manager like atomikos or jtom.
      Configuration helper should also be provided for JMS and database to use this JTA manager.
      An example of generated config would look like:

      <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" destroy-method="close" init-method="init">
      <property name="uniqueResourceName" value="XADBMS" />
      <property name="xaDataSourceClassName" value="com.microsoft.sqlserver.jdbc.SQLServerXADataSource" />
      <property name="maxPoolSize" value="5" />
      <property name="xaProperties">
      <props>
      <prop key="user">${database.username}</prop>
      <prop key="password">${database.password}</prop>
      <prop key="serverName">sql01</prop>
      <prop key="databaseName">test</prop>
      </props>
      </property>
      </bean>
      <tx:annotation-driven mode="aspectj" transaction-manager="jtaTransactionManager" />

      <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
      <property name="dataSource" ref="dataSource" />
      </bean>

      <bean class="org.springframework.transaction.jta.JtaTransactionManager" id="jtaTransactionManager">
      <property name="transactionManager">
      <bean class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close" />
      </property>
      <property name="userTransaction">
      <bean class="com.atomikos.icatch.jta.UserTransactionImp" />
      </property>
      </bean>

      <bean class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init" destroy-method="close" id="jmsConnectionFactory" >
      <property name="uniqueResourceName" value="amq1" />
      <property name="xaConnectionFactory">
      <bean class="org.apache.activemq.ActiveMQXAConnectionFactory">
      <property name="brokerURL" value="tcp://localhost:61616" />
      </bean>
      </property>
      <property name="maxPoolSize" value="10" />
      </bean>

      <!-- Spring JMS Template -->
      <bean class="org.springframework.jms.core.JmsTemplate" id="jmsTemplate">
      <property name="connectionFactory" ref="jmsConnectionFactory" />
      <property name="sessionTransacted" value="true" />
      <property name="defaultDestination" ref="myDestination" />
      </bean>

      <amq:queue id="myDestination" physicalName="myDestination" />

      <jms:listener-container connection-factory="jmsConnectionFactory" destination-type="queue" transaction-manager="jtaTransactionManager" acknowledge="transacted">
      <jms:listener destination="myDestination" method="onMessage" ref="myListener" />
      </jms:listener-container>
      <bean class="be.credoc.asf.jms.listen.MyListener" id="myListener" />

        Attachments

          Activity

            People

            Assignee:
            eruiz Enrique Ruiz (DiSiD)
            Reporter:
            schuer Bruno Schuermans
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: