<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Java Votary

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      48 隨筆 :: 1 文章 :: 80 評(píng)論 :: 0 Trackbacks

    對(duì)spring 了解的不夠精通,這兩天在解決jms異常的過程中發(fā)現(xiàn),spring中提供了jmsTrasactionManager,同樣實(shí)現(xiàn)了事務(wù)管理接口。這樣用 自動(dòng)的攔截器,就可以象數(shù)據(jù)庫一樣自動(dòng)控制事務(wù)。在同時(shí)配置了JMS和數(shù)據(jù)庫事務(wù)的時(shí)候,兩者同時(shí)有效。這樣系統(tǒng)的消息和數(shù)據(jù)庫事務(wù)就輕量級(jí)的一致了!

    數(shù)據(jù)庫的spring配置參見:http://steeven.cnblogs.com/archive/2005/06/14/174410.html
    jms部分如下:

        <bean id="remoteJmsConnectionFactory"
            class
    ="org.activemq.ActiveMQConnectionFactory">
            
    <property name="useEmbeddedBroker">
                
    <value>true</value>
            
    </property>
            
    <property name="brokerURL">
                
    <value>tcp://localhost:61616</value>
            
    </property>
        
    </bean>

        
    <bean id="jmsTM"
            class
    ="org.springframework.jms.connection.JmsTransactionManager">
            
    <property name="connectionFactory">
                
    <ref bean="remoteJmsConnectionFactory" />
            
    </property>
        
    </bean>

        
    <bean id="jmsTransactionInterceptor"
            class
    ="org.springframework.transaction.interceptor.TransactionInterceptor">
            
    <property name="transactionManager">
                
    <ref bean="jmsTM" />
            
    </property>
            
    <property name="transactionAttributeSource">
                
    <bean
                    
    class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource" />
            
    </property>
        
    </bean>

        
    <bean
            
    class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
            
    <property name="transactionInterceptor">
                
    <ref bean="jmsTransactionInterceptor" />
            
    </property>
        
    </bean>

        
    <bean id="destResolver"
            class
    ="test.message.EnumDestinationResolver" />

        
    <!-- for send jms to remote server -->
        
    <bean id="remoteJmsTemplate"
            class
    ="org.springframework.jms.core.JmsTemplate">
            
    <property name="connectionFactory">
                
    <ref bean="remoteJmsConnectionFactory" />
            
    </property>
            
    <property name="destinationResolver">
                
    <ref local="destResolver" />
            
    </property>
        
    </bean>

    應(yīng)用程序很簡(jiǎn)單
    @Transactional
    public class TestServiceImpl implements TestService {
        
    public void someMethod() {
            getJmsTemplate().send(someMessage);
        }

    }
    posted on 2005-12-13 23:49 Dion 閱讀(1389) 評(píng)論(0)  編輯  收藏 所屬分類: Springframework
    主站蜘蛛池模板: 亚洲人成网站在线观看青青| 亚洲国产精品自在线一区二区| 免费观看的毛片手机视频| 亚洲黄片毛片在线观看| 亚洲高清日韩精品第一区| 老司机精品视频免费| 精品成在人线AV无码免费看 | av无码免费一区二区三区| 免费在线观看黄网站| 亚洲视频一区在线| 91久久精品国产免费直播| 亚洲无砖砖区免费| 国产一级a毛一级a看免费视频| 我要看免费的毛片| 亚洲综合精品一二三区在线 | 中文字幕亚洲综合小综合在线 | 免费看污成人午夜网站| 亚洲AV无码乱码国产麻豆| 丁香六月婷婷精品免费观看 | 亚洲不卡无码av中文字幕| 亚洲 日韩 色 图网站| 久草免费手机视频| 超清首页国产亚洲丝袜| MM1313亚洲国产精品| 免费看污成人午夜网站| 亚洲AV无码资源在线观看| 日韩精品成人无码专区免费| 亚洲an天堂an在线观看| 永久免费av无码网站yy| 久久久久亚洲AV无码专区网站| 久久精品国产大片免费观看| 最新国产成人亚洲精品影院| 亚洲国产小视频精品久久久三级| 中国内地毛片免费高清| 亚洲国产精品久久人人爱| 两个人日本免费完整版在线观看1| 亚洲AV无码国产精品麻豆天美 | 成人永久福利免费观看| 亚洲国产一区二区三区在线观看| 美女视频黄的全免费视频网站| 色偷偷亚洲第一综合网|