我在Spring集成中遇到了一些基本問題。我嘗試在其他線程中搜索,但對答案不滿意。所以這是我的問題。任何提示將不勝感激。
我想從4個不同的來源並行獲取數據並聚合數據。
我的理解(根據我之前閱讀的其中一個線程),分離器的任何輸出通道如果是直接通道,則請求將按順序路由。
但是Splitter的輸出通道是一個接收者列表路由器。當我調試請求被順序路由。所以經過一些分析,我發現我們可以使用有效載荷類型的路由器並行處理。
因此,我將路由器更改爲有效載荷類型的路由器,並且請求仍按順序路由。
所以我改變了我的策略,並使用發佈訂戶頻道,並將所有訂閱頻道的輸出連接到聚合器,以便我可以彙總結果。我能夠並行採集數據,但我沒有看到響應被路由到聚合。我做錯了嗎?請建議!
Spring集成聚合器與發佈訂閱者相結合
<int:publish-subscribe-channel id="PublishSubscriberChannel"
task-executor="taskExecutor" />
<task:executor id="taskExecutor" pool-size="5" />
<int:service-activator input-channel="PublishSubscriberChannel"
ref="lookUpService" method="lookupSource1" output-channel="lookupAggregatorChannel" />
<int:service-activator input-channel="PublishSubscriberChannel"
ref="lookUpService" method="lookupSource2" output-channel="lookupAggregatorChannel" />
<int:service-activator input-channel="PublishSubscriberChannel"
ref="lookUpService" method="getVehicleInfoWithAdditionalAttributes"
output-channel="lookupAggregatorChannel" />
<int:service-activator input-channel="PublishSubscriberChannel"
ref="lookUpService" method="lookupSource4" output-channel="lookupAggregatorChannel" />