![](/img/trans.png)
[英]How to evolve Avro schema with Akka Persistence without sending schema or using a registry?
[英]how to check avro schema registry usage
我正在通過avro4s使用avro。 這是我為消費者/生產者配置的
def producerSettings(system: ActorSystem): ProducerSettings[String, Array[Byte]] = ProducerSettings(
system,
new StringSerializer,
new ByteArraySerializer)
.withBootstrapServers("localhost:9092")
.withProperty("key.serializer", "io.confluent.kafka.serializers.KafkaAvroSerializer")
.withProperty("value.serializer", "io.confluent.kafka.serializers.KafkaAvroSerializer")
.withProperty("key.converter.schema.registry.url", "http://localhost:8081")
.withProperty("value.converter.schema.registry.url", "http://localhost:8081")
.withProperty("schema.registry.url", "http://localhost:8081")
.withProperty("auto.create.topics.enable", "true")
def consumerSettings(system: ActorSystem): ConsumerSettings[String, Array[Byte]] =
ConsumerSettings(
system,
new StringDeserializer,
new ByteArrayDeserializer)
.withBootstrapServers("localhost:9092")
.withProperty("key.deserializer", "io.confluent.kafka.serializers.KafkaAvroDeserializer")
.withProperty("value.deserializer", "io.confluent.kafka.serializers.KafkaAvroDeserializer")
.withProperty("key.converter.schema.registry.url", "http://localhost:8081")
.withProperty("value.converter.schema.registry.url", "http://localhost:8081")
.withProperty("schema.registry.url", "http://localhost:8081")
.withGroupId("test")
.withProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest")
我懷疑是否使用了寄存器。 當我的應用程序運行時,它在架構注冊表日志中處於靜默狀態。
如何檢查我的應用程序正在使用注冊表?
如果不是,該如何解決?
您使用了錯誤的類,因此您的屬性可能會出現錯誤
您實際上需要在KafkaAvroSerializer
為生產者使用KafkaAvroSerializer
new StringSerializer,
new ByteArraySerializer)
還有KafkaAvroDeserializer
為這里的消費者
new StringDeserializer,
new ByteArrayDeserializer)
並嘗試將String, Array[Byte]
更改為GenericRecord
或您從Avro4s創建的某些案例類
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.