2014-10-27 30 views
0

My Spring Integration Xml。春季整合:如何在一次交易中處理多個訂戶?

<int:channel id="request-write-to-PMSQueueChannel" > 
    <int:queue message-store="channelStore" /> 
</int:channel> 
<int:bridge input-channel="request-write-to-PMSQueueChannel" output-channel="writetoPMSChannel"> 
    <int:poller fixed-rate="5000" max-messages-per-poll="-1"> 
     <int:transactional propagation="REQUIRED" transaction-manager="transactionManager"/> 
    </int:poller> 
</int:bridge> 
<int:channel id="redBlue-error-channel"/> 
<int:service-activator id="errorServiceActivator" input-channel ="redBlue-error-channel"> 
       <bean id="errorSVC" 
      class="com.sds.redBlue.core.module.analyzer.sample.ErrorServiceActivator"/> 
</int:service-activator> 
<bean id="channelStore" class="org.springframework.integration.jdbc.store.JdbcChannelMessageStore"> 
    <property name="dataSource" ref="dataSource" /> 
    <property name="channelMessageStoreQueryProvider" ref="queryProvider" /> 
</bean> 
<bean id="queryProvider" class="org.springframework.integration.jdbc.store.channel.DerbyChannelMessageStoreQueryProvider"/> 
<int:publish-subscribe-channel id="writetoPMSChannel" ignore-failures = "false"/> 

<int:chain input-channel="writetoPMSChannel" 
    output-channel="writetoPMS001Channel"> 
    <int:service-activator method="exectue"> 
     <bean id="" 
      class="com.sds.redBlue.core.module.analyzer.convert.ModelingConvertSVC"> 
     </bean> 
    </int:service-activator> 
    <int:splitter ref="fromListToRowSplitter" /> 
</int:chain> 

<int:chain input-channel="writetoPMSChannel" 
    output-channel="writetoPMS002Channel"> 
    <int:service-activator method="exectue002"> 
     <bean id="" 
      class="com.sds.redBlue.core.module.analyzer.convert.ModelingConvertSVC"> 
     </bean> 
    </int:service-activator> 
    <int:splitter ref="fromListToRowSplitter" /> 
</int:chain> 

<int:chain input-channel="writetoPMSChannel" 
    output-channel="writetoPMS003Channel"> 
    <int:service-activator method="exectue003"> 
     <bean id="" 
      class="com.sds.redBlue.core.module.analyzer.convert.ModelingConvertSVC"> 
     </bean> 
    </int:service-activator> 
    <int:splitter ref="fromListToRowSplitter" /> 
</int:chain> 

<int:chain input-channel="writetoPMSChannel" 
    output-channel="writetoPMS004Channel"> 
    <int:service-activator method="exectue004"> 
     <bean id="" 
      class="com.sds.redBlue.core.module.analyzer.convert.ModelingConvertSVC"> 
     </bean> 
    </int:service-activator> 
    <int:splitter ref="fromListToRowSplitter" /> 
</int:chain> 

<int:chain input-channel="writetoPMSChannel" 
    output-channel="writetoPMS005Channel"> 
    <int:service-activator method="exectue005"> 
     <bean id="" 
      class="com.sds.redBlue.core.module.analyzer.convert.ModelingConvertSVC"> 
     </bean> 
    </int:service-activator> 
    <int:splitter ref="fromListToRowSplitter" /> 
</int:chain> 

我想要5個訂閱者必須立即執行,或者如果一個訂閱拋出任何異常,必須回滾。但我無法找到解決的辦法。

相關文章: Pub-Sub error handling strategy

我已經問與生態工業園模式PIC和加里幫助。但是,我被困住了。 (Spring Integration : How to guarantee the transaction two more jdbc-outbound-gateway?

回答

0

由於交易限於線程,因此您應確保所有訂戶都使用相同的直接流量。在這種情況下,它們將被逐一調用。

但是我看到您使用ignore-failures = "false"。你忽略了所有的下游異常,並允許你的用戶做他們的工作。當然,儘管你失去了TX回滾。

因此,如果您真的想要自動返回,請修改您的用例。

async控制TX的技巧,但它有點複雜,需要一些邏輯與aggregator

+0

謝謝你的回覆。就像你所說的那樣,這個交易是和線程有關的。你的意思是我用其他的東西來代替發佈 - 訂閱頻道的同一個直接流程?如果您對異步技巧進行更詳細的解釋,我將非常感激。 – verystrongjoe 2014-10-27 11:01:24