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

Spring for Apache Kafka: Unrecognized producer configuration - 'delivery.timeout.ms'

我有一个 spring 启动应用程序,其中 Spring 用于 Apache Kafka 用于向 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

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

您的 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 客户端库。