A number of utilities for dealing with Kafka + Avro Schema Registry.
Multiple Avro encoded messages can be published to Kafka using
kafka-clj-utils.producers/publish-avro-bundle
(require '[kafka-clj-utils.producers :as kp])
(let [config {:kafka.serde/config {:schema-registry/base-url "http://localhost:8081"}
:kafka/config {:bootstrap.servers "127.0.0.1:9092"}}
k-producer (kp/->producer config)
bundle {:avro-schema {:type :record
:name "Greeting"
:fields [{:name "greeting"
:type "string"}]}
:topic-name "my-topic"
:records [{:greeting "hi"}
{:greeting "hola"}
{:greeting "bundi`"}]}]
(kp/publish-avro-bundle k-producer bundle))
Two healthcheck functions are provided to confirm functionality of components:
kafka-clj-utils.healthcheck checks connectivity to Kafka by listing
topicskafka-clj-utils.schema-registry ensure connectivity to an
Avro Schema Registry by retrieving the registry's configA number of Integrant init-key
multimethods are exposed to make including these utilities into an Integrant app
easier.
All of the following keys are exposed with pre-init-specs:
:kafka-clj-utils.healthcheck/healthcheck:kafka-clj-utils.producers/bundle-publisher:kafka-clj-utils.schema-registry/healthcheckCopyright © 2018 OVO Energy Ltd.
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |