Created
March 21, 2012 21:21
-
-
Save felipecruz/2152946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zmq' | |
require 'msgpack' | |
context = ZMQ::Context.new | |
worker_socket = context.socket ZMQ::REP | |
worker_socket.connect "tcp://127.0.0.1:5555" | |
count = 0 | |
while true | |
req = MessagePack.unpack worker_socket.recv | |
count += 1 | |
id = req[0] | |
uri = req[2] | |
rep = MessagePack.pack([id, "<html><h1>RubyWorker #{count}</h1></html>"]) | |
worker_socket.send rep | |
puts count | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment