Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ovotech/kafka-clj-utils
Clojure utilities for Kafka
https://github.com/ovotech/kafka-clj-utils
Last synced: 12 days ago
JSON representation
Clojure utilities for Kafka
- Host: GitHub
- URL: https://github.com/ovotech/kafka-clj-utils
- Owner: ovotech
- License: epl-1.0
- Created: 2018-09-18T09:44:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-15T14:26:59.000Z (almost 4 years ago)
- Last Synced: 2024-11-28T14:48:23.666Z (24 days ago)
- Language: Clojure
- Size: 43 KB
- Stars: 3
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kafka-clj-utils [![CircleCI](https://circleci.com/gh/ovotech/kafka-clj-utils/tree/master.svg?style=svg)](https://circleci.com/gh/ovotech/kafka-clj-utils/tree/master)
A number of utilities for dealing with Kafka + Avro Schema Registry.
## Usage
[![Clojars
Project](https://img.shields.io/clojars/v/ovotech/kafka-clj-utils.svg)](https://clojars.org/ovotech/kafka-clj-utils)### Avro Bundle Producer
Multiple Avro encoded messages can be published to Kafka using
`kafka-clj-utils.producers/publish-avro-bundle````clojure
(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))
```### Healthchecks
Two healthcheck functions are provided to confirm functionality of components:
* kafka - `kafka-clj-utils.healthcheck` checks connectivity to Kafka by listing
topics
* schema-registry - `kafka-clj-utils.schema-registry` ensure connectivity to an
Avro Schema Registry by retrieving the registry's config### Integrant Keys
A number of [Integrant](https://github.com/weavejester/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-spec`s:
* `:kafka-clj-utils.healthcheck/healthcheck`
* `:kafka-clj-utils.producers/bundle-publisher`
* `:kafka-clj-utils.schema-registry/healthcheck`## License
Copyright © 2018 OVO Energy Ltd.
Distributed under the Eclipse Public License either version 1.0 or (at your
option) any later version.