Search code examples
javaapache-kafkaspring-kafkakafka-producer-api

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


I have a spring boot application with Spring for Apache Kafka being used to send messages to topics on a kafka cluster. I've autowired a property for delivery.timeout.ms and after the application starts and the producer is configured, the application logs show the property's value was not set and it gives the warning: "WARN [task-scheduler-1] org.apache.kafka.clients.producer.ProducerConfig [] --- The configuration 'delivery.timeout.ms' was supplied but isn't a known config"

I've checked my POM and confirmed that I'm using the following two dependencies:

<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>

I've also confirmed that the property existed in version 2.1.0: https://kafka.apache.org/21/javadoc/org/apache/kafka/clients/producer/ProducerConfig.html

I see posts with a similiar warning for other properties mentioning that it can be ignored; however, my application is experiencing undesirable behavior which could be corrected by setting this property based on its description.


Solution

  • Looks like your kafka-clients version override is not working. I just tested it and it worked fine (with spring-kafka 2.2.9 and the 2.1.1 clients):

    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
        ...
    

    Try following the instructions in the Spring for Apache Kafka reference manual for overriding all the kafka client libraries.