micronaut-kafka icon indicating copy to clipboard operation
micronaut-kafka copied to clipboard

Support the configuration of the schema registry url for Avro serializer/deserializer

Open codependent opened this issue 5 years ago • 4 comments

According to the documentation we can specify different serializers/deserializers for producers/consumers in the configuration, e.g:

kafka:
    producers:
        xxx:
            value:
                serializer: org.apache.kafka.common.serialization.ByteArrayDeserializer

In order to use with Avro we would need to be able to configure the schema registry url.

codependent avatar Apr 22 '19 07:04 codependent

You can configure anything you want in kafka below xxx. Micronaut does not prevent that.

graemerocher avatar Jun 04 '19 12:06 graemerocher

I think what was meant by the opener of this ticket is. If you use io.confluent.kafka.serializers.KafkaAvroSerializer as the serializer configured for the producers, this serializer needs an instance of the type SchemaRegistryClient in its constructor to function properly. And to create such an instance you will need an url.

However the problem here (to me) is that you are unable to tell micronaut how to instantiate the serializer.

ckosmowski avatar Aug 19 '19 07:08 ckosmowski

kafka:
  bootstrap:
    servers: xxx:99092
  consumers:
    default:
      specific.avro.reader: true
      key.deserializer: org.apache.kafka.common.serialization.LongDeserializer
      value.deserializer: io.confluent.kafka.serializers.KafkaAvroDeserializer
      schema.registry.url: http://registry-server-url:port

this works for me

kalgecin avatar Jun 08 '20 10:06 kalgecin

@kalgecin seems like it could be a good contribution to the documentation?

graemerocher avatar Jun 08 '20 10:06 graemerocher