Announcement Announcement Module
No announcement yet.
Transactions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transactions


    I want to

    * receive a jms message from 'myJmsQueue'
    * put it on the 'requestChannel' SI channel
    * process it in 'MyService.handleMessage(Message<String> message)'
    * put the result on 'resultChannel' SI channel
    * process it from there in 'MyResultService.handleMessage(Message<String> message)'
    * and put that output on the 'myJmsResultQueue'.

    Everything should happen in one JTA transaction. If anything fails, the db should rollback, and the jms message should be put on a dlq in jms.

    Is this possible with SI?

    How should I configure it using the namespace support in my applicationContext.xml? Where should I put my @Transactional annotations?



  • #2
    As long as you use <channels/> *without queues* between each endpoint, then the entire message flow will take place on the same thread. a transactional boundary can be established for a poller by adding the <transactional/> sub-element. For example, if you are using a polling inbound-channel-adapter for the JMS requests, this would be the basic idea:
    <jms:inbound-channel-adapter destination="myJmsQueue" channel="requestChannel"  ...>
            <interval-trigger interval="1000"/>
            <transactional transaction-manager="txManager"/>
    <service-activator input-channel="requestChannel" ref="myService" method="handleMessage" output-channel="resultChannel"/>
    <service-activator input-channel="resultChannel" ref="myResultService" method="handleMessage" output-channel="jmsOut"/>
    <jms:outbound-channel-adapter id="jmsOut" destination="myJmsResultQueue/>
    If your transactionManager bean is named "transactionManager", you can leave that attribute out.

    Let me know if you have more questions. Hope that helps.


    • #3
      where does one configure the transactionManagerBean? I mean where does it live, physically.


      • #4
        so JTA for DataBase will be

        <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
        <property name="jndiName" value="java:comp/env/jdbc/petclinic"/>

        <!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager"> <<<<--THIS WILL BE WebSphereUowTransactionManager for WAS
        <property name="dataSource" ref="dataSource"/>

        And for JMS?