GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bsm/poseidon_cluster: Poseidon cluster extensions

This repository was archived by the owner on Jul 24, 2018. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

71 Commits
71 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
lib
lib
 
 
scenario
scenario
 
 
spec
spec
 
 
.coveralls.yml
.coveralls.yml
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
Gemfile
Gemfile
 
 
Gemfile.lock
Gemfile.lock
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
poseidon_cluster.gemspec
poseidon_cluster.gemspec
 
 

Repository files navigation

DEPRECATION NOTICE

Due to a lack of resources, this project is unfortunately discontinued. If you require clustering functionality for your ruby consumers, please refer to: https://github.com/karafka/karafka

Poseidon Cluster Build Status Coverage Status

Poseidon Cluster is a cluster extension of the excellent Poseidon Ruby client for Kafka 0.8+. It implements the distribution concept of self-rebalancing Consumer Groups and supports the consumption of a single topic from multiple instances.

Consumer group instances share a common group name, and each message published to a topic is delivered to one instance within each subscribing consumer group. Consumer instances can be in separate processes or on separate machines.

Usage

Launch a consumer group:

require 'poseidon_cluster'

consumer = Poseidon::ConsumerGroup.new(
            "my-group",                               # Group name
            ["kafka1.host:9092", "kafka2.host:9092"], # Kafka brokers
            ["kafka1.host:2181", "kafka2.host:2181"], # Zookeepers hosts
            "my-topic")                               # Topic name

consumer.partitions # => [0, 1, 2, 3] - all partitions of 'my-topic'
consumer.claimed    # => [0, 1] - partitions this instance has claimed

Fetch a bulk of messages, auto-commit the offset:

consumer.fetch do |partition, bulk|
  bulk.each do |m|
    puts "Fetched '#{m.value}' at #{m.offset} from #{partition}"
  end
end

Get the offset for a partition:

consumer.offset(0) # => 320 - current offset from partition 0

Fetch more messages, commit manually:

consumer.fetch commit: false do |partition, bulk|
  bulk.each do |m|
    puts "Fetched '#{m.value}' at #{m.offset} from #{partition}"
  end

  consumer.commit partition, bulk.last.offset+1 unless bulk.empty?
end

Initiate a fetch-loop, consume indefinitely:

consumer.fetch_loop do |partition, bulk|
  bulk.each do |m|
    puts "Fetched '#{m.value}' at #{m.offset} from #{partition}"
  end
end

For more details and information, please see the Poseidon::ConsumerGroup documentation and the Examples.

Running Tests

The test suite will automatically download, configure and run Kafka locally, you only need a JRE. Run the suite via:

bundle exec rake spec

Licence

Copyright (c) 2014 Black Square Media

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Poseidon cluster extensions

Resources

Readme
Activity
Custom properties

Stars

42 stars

Watchers

1 watching

Forks

37 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.