Issue
I am trying to use kafka consumer batching in spring boot app. I could see examples, where we have a kafka config class in which, KafkaListenerContainerFactory
is configured and
ConcurrentKafkaListenerContainerFactory.setBatchListener(true);
is enabled. i am just wondering if this can be achieved without a factory class, i.e by using spring kafka integration properties in application.yml. Earlier i had defined a factory and replaced it with spring kafa integration properties via application.yml for concise code. I am trying to understand if the latter has limitations and usage of a config class is preferable, as i am unable to achieve batching using spring kafa integration properties via application.yml. https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html I referred this doc to see available options.
Solution
spring.kafka.listener.type=batch
(Vs. single
- the default).
The Boot documentation could use some improvement.
Answered By - Gary Russell
Answer Checked By - Terry (JavaFixing Volunteer)