Fork me on GitHub
Joshua Suskalo17:11:23

Hey, is the set of serdes intended to be user-extensible?

Joshua Suskalo17:11:20

because if possible I'd like to be able to use e.g. nippy in some cases.

Darin Douglass17:11:00

yes. i’ve extended and used custom nippy serdes before

Joshua Suskalo17:11:20

Is there somewhere I should look at for how to get started? It seems like the existing serdes have kind of magic stuff with the names of their vars, and I don't see docs on how to add in a custom one.

Darin Douglass17:11:36

iirc i just copied the edn2 schema ns then swapped out the internal bits from edn to nippy

Darin Douglass17:11:24

you likely don’t need the :prefix or :name fields and can just rely on the defaults clojure provides

Joshua Suskalo17:11:21

Okay, that looks like it's pretty easy, so I guess the only question I have left is does setting the serdes on the topic like in the streams api example work even if you're using a raw consumer?

Joshua Suskalo17:11:15

Oh I see, it's a part of the consumer options map

Darin Douglass17:11:06

ya, just give it the classname and you should be good to go

Joshua Suskalo17:11:04

oh. Hmm. Not ideal to have to write a class for that, but okay.

Darin Douglass17:11:43

the serdes ns has :gen-class 💪

Joshua Suskalo17:11:55

Seems like the arity 2 of consumer just takes something that subclasses Serdes, which is what's generated by calling the Serdes/serdeFrom on the stuff returned from the fn ns, which would avoid that problem