Go to file
Abhi Yerra 1336deb53a Added travis.yml 2014-08-18 13:37:46 -07:00
bin
ext Remove bogus binaries from commit. 2014-07-22 11:37:41 -07:00
lib
scripts/ci_config Enable the 'x' perm on the scripts. 2014-07-30 22:00:09 -07:00
test
.travis.yml Added travis.yml 2014-08-18 13:37:46 -07:00
Gemfile
README.md Update README.md to reflect 0.8 Kafka support only (no 0.7) per convo with Magnus. 2014-06-16 14:49:51 -07:00
Rakefile
hermann.gemspec Remove bogus binaries from commit. 2014-07-22 11:37:41 -07:00
hermann.iml Remove the constraint on RubyGems version to allow the gem to work with 1.8 Ruby. 2014-05-30 13:35:10 -07:00

README.md

Hermann

A Ruby gem implementing a Kafka Publisher and Consumer

This library wraps the librdkafka library (https://github.com/edenhill/librdkafka) which is implemented in C. This library must be installed before we can use the Hermann gem.

Usage

Usage is modelled on the kafka-rb gem (https://github.com/acrosa/kafka-rb) and is fairly straightforward.

  • Kafka 0.8 is supported.
  • Ruby 1.8.7 and Ruby 2.1.1 have been tested, but JRuby and versions >= 1.8 should work as long as the librdkafka library is installed.
  • This is an early alpha version of the gem, so expect bumps in the road.

Note: The current implementation needs work to ensure thread safety.

Both Consumers and Producers now hold their own references to their Kafka state, and should be able to coexist nicely. The brokers list and partition specification for Consumers are now working, as well. Producers will detect the number of partitions in a topic and randomly spread their messages over the set of partitions.

Consumers currently do not remember their "last message", nor do they yet coordinate partition (re)assigment within consumer groups.

Consumer

require 'hermann'

# Initialize requires topic, brokers list, and partition number

c = Hermann::Consumer.new( "device_actions", "localhost:9092", 0 ) c.consume() do |msg| puts("Received: #{msg}") end

Producer

require 'hermann'

p = Hermann::Producer.new( "device_actions", "localhost:9092" )

messages = [ "Locate", "Scream", "Wipe", "Degauss" ] messages.each { |msg| p.push(msg) }

Questions?

Stan Campbell can be reached at stan.campbell3 at( @ ) gmail.com