ØMQ - The Guide
ØMQ - The Guide by Pieter Hintjens covers basic and intermediate concepts. It explains:
"A ØMQ socket is what you get when you take a normal TCP socket, inject it with a mix of radioactive isotopes stolen from a secret Soviet atomic research project, bombard it with 1950-era cosmic rays, and put it into the hands of a drug-addled comic book author with a badly-disguised fetish for bulging muscles clad in spandex."
This shows a filter that collects data from two different remote publishers and sends it to local subscribers:
import zmq import time context = zmq.Context() subscriber = context.socket (zmq.SUB) subscriber.connect ("tcp://192.168.55.112:5556") subscriber.connect ("tcp://192.168.55.201:7721") subscriber.setsockopt (zmq.SUBSCRIBE, "NASDAQ") publisher = context.socket (zmq.PUB) publisher.bind ("ipc://nasdaq-feed") while True: message = subscriber.recv() publisher.send (message)
The best way to get started with ZeroMQ is to work through some hands-on examples - the concepts are not new, but the ease with which you can compose them takes some getting use to.
"0MQ sockets being asynchronous means that the timings of the physical connection setup and teardown, reconnect and effective delivery are transparent to the user and organized by 0MQ itself. Further, messages may be queued in the event that a peer is unavailable to receive them."
"The more time I spend with ZeroMQ, the less I can think of a reason I'd ever have to open up a raw TCP or UDP socket, except in extraordinary circumstances, again."
"0MQ ("Zero-Em-Queue") is a messaging system that tackles these issues by taking a different approach. Instead of inventing new APIs and complex wire protocols, 0MQ extends the socket API, eliminating the learning curve and allowing a network programmer to master it in a couple of hours. The wire protocols are simplistic, even trivial. Performance matches and often exceeds that of raw sockets."
"ZeroMQ is a messaging library, which allows you to design a complex communication system without much effort."
"What ZeroMQ does is create an API that looks a lot like sockets, and feels the same, but gives you the messaging styles you actually want. By simply specifying the type of socket when you call zmq_socket you can have multicast, request/reply, and many other styles."
The ØMQ Reference Manual
The ØMQ Reference Manual by Martin Lucina covers the API in detail. It says:
"This documentation presents an overview of ØMQ concepts, describes how ØMQ abstracts standard sockets and provides a reference manual for the functions provided by the ØMQ library."
This video from Oliver Smith provides a live demo of ØMQ. Note that UPSTREAM and DOWNSTREAM are old names, these are now called PUSH and PULL:
Backgrounders and Whitepapers
- Pieter Hintjens and Martin Sustrik explain how ØMQ solves the challenge of creating large multicore applications in any language. Also in PDF (8 pages).
- Martin Sustrik explains the differences between broker-based and brokerless messaging approaches.
- Pieter Hintjens explains how edge-to-edge reliability is more scalable and robust than broker-based reliability.