我试图在我的项目中添加一个producer配置,下面使用spring集成和kafka。
因为我找不到地方放它,我想我应该把它添加到我的application.properties下:
spring.cloud.stream.kafka.bindings.output.producer.configuration
但是,我无法使用以下任何格式编译代码:
spring.cloud.stream.kafka.bindings.output.producer.configuration=request.timeout.ms=100000
spring.cloud.stream.kafka.bindings.output.producer.configuration={'request.timeout.ms':'100000'}
spring.cloud.stream.kafka.bindings.output.producer.configuration={"request.timeout.ms":"100000"}
spring.cloud.stream.kafka.bindings.output.producer.configuration=request.timeout.ms:100000
我总是犯这样的错误:
Binding to target org.springframework.cloud.stream.binder.kafka.KafkaExtendedBindingProperties@104392ba failed:
Property: spring.cloud.stream.kafka.bindings[output].producer.configuration
Value: request.timeout.ms:100000
Reason: Failed to convert property value of type 'java.lang.String' to required type 'java.util.Map' for property 'bindings[output].producer.configuration'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.util.Map' for property 'configuration': no matching editors or conversion strategy found
你知道如何将这个配置实现给生产者吗?
1条答案
按热度按时间pjngdqdw1#
应按以下方式使用:
spring.cloud.stream.kafka.bindings.output.producer.configuration.request.timeout.ms=100000
配置名称应后跟spring.cloud.stream.kafka.bindings.<binding name>.producer.configuration
前缀这样,您可以添加任意数量的配置。