IdleBetween pools not pulling Messages as specifie

2019-08-17 14:22发布

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

I have pushed around 100 messages on to stream, and I started the consumer.

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.

The time between each messages are more than 250 ms. Am I missing anything.

1条回答
趁早两清
2楼-- · 2019-08-17 14:33

250 ms is not meaningful for realistic use case. Maybe you could increase interval to 5 second and give a try.

查看更多
登录 后发表回答