Spring Boot environment listening to kafka topics(@KafkaListener / @StreamListener) Configured the listener factory to operate in batch mode:
ConcurrentKafkaListenerContainerFactory # setBatchListener
or via application.properties
:
spring.kafka.listener.type=batch
How to configure the framework so that given two numbers: N and T, it will try to fetch N records for the listener but won't wait more than T seconds, like described here: https://doc.akka.io/docs/akka/2.5/stream/operators/Source-or-Flow/groupedWithin.html
Some properties I've looked at:
max-poll-records
ensures you won't get more than N numbers in a batchfetch-min-size
get at least this amount of data in a fetch requestfetch-max-wait
but don't wait more than necessaryidleBetweenPolls
just sleep a bit between polls :)
It seems like fetch-min-size
combined with fetch-max-wait
should do it but they compare bytes, not messages/records.
It is obviously possible to implement that by hand, I'm looking whether it's possible to configure Spring to to that for me.