1
我正在使用分離器來拆分消息並將其傳遞到相應的其他通道進行進一步處理。彈簧分離器輸出到多個通道
但我想將分離器輸出發送到一個通道,將其寫入另一個文件。還希望將分離器輸出發送到將執行一些任務的另一個通道。
我可以通過使用下面的方法來做同樣的事情,但是如果無法處理channel2中的任何分割記錄,似乎不能工作。它停止進程並且不寫入channel1中的剩餘記錄。
<int:splitter input-channel="inputchannel" ref="splitter" method="doSplit" output-channel="routingChannel"/>
<int-recipient-list-router id="customRouter" input-channel="routingChannel"
<int:recipient channel="channel1"/> <!--Write to file-->
<int:recipient channel="channel2"/> <!-- logic to process -->
</int:reciepient-list-router>
是否有任何其他方式我可以將它傳遞到單獨的獨立通道。
阿爾喬姆感謝您的答覆。如果我們添加忽略發送失敗,但是channel1正在完成,雖然在channel2中發生了任何異常。但是然後控制不會進入錯誤通道.. :( – kattoor
好的。您可以將''channel放置在'splitter'和'router',然後在路由器的''上加上'error-channel',但是應該關掉ignore-send-failure。這樣,通過隊列,你可以從異常中釋放splitter線程,繼續發出 –
非常感謝Artem。我試着用下面的任務執行器,它工作:)希望和做同樣的工作? int:channel> ' –
kattoor