[英]Spring kafka integration properties for batch listener using application.yml/properties
I am trying to use kafka consumer batching in spring boot app.我正在尝试在 Spring Boot 应用程序中使用 kafka 消费者批处理。 I could see examples, where we have a kafka config class in which, KafkaListenerContainerFactory
is configured and我可以看到示例,其中我们有一个 kafka 配置类,其中配置了KafkaListenerContainerFactory
和
ConcurrentKafkaListenerContainerFactory.setBatchListener(true);
is enabled.已启用。 i am just wondering if this can be achieved without a factory class, ie by using spring kafka integration properties in application.yml.我只是想知道这是否可以在没有工厂类的情况下实现,即通过在 application.yml 中使用 spring kafka 集成属性。 Earlier i had defined a factory and replaced it with spring kafa integration properties via application.yml for concise code.早些时候我已经定义了一个工厂,并通过 application.yml 用 spring kafa 集成属性替换它以获得简洁的代码。 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.我试图了解后者是否有限制,并且最好使用配置类,因为我无法通过 application.yml 使用 spring kafa 集成属性实现批处理。 https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html I referred this doc to see available options. https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html我参考了这个文档来查看可用选项。
spring.kafka.listener.type=batch
(Vs. single
- the default). spring.kafka.listener.type=batch
(与single
-默认)。
The Boot documentation could use some improvement.引导文档可以使用一些改进。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.