- Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathproxy.rb
More file actions
Latest commit
22 lines (16 loc) · 463 Bytes
/
Copy pathproxy.rb
File metadata and controls
22 lines (16 loc) · 463 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# gem install zmq
# gem install ffi-rzmq
# ruby pub.rb
require'rubygems'
require'ffi-rzmq'
# the first node is the publisher
# all future nodes are subscribers
# Clearly, master introduces a SPOF
context=ZMQ::Context.new
frontend=context.socket(ZMQ::ROUTER)
frontend.bind("tcp://*:#{4000}")
backend=context.socket(ZMQ::DEALER)
backend.bind("tcp://*:#{4001}")
puts"Starting proxy"
# message queue pipe
ZMQ::Device.new(ZMQ::QUEUE,frontend,backend)