codeclimate/kafka

Name: kafka

Owner: Code Climate

Description: Centralized Kafka client gem (temporary name)

Created: 2015-06-25 22:57:40.0

Updated: 2016-12-02 00:13:54.0

Pushed: 2017-01-05 23:31:18.0

Homepage: null

Size: 109

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Code Climate Kafka

A generic Kafka client tuned for our own usage.

Features:

Usage
ire "cc/kafka"
Producer
ucer = CC::Kafka::Producer.new("kafka://host:1234/topic", "client-id")
ucer.send_message(foo: :bar, baz: :bat)
ucer.close
Consumer
umer = CC::Kafka::Consumer.new("client-id", ["kafka://host:1234", "..."], "topic", 0)
umer.on_message do |message|
Given the producer above, message will be

  {
    "foo" => :bar,
    "baz" => :bat,
    CC::Kafka::MESSAGE_OFFSET_KEY => "topic-0-1",
  }



umer.start

Note: the value for the MESSAGE_OFFSET_KEY identifies the message's offset within the given topic and partition as <topic>-<partition>-<offset>. It can be used by consumers to tie created data to the message that lead to it and prevent duplicate processing.

Configuration
Copyright

See LICENSE


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.