鑒于設定https://gist.github.com/gel-hidden/0a8627cf93f5396d6b73c2a6e71aad3e,我希望當我發送一條訊息時ServiceActivator會在訊息之間延遲 10 000 次呼叫。
第一個通道接收一個串列,然后拆分訊息,然后呼叫另一個QueueChannel。但由于某種原因,每次拉取都會輪詢所有拆分訊息。我知道我錯過了一些愚蠢的東西,或者我太愚蠢了,無法理解發生了什么。
相關測驗用例:https ://gist.github.com/gel-hidden/de7975fffd0853ec8ce49f9d6fa6531d
輸出:
2022-10-26 15:22:02.708 INFO 78647 --- [ scheduling-1] com.example.demo.DemoApplicationTests : Received message Hello
2022-10-26 15:22:02.708 INFO 78647 --- [ scheduling-1] com.example.demo.UpdateLocationFlow : Doing some work for model with id 2
2022-10-26 15:22:03.009 INFO 78647 --- [ scheduling-1] com.example.demo.UpdateLocationFlow : Completed some work for model with id 2
2022-10-26 15:22:03.017 INFO 78647 --- [ scheduling-1] com.example.demo.DemoApplicationTests : Received message World
2022-10-26 15:22:03.018 INFO 78647 --- [ scheduling-1] com.example.demo.UpdateLocationFlow : Doing some work for model with id 3
2022-10-26 15:22:03.319 INFO 78647 --- [ scheduling-1] com.example.demo.UpdateLocationFlow : Completed some work for model with id 3
2022-10-26 15:22:04.322 INFO 78647 --- [ scheduling-1] o.s.i.a.AggregatingMessageHandler : Expiring MessageGroup with correlationKey[1]
我的想法是訊息應該是這樣的:
- 00:01 為 id 為 2 的模型做一些作業
- 00:02 為 id 2 的模型完成了一些作業
- 00:12 為 id 3 的模型做一些作業
- 00:13 為模型 it id 3 完成了一些作業
uj5u.com熱心網友回復:
因此,這是 Spring Integration 中圍繞生命周期管理進行IntegrationFlowAdapter管理的一個錯誤。它只開始兩次。
作為一種解決方法,我建議您@ServiceActivator handle()使用自己的@Poller配置和一個單獨的組件inputChannel和outputChannel. 換句話說, int 必須超出您的UpdateLocationFlow. 這樣,IntegrationFlowAdapter將無法控制其生命周期,也不會啟動它兩次。
同時我正在尋找如何解決它。
感謝您報告此事!
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/520503.html
標籤:春天弹簧集成
上一篇:在進行時觸發aws粘合作業
