英文:
Spring Cloud Stream - Give Serdes to Individual Consumers/Producers
问题
我正在尝试在每个消费者上单独放置Serdes,而不是全部放置。例如,这会将Avro Deserializer 添加到我应用程序中的所有消费者。我只想在一个消费者上使用它。
spring.cloud.stream.kafka.binder.consumerProperties.value.deserializer=io.confluent.kafka.serializers.KafkaAvroDeserializer
如果我像这样做,它可以工作。
spring.cloud.stream.bindings.scheduler-in-from-external-event.content-type=application/*+avro
但似乎没有一种方法可以为单个消费者/生产者指定Serde,即
spring.cloud.stream.kafka.binder.scheduler-in-from-external-event.consumer.configuration.key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.cloud.stream.kafka.binder.scheduler-in-from-external-event.consumer.configuration.value.deserializer=io.confluent.kafka.serializers.KafkaAvroDeserializer
这种方法不起作用,我是否缺少依赖项,还是有人可以指导我在属性文件中为单个生产者/消费者指定Serde的方法?
英文:
I am trying to put individual Serdes on each of my consumers, not all of them. For instance this adds Avro Deserializer to all consumers in my application. I only want it on one consumer
spring.cloud.stream.kafka.binder.consumerProperties.value.deserializer=io.confluent.kafka.serializers.KafkaAvroDeserializer
If I do something like this it works
spring.cloud.stream.bindings.scheduler-in-from-external-event.content-type=application/*+avro
but there doesn't seem to be a way to specify a Serde for a single consumer/producer, i.e.
spring.cloud.stream.kafka.binder.scheduler-in-from-external-event.consumer.configuration.key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.cloud.stream.kafka.binder.scheduler-in-from-external-event.consumer.configuration.value.deserializer=io.confluent.kafka.serializers.KafkaAvroDeserializer
this doesn't work am I missing a dependency or can someone point me in the direction of specifying a serde for a single producer/consumer in my properties file?
答案1
得分: 1
串行器(Serdes)在流特定绑定属性 ...kafka.streams.bindings...
上进行了指定。
使用如下配置:
spring.cloud.stream.kafka.streams.bindings.scheduler-in-from-external-event.consumer.key-serde=...
spring.cloud.stream.kafka.streams.bindings.scheduler-in-from-external-event.consumer.value-serde=...
文档链接:https://docs.spring.io/spring-cloud-stream-binder-kafka/docs/3.0.8.RELEASE/reference/html/spring-cloud-stream-binder-kafka.html#_kafka_streams_consumer_properties
英文:
The Serdes are specified on streams-specific binding properties ...kafka.streams.bindings...
.
Use
spring.cloud.stream.kafka.streams.bindings.scheduler-in-from-external-event.consumer.key-serde=...
spring.cloud.stream.kafka.streams.bindings.scheduler-in-from-external-event.consumer.value-serde=...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论