Hey do you have an example of the minimal setup to use a caching client for the confluent schema registry with jackdaw ? I am trying to look through the source and the docs but I am a bit confused as I am not super familiar with the the confluent schema registry
to be more precise I don’t really understand why serde
from jackdaw.serdes.avro.confluent
needs a schema as an argument when I thought it would use the schema registry to get it
It needs a schema present in order to write a message. I think you can get away with a nil for the schema when you are using it for a consumer. In this case, the messages include an id that allows the deserializer to fetch the schema from the registry before decoding the message
Hey @cddr just a suggestion, what would you think about also having producer-serde
and consumer-serde
functions in the jackdaw.serdes.avro.confluent
namespace so you only provide the arguments what are needed if you don’t use both aspects of the serde ?
eg for the producer you’d only need to provide the avro schema and then for the consumer only needs a schema-registry-client
?
The producer also needs a schema-registry-client because when it produces a message, it "registers" the schema with the registry if it hasn't already been registered.
ah ok thanks, how would you go about pulling the schema in that case, with client
from jackdaw.serdes.avro.schema-registry
?
I tend to have take a copy of the schema and check it into the repo (same way you might check in the current schema arrived at by applying your database migrations)
OK I think I get it now, I didn’t really understand how to use client
- it’s more of an helper to build the java client object and then you call the java methods (eg getById
) on that object, right ?
Yep. You can do. And the thing that might be not obvious if your trying to use the mock registry client is that the producer must share the same (i.e identical object) client as the consumer.
OK cool thank you :thumbsup: