Search code examples
apache-kafkaspring-kafka

Setting AuthExceptionRetryInterval property in Spring Kafka


I've got a Spring Boot application, which integrates the Spring Kafka project.

I'd like to set the AuthExceptionRetryInterval property in my application.properties.

It is being mentioned in https://docs.spring.io/spring-kafka/api/org/springframework/kafka/listener/ConsumerProperties.html

Although, I can't figure out the correct way to set it. I am not sure, if and how the "relaxed binding" of Spring interfers. Neither is the auto-completion of IntelliJ suggesting it. I am also not sure, on how to set Apache configs properly in a Spring environment.

It has to be done through a property, setting it through code is not the solution I am looking for.

Way's I've tried...

spring.kafka.consumer.properties.auth.exception.retry.interval=60ms

spring.kafka.listener.consumer.properties.auth.exception.retry.interval=60ms

spring.kafka.listener.consumer.auth.exception.retry.interval=60ms

Could anyone tell me what I need do wrong? Many thanks!


Solution

  • Just because a getter/setter exists doesn't mean it's a native Kafka property.

    Specifically, that property is not a Kafka client configuration, so cannot be passed though to the consumer via configuration.

    You could define your own autowired property, then call the setter in code using that value, instead.