Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 滤波可轮询信道_Java_Spring Integration - Fatal编程技术网

Java 滤波可轮询信道

Java 滤波可轮询信道,java,spring-integration,Java,Spring Integration,我有一个可轮询的通道和一个过滤器就在它的下游。是否可以使用过滤器轮询此类通道,或者我是否应该在两者之间使用一些中间组件(我选中了service activator。它至少可以接受可轮询通道,但可能有更好的选项,如某些网关): 当然,post-send紧跟在pre-send之后-将消息转储到队列中的速度非常快 筛选器是在任务执行器线程而不是发送线程上调用的 您将看到preReceive日志(在跟踪级别)和postceive在调试级别 编辑: 我只是做了个测试,没有问题 <int:channe

我有一个可轮询的通道和一个过滤器就在它的下游。是否可以使用过滤器轮询此类通道,或者我是否应该在两者之间使用一些中间组件(我选中了service activator。它至少可以接受可轮询通道,但可能有更好的选项,如某些网关):


当然,post-send紧跟在pre-send之后-将消息转储到队列中的速度非常快

筛选器是在任务执行器线程而不是发送线程上调用的

您将看到
preReceive
日志(在跟踪级别)和
postceive
在调试级别

编辑:

我只是做了个测试,没有问题

<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] org.springframework.integration.filter.MessageFilter@2ecd0256 received message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]

10:29:53.792跟踪[task-scheduler-1][org.springframework.integration.channel.QueueChannel]通道“foo”上的预接收
10:29:53.795调试[task-scheduler-4][org.springframework.integration.endpoint.SourcePollingChannelAdapter]轮询导致消息:[有效负载字符串内容=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc,时间戳=1429090193794}]
10:29:53.795调试[task-scheduler-4][org.springframework.integration.channel.QueueChannel]在通道“foo”上显示,消息:[有效负载字符串内容=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc,时间戳=1429090193794}]
10:29:53.795调试[task-scheduler-4][org.springframework.integration.channel.QueueChannel]postSend(sent=true)在通道“foo”上,消息:[有效负载字符串content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc,时间戳=1429090193794}]
10:29:53.795调试[task-scheduler-1][org.springframework.integration.channel.QueueChannel]postReceive在通道“foo”上,消息:[有效负载字符串内容=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc,时间戳=1429090193794}]
10:29:53.795调试[task-scheduler-1][org.springframework.integration.endpoint.PollingConsumer]轮询产生消息:[有效负载字符串内容=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc,时间戳=1429090193794}]
10:29:53.796调试[task-scheduler-1][org.springframework.integration.filter.MessageFilter]org.springframework.integration.filter。MessageFilter@2ecd0256收到的消息:[有效负载字符串内容=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc,时间戳=1429090193794}]

好的,我明白你的意思,但过滤器根本没有触发。当我添加服务激活器时,它几乎在收到消息后立即触发;
过滤器
与任何消费端点没有区别。我只是做了个测试,没有问题。将用我的结果编辑答案。
<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] org.springframework.integration.filter.MessageFilter@2ecd0256 received message: [Payload String content=xxx][Headers={id=9b5bf399-a137-daec-58bd-7cf7216d3dfc, timestamp=1429090193794}]