Questions tagged [zeromq]

ZeroMQ (ZMQ, 0MQ, ØMQ) is a high-performance, asynchronous, transport-class agnostic, messaging library, aimed at use in scalable, distributed and/or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a ZeroMQ system can run without a dedicated message broker. License: LGPL with static linking exception

ZeroMQ (Zero Message Queue) is a high-performance, asynchronous, transport-class agnostic messaging library, aimed to use in scalable distributed or concurrent applications. It provides a set of paradigms, similar to a message queue, but unlike message-oriented middleware, a ZeroMQ system operates without any dedicated, central / singular message-handling broker. Instead of that, several Scalable Formal Communication Patterns are provided as a particular communication archetype, serving as prototypes to create smart, more complex messaging / signalling planes, used for inter-connecting a distributed system.

The library is designed to have a familiar socket-style API and supports many transport-classes, incl. { inproc:// | ipc:// | tipc:// | vmci:// | tcp:// | pgm:// | epgm:// | udp:// }.

A more recent extension allows to use also the norm:// reliable multicast and unicast protocol, so far at least for (X)PUB/(X)SUB Scalable Formal Communications Pattern Archetypes.

ZeroMQ is developed by iMatix Corporation together with a large community of contributors. There are third-party bindings for almost every popular programming languages, from , ,,,, to , and many more.

ZeroMQ (also spelled ØMQ, 0MQ or ZMQ)


The basic ZeroMQ patterns join many-to-many topologies of distributed-agents, where specific message-handling behaviours ( aka Scalable Formal Communication Pattern Archetypes ) take place:

REQ / REP : the Request–Reply archetype

Connects a set of clients to a set of services. This is a remote procedure call and task distribution pattern.

PUB / SUB : the Publish–Subscribe archetype

Connects a set of publishers to a set of subscribers. This is a data distribution pattern.

PUSH / PULL : the Push–Pull (pipeline) archetype

Connects nodes in a fan-out / fan-in pattern that can have multiple steps, and loops. This is a parallel task distribution and collection pattern.

PAIR / PAIR Exclusive pair

Connects two sockets in an exclusive pair. (This is an advanced low-level pattern for specific use cases.)

ROUTER / DEALER formerly also known as XREQ / XREP archetype

XPUB / XSUB archetype extends the classical PUB/SUB archetype with adding also the application-level access to the subscription-management events.


Useful links:

You can get more information in the following sites:

3306 questions
16
votes
1 answer

zmq send with NOBLOCK raise Resource temporarily unavailable

This code will raise Resource temporarily unavailable when call with NOBLOCK: context = zmq.Context() sender = context.socket(zmq.PUSH) sender.bind('tcp://*:15556') sender.send('KeEpAliv', zmq.NOBLOCK) # this line will throw…
schemacs
  • 2,783
  • 8
  • 35
  • 53
16
votes
4 answers

Retrieving subscriber count using zeromq PUB/SUB sockets

Is it possible to get the total count of subscribers from a PUB socket in zeromq? Thanks!
AlexLiesenfeld
  • 2,872
  • 7
  • 36
  • 57
16
votes
2 answers

How can I monitor/manage queue in ZeroMQ?

First of all, I'm new to ZeroMQ and message queue systems, so what I'm trying to do may be solved through a different approach. I'm designing a messaging system that does the following: Multiple clients connect to a broker and send the id of an…
jonstjohn
  • 59,650
  • 8
  • 43
  • 55
15
votes
1 answer

Is it possible to run ZeroMQ on an Arduino

I'm wondering, whether it is possible to communicate with an Arduino via ZeroMQ. I want to use the Arduino to control some equipment and want to have most of the application sit on a computer. For that it would be nice if the Arduino and the…
Markus
  • 161
  • 1
  • 5
15
votes
3 answers

Combining pub/sub with req/rep in zeromq

How can a client both subscribe and listen to replies with zeromq? That is, on the client side I'd like to run a loop which only receives messages and selectively sends requests, and on the server side I'd like to publish most of the time, but to…
MockInterface
  • 161
  • 1
  • 1
  • 4
15
votes
2 answers

How does ZeroMQ REQ/REP handle multiple clients?

I started to use ZeroMQ for IPC and made a simple echo-client/server and I'm surprised about one thing. Here is the C++ code (using zmq.hpp and zmq_addon.hpp). Server: zmq::context_t context(1); zmq::socket_t socket(context,…
Patrick B.
  • 11,773
  • 8
  • 58
  • 101
15
votes
3 answers

zeromq persistence patterns

Who has to manages the persistent in the ZeroMQ? When we use the ZeroMQ clients in Python language, what are the plug-ins/modules available to manage the persistent? I would like to know the patterns to use the ZeroMQ.
user90150
15
votes
3 answers

Is this the right way to use a messaging queue?

I am new to messaging queues, and right now I am using ZeroMQ on my Linux server. I am using PHP to write both the client and the server. This is mainly used for processing push notifications. I am using the basic REQ-REP Formal-Communication…
Parthapratim Neog
  • 4,352
  • 6
  • 43
  • 79
15
votes
1 answer

ZeroMQ vs socket.io

I want major difference between ZeroMQ and socket.io Performance. ( Is it faster? Scalable? ) Applications. ( Is it used for real time services? ) Browsers Support. ( Which browsers are supported? )
3ppps
  • 933
  • 1
  • 11
  • 24
15
votes
5 answers

zeromq: reset REQ/REP socket state

When you use the simple ZeroMQ REQ/REP pattern you depend on a fixed send()->recv() / recv()->send() sequence. As this article describes you get into trouble when a participant disconnects in the middle of a request because then you can't just start…
frans
  • 8,868
  • 11
  • 58
  • 132
15
votes
3 answers

0MQ - get message ip

First, I want to give thanks for that amazing lib! I love it. A client is connecting himself to a server. The server should save the IP and do stuff with it later on (I really need the IP). I found that answer:…
user1347198
15
votes
4 answers

Is there a FIFO message queuing service offering the high availability of Amazon SQS?

Would have loved to use Amazon SQS if it provided some semblance of FIFO access, but the sequence seems to completely random. Is there something that would provide me FIFO queuing as-a-cloud-service with the high availability of SQS? If that is…
user393144
  • 1,575
  • 3
  • 14
  • 21
14
votes
6 answers

ZeroMQ PUB socket buffers all my out going data when it is connecting

I noticed that a zeromq PUB socket will buffers all outgoing data if it is connecting, for example import zmq import time context = zmq.Context() # create a PUB socket pub = context.socket (zmq.PUB) pub.connect("tcp://127.0.0.1:5566") # push some…
Fang-Pen Lin
  • 13,420
  • 15
  • 66
  • 96
14
votes
1 answer

FastAPI how to add ZMQ to eventloop

I am surprised this has not really been asked in detail but for some reason i could not find this question or solution anywhere. It seems to be that a lot of people are having a problem where you have a fastAPI application that also needs to…
user3554230
  • 283
  • 2
  • 11
14
votes
3 answers

ImportError: cannot import name constants

I'm trying to run a simple piece of code using pyzmq. I am using Python 2.7 and pyzmq 14.5 $ python --version Python 2.7.6 $ sudo find /usr -name…
arun6174
  • 163
  • 1
  • 1
  • 6