Core Documentation
ØMQ - The Guide by Pieter Hintjens explains how to use ØMQ as an intelligent transport layer for your distributed apps.
The ØMQ Reference Manual by Martin Sustrik and Martin Lucina specifies the ØMQ API.
The ØMQ FAQ by the community is the first place to look for answers to frequently asked questions and problems.
Example Code
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)
Introductions
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."
Martin Lucina and Martin Sustrik write:
"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."
Video Introductions
This presentation, "ZeroMQ is the Answer", is by Ian Barber at the PHP UK Conference.
FLOSS Weekly's Randal Schwartz and Aaron Newcomb discuss ØMQ with Pieter Hintjens:
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.