Search code examples
javaapache-kafkaspring-kafka

What are the correct Springboot -Kafka parameters in application.yml?


Trying out a hands on with Springboot-Kafka. A couple of doubts. Are these valid parameters for Kafka tuning in application.yml:

fetch-max-bytes: 52428800

Any idea if this is a valid property on Kakfa? I am using it in application.yml in my springboot project to control my consumer polling behaviour. Secondly, in this block are there multiple threads launched internally by the KafkaListener:

@KafkaListener(id = "instance1", groupId = "${spring.kafka.consumer.group-id}", topics = "${spring.kafka.consumer.topic}")
    public void consume(String message) {
        System.out.println("Hellolistener ..."+message);
        log.info("container1 Message recieved from Kafka topic :{} ", message);
    }

Thanks in advance.


Solution

  • Without a prefix, those are just regular user-properties that you would need to wire in yourself via @Value

    You can find all spring.kafka properties in the Spring documentation

    That being said, the two properties you listed are not listed there, but that doesn't prevent you from creating your own ConsumerFactory where those properties could get added