[英]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.ZFC3562883A
我看到其他屬性的類似警告的帖子提到它可以被忽略; 但是,我的應用程序遇到了不良行為,可以通過根據其描述設置此屬性來糾正這種行為。
看起來您的 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
...
嘗試按照Spring for Apache Kafka 參考手冊中的說明來覆蓋所有 kafka 客戶端庫。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.