Git Product home page Git Product logo

kafka-clj-utils's Introduction

kafka-clj-utils CircleCI

A number of utilities for dealing with Kafka + Avro Schema Registry.

Usage

Clojars Project

Avro Bundle Producer

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))

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 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/healthcheck

License

Copyright © 2018 OVO Energy Ltd.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

kafka-clj-utils's People

Contributors

vise890-ovo avatar gavinesbergerovo avatar galvin-bristol avatar oli-d-ovo avatar

Stargazers

Cristopher Rodrigues avatar Vic avatar dqd avatar

Watchers

James Cloos avatar Ed avatar Stuart Boundy avatar  avatar Ian White avatar Markus avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.