用于Apache Kafka的Spring:无法识别的生产者配置-'delivery.timeout.ms'

问题描述 投票:0回答:1

我有一个Spring Boot应用程序,带有用于Apache Kafka的Spring,用于将消息发送到kafka集群上的主题。我为[delivery.timeout.ms自动连接了一个属性,在启动应用程序并配置了生产者之后,应用程序日志显示未设置该属性的值,并发出警告:"WARN [task-scheduler-1] org.apache.kafka.clients.producer.ProducerConfig [] --- The configuration 'delivery.timeout.ms' was supplied but isn't a known config"

我已经检查了我的POM并确认我正在使用以下两个依赖项:

<dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
            <version>2.2.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-clients</artifactId>
            <version>2.1.0</version>
        </dependency>

我还确认该属性存在于版本2.1.0中:https://kafka.apache.org/21/javadoc/org/apache/kafka/clients/producer/ProducerConfig.html

[我看到带有其他属性类似警告的帖子,其中提到可以忽略该属性;但是,我的应用程序遇到了不良行为,可以通过根据其描述设置此属性来纠正此错误。

java apache-kafka spring-kafka kafka-producer-api
1个回答
0
投票

似乎您的kafka-clients版本覆盖无效。我刚刚对其进行了测试,并且工作正常(使用spring-kafka 2.2.9和2.1.1客户端):

ProducerConfig values: 
    acks = 1
    batch.size = 16384
    bootstrap.servers = [localhost:9092]
    buffer.memory = 33554432
    client.dns.lookup = default
    client.id = 
    compression.type = none
    connections.max.idle.ms = 540000
    delivery.timeout.ms = 123456
    enable.idempotence = false
    ...

尝试使用instructions in the Spring for Apache Kafka reference manual覆盖所有kafka客户端库。

© www.soinside.com 2019 - 2024. All rights reserved.