Provides JRuby Bindings to a Pure Java implementation of libzmq (ZeroMQ).
jruby -S gem install jrzmq
gem "jrzmq", "~> 1.0.3.2"
require 'jrzmq'
context = ZMQ::Context.new(1)
puts "Opening connection for READ DOWNSTREAM"
inbound = context.socket(ZMQ::UPSTREAM)
inbound.bind("ipc://localconnection")
inbound.set_receive_time_out 10
puts "Opening connection for WRITE UPSTREAM"
outbound = context.socket(ZMQ::DOWNSTREAM)
outbound.connect("ipc://localconnection")
outbound.set_send_time_out 10
messages = %w{Hello World! QUIT}
messages.each do |msg|
outbound.send(msg)
end
loop do
received_msg = inbound.recv_str
puts "Received #{received_msg}"
break if received_msg == "QUIT"
end
JRZMQ's code is MIT, but it relies upon JeroMQ which has the following: