我有一個消息驅動的通道適配器配置爲從確認設置爲事務的隊列中選擇消息。是否有可能發送不同的消息到下游的不同隊列中,持有相同的事務也在數據庫之間插入數據流?如果消息傳遞失敗到任何隊列,事務必須回滾(包括數據庫條目)以及消息發送到其他隊列。int-jms:消息驅動通道適配器和確認=「事務」
實施例:隊列(接收)---> Db的插入 - >發送至(隊列1,隊列2 ...等發送不同的消息給每個隊列)
如果任何發送調用用於隊列1失敗,隊列2等的交易應回滾..
我能夠做單隊列配置(即只有隊列1)。但如果涉及多個隊列並保持事務邊界,該怎麼辦。
由於 研究Vaidya
下面是配置
<int-jms:message-driven-channel-adapter
id="MessageDrivenAdapter" channel="injmsChannel" destination="testQ"
concurrent-consumers="5" max-concurrent-consumers="10" acknowledge="transacted"
error-channel="Error" />
<int:channel id="injmsChannel" />
<int:chain input-channel="injmsChannel" id="Chain1">
<int-jpa:retrieving-outbound-gateway
entity-class="entity.TestTable8"
entity-manager-factory="entityManagerFactory" id-expression="payload.getSno()">
<int-jpa:transactional transaction-manager="transactionManager" />
</int-jpa:retrieving-outbound-gateway>
<int:recipient-list-router id="ROUTE_1_2">
<int:recipient channel="SuccessChannel"
selector-expression="payload.getSno()==1" />
/> -->
</int:recipient-list-router>
</int:chain>
<int:channel id="SuccessChannel" />
<int:chain id="MessageProcessingChain" input-channel="SuccessChannel"
output-channel="putMsgChannel">
<int:service-activator id="a1" ref="taskexe"
method="processTable8_1" requires-reply="true" />
<int-jpa:retrieving-outbound-gateway
id="table7" entity-class="entity.TestTable7"
entity-manager-factory="entityManagerFactory" id-expression="payload.getSno()">
<int-jpa:transactional transaction-manager="transactionManager" />
</int-jpa:retrieving-outbound-gateway>
<int:service-activator id="a2" ref="taskexe"
method="processTable8_2" requires-reply="true" />
<int-jpa:updating-outbound-gateway
id="table6" entity-class="entity.TestTable6"
entity-manager-factory="entityManagerFactory" flush="true">
<int-jpa:transactional transaction-manager="transactionManager" />
</int-jpa:updating-outbound-gateway>
<int:service-activator id="a3" ref="taskexe"
method="processTable6_1" requires-reply="true" />
<int-jpa:updating-outbound-gateway
id="uptable6" entity-class="entity.TestTable6"
entity-manager-factory="entityManagerFactory" flush="true">
<int-jpa:transactional transaction-manager="transactionManager" />
</int-jpa:updating-outbound-gateway>
<int:service-activator id="a4" ref="taskexe"
method="processTable6_2" requires-reply="true" />
<int-jpa:updating-outbound-gateway
id="uptable4" entity-class="entity.TestTable4"
entity-manager-factory="entityManagerFactory" flush="true">
<int-jpa:transactional transaction-manager="transactionManager" />
</int-jpa:updating-outbound-gateway>
<int:service-activator ref="taskexe" method="processTable4_1"
requires-reply="true" />
</int:chain>
<int:channel id="putMsgChannel" />
<int-jms:outbound-channel-adapter id="sendsomemsg"
channel="putMsgChannel" connection-factory="connectionFactory"
session-transacted="true" destination-expression="headers['somequeue']" />
如何增加另一個INT-JMS:出站信道adapte用於具有消息驅動適配器的相同事務邊界其他隊列?此外flush = true已設置,以便消息不會傳遞到下游,如果有任何jpa適配器異常。
這裏的版主不允許你編輯我的答案,關於你的問題的更多細節;你需要改變你的問題(並對我的回答發表評論,以便我收到通知)。但是,我可以看到您的編輯,並且它沒有足夠的信息來幫助您進一步 - 您需要顯示* all *您的配置,包括消息驅動的適配器。 –