-
Notifications
You must be signed in to change notification settings - Fork 81
/
confluent.clj
20 lines (19 loc) · 929 Bytes
/
confluent.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(ns jackdaw.serdes.avro.confluent
(:require [jackdaw.serdes.avro :as jsa]))
(defn serde
"Creates a serde for Avro data. An avro serde needs to know if its generating
a key or value in the data (a separate serde is required for each as a result).
Optionally accepts a map of further values to allow configuration of the avro
serde operation."
[schema-registry-url schema key? & [{:keys [type-registry
schema-registry-client
coercion-cache]}]]
(let [reg (if (nil? type-registry)
jsa/+base-schema-type-registry+
type-registry)]
(jsa/serde reg
{:avro.schema-registry/url schema-registry-url
:avro.schema-registry/client schema-registry-client}
{:avro/schema schema
:key? key?
:avro/coercion-cache coercion-cache})))