Permalink
Browse files

- sample code for new lumberjack receiver

  • Loading branch information...
1 parent 7fbf63f commit 7e26e16419aa5df7dd05776a0c34ec08938d1861 @jordansissel jordansissel committed Mar 5, 2013
Showing with 27 additions and 0 deletions.
  1. +27 −0 2/s.rb
View
27 2/s.rb
@@ -0,0 +1,27 @@
+require "ffi-rzmq"
+require "zlib"
+require "msgpack"
+
+c = ZMQ::Context.new
+s = c.socket(ZMQ::REP)
+
+s.bind("tcp://*:5005")
+
+msg = ""
+msg.force_encoding("BINARY")
+start = Time.now
+count = 0
+loop do
+ rc = s.recv_string(msg)
+ #p msg
+ original = Zlib::Inflate.inflate(msg)
+ events = MessagePack.unpack(original)
+ count += events.count
+ p events
+ #if count > 100000
+ #puts count / (Time.now - start)
+ #count = 0
+ #start = Time.now
+ #end
+ s.send_string("")
+end

0 comments on commit 7e26e16

Please sign in to comment.