forked from FundingCircle/jackdaw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
confluent.clj
28 lines (26 loc) · 1.29 KB
/
confluent.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(ns jackdaw.serdes.avro.confluent
(:require [jackdaw.serdes.avro :as jsa]))
(set! *warn-on-reflection* true)
(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
read-only?
serializer-properties
deserializer-properties]}]]
(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
:read-only? read-only?
:serializer-properties serializer-properties
:deserializer-properties deserializer-properties})))