Fork me on GitHub
#jackdaw
<
2020-03-03
>
tzzh13:03:47

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

tzzh14:03:39

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

cddr15:03:14

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

tzzh11:03:24

Hey @U065JNAN8 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 ?

cddr22:03:30

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.

tzzh15:03:41

ah ok thanks, how would you go about pulling the schema in that case, with client from jackdaw.serdes.avro.schema-registry ?

cddr16:03:23

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)

tzzh16:03:28

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 ?

cddr16:03:22

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.

tzzh16:03:55

OK cool thank you :thumbsup: