當然,發送後立即發送預發送 - 將消息轉儲到隊列中非常快。
過濾器在任務執行程序線程上調用,而不是發送線程。
您將在DEBUG級別看到一個preReceive
日誌(在TRACE級別)和postReceive
。
編輯:
我只是跑,沒有任何問題的測試...
<int:channel id="foo">
<int:queue/>
</int:channel>
<int:filter input-channel="foo" output-channel="toRabbit" expression="true">
<int:poller fixed-delay="2000" />
</int:filter>
10:29:53.792 TRACE [task-scheduler-1][org.springframework.integration.channel.QueueChannel] preReceive on channel 'foo'
10:29:53.795 DEBUG [task-scheduler-4][org.springframework.integration.endpoint.SourcePollingChannelAdapter] Poll resulted in Message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]
10:29:53.795 DEBUG [task-scheduler-4][org.springframework.integration.channel.QueueChannel] preSend on channel 'foo', message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]
10:29:53.795 DEBUG [task-scheduler-4][org.springframework.integration.channel.QueueChannel] postSend (sent=true) on channel 'foo', message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]
10:29:53.795 DEBUG [task-scheduler-1][org.springframework.integration.channel.QueueChannel] postReceive on channel 'foo', message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]
10:29:53.795 DEBUG [task-scheduler-1][org.springframework.integration.endpoint.PollingConsumer] Poll resulted in Message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]
10:29:53.796 DEBUG [task-scheduler-1][org.springframework.integration.filter.MessageFilter] [email protected] received message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]
好吧,我明白你的意思,但過濾器不會被觸發的。當我添加一個服務激活器時,它會在收到消息後立即觸發。 – yuranos87
必須有別的事情在進行; 「過濾器」與任何消費端點沒有區別。我只是進行了一個沒有問題的測試。將用我的結果編輯答案。 –