ZeroMQ
A messaging library, not a server: you link it into each program, and its sockets carry whole messages between processes in patterns such as pub-sub, push-pull and request-reply, with no broker in between.
- What it is
- Pub/sub
- Used for
- Message queues
- Type
- Open source
- Made by
- The ZeroMQ authors, started at iMatix
- License
- MPL 2.0
- Facts checked
- 13 October 2026
What it is
ZeroMQ (also written ØMQ or 0MQ) gives you sockets that send and receive whole messages instead of byte streams. One socket can bind or connect to many peers over in-process, inter-process, TCP, multicast and other transports, and background I/O threads do the connecting, reconnecting and queuing, talking to your threads through lock-free queues. The socket type sets the pattern: a PUB socket fans each message out to every connected SUB socket, which subscribes to topics carried in the message’s first frame; PUSH round-robins tasks to PULL workers; REQ/REP and the asynchronous DEALER/ROUTER do request-reply. On the wire peers speak ZMTP, whose version 3.0 added pluggable security (NULL, PLAIN and CURVE).
There is no broker, so nothing is stored. Each socket keeps an in-memory queue per peer, capped by a high-water mark; when it is full the socket blocks or drops depending on its type: PUB drops messages for that subscriber, while PUSH and DEALER block the sender. A subscriber that connects late misses what was sent before its connection finished, the “slow joiner” problem. Messages are opaque blobs, so serialization is left to something like Protocol Buffers or msgpack, and durability, retries and discovery are patterns you build on top, which the ZeroMQ Guide covers at length. The core, libzmq, is C++ with a score of language bindings, plus native ports such as JeroMQ for Java and NetMQ for C#.
Why teams pick it
- No broker to deploy or watch: processes link a library and talk directly, so there is no extra hop and no central box to fail
- One API from threads to networks: the same code moves between
inproc://,ipc://andtcp://by changing the endpoint string - Patterns built in: fan-out pub-sub, round-robin pipelines, request-reply and routed async servers, with automatic reconnects so components can start in any order
- MPL 2.0 since the 2023 relicensing, which explicitly allows closed-source applications to link it, statically too
Watch out for
- Nothing is persisted: queued messages live in memory, PUB silently drops for a subscriber past the high-water mark, and late subscribers miss earlier messages
- Sockets must not be shared between threads; the Guide says to use each socket from one thread only
- Reliability, acknowledgments and service discovery are up to you, and the Guide spends whole chapters on the patterns for them
- Slow release cadence: the latest libzmq release is 4.3.5 from October 2023, and newer socket types such as CLIENT/SERVER and RADIO/DISH are still drafts
- Data model
- Opaque multipart messages over sockets typed by pattern (PUB/SUB, PUSH/PULL, REQ/REP)
- Client protocol
- ZMTP over TCP, IPC, in-process and multicast transports
- Delivery guarantee
- No persistence: PUB drops messages past the high-water mark, late subscribers miss earlier ones
- Retention
- None; in-memory queues per peer only
- Written in
- C++ (libzmq), with native ports such as JeroMQ and NetMQ
- Ways to run it
- A library in your process; no broker
Alternatives
What all pub/sub have in common →Compare side by side →
Eclipse ZenohIncubatingOpen sourceA pub/sub, query and storage protocol that runs peer to peer or through routers, from microcontrollers to the cloud; also a ROS 2 middleware.
Amazon SNSAWSAWS’s managed pub/sub topics, which push each message to queues, functions, webhooks, phones and inboxes.How it fits with other technologies
Pub-sub with libzmq: the topic goes in the first frame · c
// publisher process
void *ctx = zmq_ctx_new ();
void *pub = zmq_socket (ctx, ZMQ_PUB);
zmq_bind (pub, "tcp://*:5556");
zmq_send (pub, "status", 6, ZMQ_SNDMORE); // topic frame
zmq_send (pub, "All is well", 11, 0); // payload frame
// subscriber process
void *ctx = zmq_ctx_new ();
void *sub = zmq_socket (ctx, ZMQ_SUB);
zmq_connect (sub, "tcp://localhost:5556");
zmq_setsockopt (sub, ZMQ_SUBSCRIBE, "status", 6);See it in a real stack
No architecture uses ZeroMQ yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from2007–2023
In 2006 iMatix designed AMQP, which gave open source developers perhaps the first reusable recipe for a messaging system. Pieter Hintjens later wrote that it remained “relatively complex, expensive, and brittle”, and that broker-based messaging adds a big box that becomes a bottleneck, a single point of failure and something an operations team has to watch day and night.
Hintjens, CEO of iMatix, registered zeromq.org in May 2007 and started ZeroMQ with Martin Sustrik, its architect and lead developer until December 2011. The zero first meant “zero broker” and as close to zero latency as possible. In March 2010 Hintjens announced that iMatix would leave the AMQP working group in favor of the simpler ZeroMQ. In 2012 two of the original developers forked it as Crossroads I/O, and Sustrik later started nanomsg, a rewrite of the core.
The community kept libzmq going under the Collective Code Construction Contract (C4). Its custom LGPLv3 license with a static-linking exception put off some corporate lawyers, so around 2016 the project began collecting permission from contributors to move to MPL 2.0. The effort stalled when Hintjens fell ill and died, restarted in March 2017, and was completed in 2023.
Why it’s built this way
- A library you link, not a broker
- A broker becomes a bottleneck, a new single point of failure and something to operate; a library with no dependencies adds no moving pieces and works in any application.
- Socket types that implement patterns
- A messaging pattern inside ZeroMQ scales more cheaply than one written in application code, and the code then works across any number of connections and transports unchanged.
- Background I/O threads with lock-free queues
- Blocking I/O doesn’t scale, and doing it in the background by hand is hard; this way applications need no locks, semaphores or other wait states.
- Opaque message bodies
- ZeroMQ doesn’t impose a format, so each application picks its own serialization, such as msgpack or Protocol Buffers.
Timeline
- 2007
Pieter Hintjens registers zeromq.org; ZeroMQ starts at iMatix with Martin Sustrik as architect
- 2010
iMatix leaves the AMQP working group to focus on ZeroMQ
- 2012
Crossroads I/O fork; JeroMQ, a pure Java port, is announced
- 2013
Draft ZMTP 3.0 adds security mechanisms, followed by CurveZMQ encryption
- 2023
Relicensing to MPL 2.0 completed; libzmq 4.3.5 released in October
Sources8 · facts checked 13 October 2026
- ZeroMQ docs: Socket API (patterns, socket types, high-water mark, draft sockets)
- ZeroMQ Guide, chapter 1: Basics (slow joiners, threads, transports)
- ZeroMQ RFC 23: ZMTP 3.0 (greeting, security mechanisms)
- ZeroMQ: License (MPL 2.0, old LGPLv3 license)
- ZeroMQ Guide: Preface (ZeroMQ in a hundred words)
- Wikipedia: ZeroMQ (JeroMQ and NetMQ ports)
- libzmq releases on GitHub (4.3.5, Oct 2023)
- zeromq/libzmq on GitHub (MPL 2.0)