1

We are using a schema registry in our application and for deserialization, we use:      

KafkaAvroDeserializer kafkaAvroDeserializer = new KafkaAvroDeserializer();

We are currently using default constructor. However, I can see we have a few other options to override SchemaRegistryClient. In Confluent, I can see we have CachedSchemaRegistryClient present.

My questions are:

  1. If we use default constructor, would KafkaAvroDeserializer invoke schema registry for each and every request on the topic, or would it cache the schema at the consumer?

  2. For schema caching, do we need to explicitly use CachedSchemaRegistryClient to maintain a local cache?

https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/CachedSchemaRegistryClient.java

1 Answer 1

0

new KafkaAvroDeserializer() includes the CachedSchemaRegistry client

The other constructor is primarily for testing purposes.

If we use default constructor, would KafkaAvroDeserializer invoke schema registry for each and every request on the topic, or would it cache the schema at the consumer

It caches

For schema caching, do we need to explicitly use CachedSchemaRegistryClient to maintain a local cache?

As stated, the cache is internally managed for you

We are currently using default constructor

Not really clear why you are doing that. props.set("....deserializer", KafkaAvroDeserializer.class) works fine in most cases

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.