Spring Kafka- When is exactly Consumer.poll() called behind the hood?

前端 未结 2 655
耶瑟儿~
耶瑟儿~ 2021-01-15 08:13

I have a spring boot application in which I have single Kafka Consumer.

I am using a DefaultKafkaConsumerFactory with default Consumer Configurations. I have a Concu

2条回答
  •  太阳男子
    2021-01-15 08:19

    In 1.3 and above there is a single thread per consumer; the next poll() is performed after the last message from the previous poll has been processed by the listener.

    In earlier versions, there were two threads and a second (and possibly third) poll was performed while the listener thread is processing the first batch. This was required to avoid a rebalance due to a slow listener. The threading model was very complicated and we had to pause/resume the consumer when necessary. KIP-62 fixed the rebalance problem so we were able to use the much simpler threading model in use today.

提交回复
热议问题