Reputation: 1727
We are using spring-kafka-2.2.7.RELEASE to produce and consume avro messages and using schema registry for schema validation with 'FORWARD_TRANSITIVE' as the compatibility type. Now, I'm trying to understand if there is an option to set a custom value to the producer configuration 'delivery.timeout.ms'?
Upvotes: 0
Views: 2347
Reputation: 7980
Following the answer from Gary Russel, the way to add delivery.timeout.ms
config is by adding:
spring:
kafka:
properties:
delivery:
timeout:
ms: 123456
To your application configuration file (application.yaml/properties).
Upvotes: 0
Reputation: 174554
If you are not using Spring Boot, you can simply set the property in your producer configuration map used to create the producer factory.
If you are using Spring Boot (please add the spring-boot tag in future), see the Boot documentation about spring-kafka integration.
The properties supported by auto configuration are shown in appendix-application-properties.html. Note that, for the most part, these properties (hyphenated or camelCase) map directly to the Apache Kafka dotted properties. Refer to 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
This sets the common prop.one Kafka property to first (applies to producers, consumers and admins), the prop.two admin property to second, the prop.three consumer property to third, the prop.four producer property to fourth and the prop.five streams property to fifth.
Upvotes: 3