zk-ruby / zk-eventmachine Goto Github PK
View Code? Open in Web Editor NEWZK client for EventMachine-based applications
License: MIT License
ZK client for EventMachine-based applications
License: MIT License
I get the following when I try to 'gem install zk-eventmachine'
make[1]: Leaving directory `/usr/local/lib/ruby/gems/2.2.0/gems/zookeeper-1.3.0/ext/c'
checking for rb_thread_blocking_region()... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling event_lib.c
compiling zkrb_wrapper_compat.c
compiling zkrb_wrapper.c
compiling zkrb.c
In file included from /usr/local/include/ruby-2.2.0/ruby.h:33:0,
from zkrb.c:68:
zkrb.c: In function ‘get_call_type’:
/usr/local/include/ruby-2.2.0/ruby/ruby.h:422:18: error: expected ‘(’ before ‘!’ token
#define RTEST(v) !(((VALUE)(v) & ~Qnil) == 0)
^
zkrb.c:148:6: note: in expansion of macro ‘RTEST’
if RTEST(async) {
^
zkrb.c:148:19: error: expected ‘;’ before ‘{’ token
if RTEST(async) {
^
In file included from /usr/local/include/ruby-2.2.0/ruby.h:33:0,
from zkrb.c:68:
zkrb.c: In function ‘get_self_pipe_read_fd’:
/usr/local/include/ruby-2.2.0/ruby/ruby.h:423:18: error: expected ‘(’ before ‘!’ token
#define NIL_P(v) !((VALUE)(v) != Qnil)
^
zkrb.c:761:6: note: in expansion of macro ‘NIL_P’
if NIL_P(pipe_read)
^
zkrb.c:762:7: error: expected ‘;’ before ‘rb_raise’
rb_raise(rb_eRuntimeError, "@pipe_read was nil!");
^
make: *** [zkrb.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/zookeeper-1.3.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/zookeeper-1.3.0/gem_make.out
This is on CentOS Linux release 7.1.1503 (Core) and I am using ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux].
What is going wrong? Can I fix this? Also I noticed this repo hasn't gotten many updates in a long time so is this gem feature complete or dead?
Want to thank you first for all the work on Ruby Zookeeper, Jonathan!
zk-eventmachine has been working great for me except for the following:
I want my program to receive a notification when a zookeeper server disconnects.
I am overwriting the on_connection_lost method in the following way:
require 'zk-eventmachine'
require 'pp'
Zookeeper.set_debug_level(4)
@zkem = ZK::ZKEventMachine::Client.new("127.0.0.1:2181")
@zkem.on_connection_lost do |event|
pp ["==== zookeeper disconnected"]
end
EM.run {
@zkem.connect do
puts
pp ["connected"]
end
}
However, the on_connection_lost event never gets fired even though the events from C library pass by :(
["connected"]
DEBUG 0x101768000:zookeeper_lib.c:375: ZOOKEEPER_C_STATE WATCHER type = -1, state = 3, path = 0x7fb25a25a290, value =
DEBUG 0x101662000:zookeeper_c.c:543: obj_id: 3fd92ce3714c, read 1 bytes from the queue (0x7fb25a188c40)'s pipe
DEBUG 0x101662000:zookeeper_lib.c:302: zkrb_event_to_ruby ZKRB_WATCHER
DEBUG 0x101768000:zookeeper_lib.c:375: ZOOKEEPER_C_STATE WATCHER type = -1, state = 1, path = 0x7fb25a12acb0, value =
DEBUG 0x101662000:zookeeper_c.c:543: obj_id: 3fd92ce3714c, read 1 bytes from the queue (0x7fb25a188c40)'s pipe
DEBUG 0x101662000:zookeeper_lib.c:302: zkrb_event_to_ruby ZKRB_WATCHER
Getting a znode with :watch => true seems to somehow cause all on_connecting/on_connected/etc events to be subscribed again causing them to fire multiple times.
documented:
zkem.connect do
# the client is connected when this block is called
end
However, that block seems to run after some timeout even when there's no zookeeper connection
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.