Home > Enterprise >  How do we define kafka request.timeout.ms property in spring kafka properties file
How do we define kafka request.timeout.ms property in spring kafka properties file

Time:11-30

I tried defining request.timeout.ms property in following 2 ways :-

application.properties

1. spring.kafka.consumer.request.timeout.ms=60000 
2. spring.kafka.consumer.request-timeout-ms=60000

but, when I'm starting the consumer service, I can see it is not overriding the value enter image description here

Is I'm defining property properly??? or need to add override property somewhere???

CodePudding user response:

spring.kafka.consumer.properties.request.timeout.ms=60000

For ConsumerProperties you could see here: https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/kafka/KafkaProperties.Consumer.html

If there are any Kafka consumer properties you could find in the above class, put it in properties.

CodePudding user response:

See https://docs.spring.io/spring-boot/docs/current/reference/html/messaging.html#messaging.kafka.additional-properties

The properties supported by auto configuration are shown in application-properties.html. Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Kafka dotted properties. See the Apache Kafka documentation for details.

The first few of these properties apply to all components (producers, consumers, admins, and streams) but can be specified at the component level if you wish to use different values. Apache Kafka designates properties with an importance of HIGH, MEDIUM, or LOW. Spring Boot auto-configuration supports all HIGH importance properties, some selected MEDIUM and LOW properties, and any properties that do not have a default value.

Only a subset of the properties supported by Kafka are available directly through the KafkaProperties class. If you wish to configure the producer or consumer with additional properties that are not directly supported, use the following properties:

spring.kafka.properties[prop.one]=first
spring.kafka.admin.properties[prop.two]=second
spring.kafka.consumer.properties[prop.three]=third
spring.kafka.producer.properties[prop.four]=fourth
spring.kafka.streams.properties[prop.five]=fifth
  • Related