IdleBetween 池未按指定提取消息 [英] IdleBetween pools not pulling Messages as specified
问题描述
我正在以批处理模式消费消息.我想每 250 毫秒从流中提取 8 条消息.
I am consuming messages in batch mode. I wanted to pull 8 messages each 250 ms from stream.
spring:
cloud:
stream:
kinesis:
bindings:
input:
consumer:
listenerMode: batch
idleBetweenPolls: 250
recordsLimit: 8
bindings:
input:
group: my-group
destination: stream
content-type: application/json
我已将大约 100 条消息推送到流中,然后我启动了消费者.
I have pushed around 100 messages on to stream, and I started the consumer.
根据配置,我应该每 250 毫秒提取一次消息.但是轮询器不会每 250 毫秒拉取一次消息.
As per configuration, I am supposed to pull messages each 250 ms. But the poller not pulling messages each 250 ms.
@StreamListener(Sink.INPUT)
public void receiveMessage(Message<List<byte[]>> messages) {
log.info("Total received messages: " + messages.getPayload().size());
}
2019-04-27 12:04:40.145 : Total received messages: 8
2019-04-27 12:04:41.604 : Total received messages: 8
2019-04-27 12:04:43.167 : Total received messages: 8
2019-04-27 12:04:44.618 : Total received messages: 8
2019-04-27 12:04:46.145 : Total received messages: 8
2019-04-27 12:04:47.775 : Total received messages: 8
2019-04-27 12:04:49.211 : Total received messages: 8
2019-04-27 12:04:50.756 : Total received messages: 8
2019-04-27 12:04:52.283 : Total received messages: 8
2019-04-27 12:04:53.817 : Total received messages: 8
我什至没有处理任何事情.它只是日志.
I am not even processing anything at all. Its just log.
每条消息之间的时间超过 250 毫秒.我是不是错过了什么.
The time between each messages are more than 250 ms. Am I missing anything.
推荐答案
250 ms 对于实际用例没有意义.也许您可以将间隔增加到 5 秒并尝试一下.
250 ms is not meaningful for realistic use case. Maybe you could increase interval to 5 second and give a try.
这篇关于IdleBetween 池未按指定提取消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!