- Pål Ruud / @ruudud
Funfact: Can have higher throughput than TCP because of message batching.
Because a client may easily send work to more servers, you have a way of getting more horsepower without writing a lot of code.
Even poorly implemented code can have a new life with scaling by the assistance of the messaging middleware.
Source: Wikipedia
RPC and classic client-server
Data distribution
Zero M Q
But that doesn't mean we can't create one.
ctx = zmq.Context()
socket = ctx.socket(zmq.REQ)
socket.connect("tcp://0.0.0.0:12345")
while True:
socket.send("Hello from %s" % sys.argv[1])
print socket.recv() # Blocking
client.py
ctx = zmq.Context()
socket = ctx.socket(zmq.REP)
socket.bind("tcp://*:12345")
while True:
request = socket.recv() # Blocking
print 'Got message: %s' % request
time.sleep(.5)
socket.send('Hello world back at ya from the server')
server.py
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:5556")
while True:
socket.send("Arsenal:red card")
time.sleep(1)
publisher.py
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect ("tcp://localhost:5556")
socket.setsockopt(zmq.SUBSCRIBE, 'Arsenal')
while True:
string = socket.recv()
print string
subscriber.py
High-level overview of ZeroMQ socket