'Spring kafka integration properties for batch listener using application.yml/properties

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 1:[1]

spring.kafka.listener.type=batch (Vs. single - the default).

The Boot documentation could use some improvement.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gary Russell