No commit activity in last 3 years
No release in over 3 years
Node presence using ZooKeeper for celluloid services
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Celluloid Presence

Start an instance of ZooKeeper on your dev machine then run:


require 'rubygems'
require 'celluloid-presence'

Celluloid::Presence::ZkService.init :server => 'localhost'
Celluloid::Presence::ZkPresence.supervise_as :presence, :service_name => :presence

class Messaging
	include Celluloid
	include Celluloid::Notifications
	
	def self.finalizer
		:finalize
	end
	
	def initialize(service_name)
		@service_name = service_name
		subscribe("#{@service_name}_nodes", :node_update)
	end
	
	def node_update(event, nodes)
		p "\nNode list updated!"
		nodes.each do |node|
			p " -> #{Actor[@service_name].get(node)}"
		end
	end
	
	
	private
	
	
	def finalize
		Actor[@service_name].terminate
	end
end

Messaging.run(:presence)

Start using it now

  1. Read the Documentation
  2. Then gem install celluloid-presence