Announcement Announcement Module
Collapse
No announcement yet.
XA transaction using Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XA transaction using Spring

    Hi,

    I have a requirement that a DB2 database update operation and send message using JMS to be handled in one transaction.

    I use websphere MQ to send messages.

    How can I declaratively specify the transaction boundary in the spring config file ?

    Thanks in advnace,

    Yasser

  • #2
    Like any other transaction. You only need to make sure you use JTA/XA able transaction manager.

    Comment


    • #3
      And that you use XA enabled datasources/jms connections.

      Comment


      • #4
        So all I need to do is
        1) Make MQ and Datasource , XA enabled in the Application server console
        2) Use the following bean configuration. Can you please validate this. I have to make a presentation on this and dont have the resources to try it out.

        <bean id="XATransManager"
        class="org.springframework.transaction.jta.JtaTran sactionManager" />

        <bean id="TestXA"
        class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
        <property name="transactionManager">
        <ref bean="XATransManager" />
        </property>
        <property name="target">
        <ref bean="SomeBeanUpdatingDBAndSendingMessage" />
        </property>
        <property name="transactionAttributes">
        <props>
        <prop key="saveAndSend">
        PROPAGATION_REQUIRED, -Exception
        </prop>
        </props>
        </property>
        </bean>

        Comment


        • #5
          That should do it. You might however also take a look at the WebSphereTransactionManagerFactoryBean which was designed and certified for Websphere. This is ofcourse only needed if you need some sort of Transaction suspending/resuming (REQUIRES_NEW, NOT_SUPPORTED).

          Comment


          • #6
            Thanks a lot.

            Comment

            Working...
            X