Apache Camel Kafka 支持 Confluent 模式注册表 [英] Apache Camel Kafka support for Confluent schema Registry
问题描述
我正在尝试使用 kafka 组件创建骆驼路由,尝试使用 io.confluent.kafka.serializers.KafkaAvroDeserializer
和 schemaRegistry url 以及其他组件参数来使用事件.我不确定 Camel-Kafka 目前是否完全支持这一点.有人可以对此发表评论吗?
I am trying to create camel route with kafka component trying to consume events with io.confluent.kafka.serializers.KafkaAvroDeserializer
and schemaRegistry url along with other component parameters. I am not sure if this is full supported by Camel-Kafka currently. Can someone please comment on this ?
from("kafka:{{kafka.notification.topic}}?brokers={{kafka.notification.brokers}}"
+ "&maxPollRecords={{kafka.notification.maxPollRecords}}"
+ "&seekTo={{kafka.notification.seekTo}}"
+ "&specificAvroReader=" + "true"
+ "&valueDeserializer=" + "io.confluent.kafka.serializers.KafkaAvroDeserializer"
+"&schemaRegistryURL=localhost:9021"
+ "&allowManualCommit={{kafka.notification.autocommit}})
specificAvroReader
&schemaRegistryURL
是似乎不受支持的属性.
specificAvroReader
& schemaRegistryURL
are the properties which seems to be not supported.
推荐答案
我相信目前让camel-kafka 与Confluent Schema Registry 一起工作的唯一方法是编写一个自定义的AvroSerilizer/AvroDeserializer (io.confluent.kafka.serializers.AbstractKafkaAvroSerializer/io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer).例如:
I believe the only way currently to have camel-kafka to work with Confluent Schema Registry is to write a custom AvroSerilizer/ AvroDeserializer (io.confluent.kafka.serializers.AbstractKafkaAvroSerializer/ io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer). E.g.:
BlablaDeserializer extends AbstractKafkaAvroDeserializer implements Deserializer<Object>
和
BlablaSerializer extends AbstractKafkaAvroSerializer implements Serializer<Object>
然后将它们设置在骆驼组件上.例如.对于它的价值:
and then set them on the camel component. E.g. for the value it will be:
KafkaConfiguration kafkaConfiguration.setValueDeserializer(...)
这篇关于Apache Camel Kafka 支持 Confluent 模式注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!