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
7
votes
1 answer

ZeroMQ usage in web application: how frontend interacts with backend

I heard some facts about ZeroMQ, and I think it's very powerful thing. But now I try to imagine how it can be applied in web application. Could you make an example of using ZeroMQ in web applications? So, the first that strikes me - simple chat…
Dmitry Belaventsev
  • 6,347
  • 12
  • 52
  • 75
7
votes
0 answers

High CPU usage when using pebbe zmq proxy at high message rates

I am currently experimenting with ZMQ as a possible message broker for IPCs. Version -> ZMQv4 I am using pebbe ZMQ , a go library over zmq's C library and performing tests. I am rate testing it with a message rate of 1500 messages/sec and 10000…
7
votes
3 answers

Problem installing zmq on amazon linux (unable to find uuid)

I'm trying to put together an AMI on EC2, and am currently stalled on building 0mq. initially, I got this error while running ./configure checking for uuid_generate in -luuid... no configure: error: cannot link with -luuid, install uuid-dev. I…
Ben
  • 4,980
  • 3
  • 43
  • 84
7
votes
5 answers

How to use ZeroMQ in an GTK/QT/Clutter application?

In gtk applications all execution is taking place inside the gtk_main function. And other graphical frame works have similar event loops like app.exec for QT and clutter_main for Clutter. However ZeroMQ is based on the assumption that there is an…
hlovdal
  • 26,565
  • 10
  • 94
  • 165
7
votes
3 answers

zero mq pub/sub with multipart not working

Here's my script. #!/usr/bin/env python import traceback import sys import zmq from time import sleep print "Creating the zmq.Context" context = zmq.Context() print "Binding the publisher to the local socket at port 5557" sender =…
bitcycle
  • 7,632
  • 16
  • 70
  • 121
7
votes
3 answers

How can I receive multipart messages with ZeroMQ?

I can't get ZeroMQ C++ wrapper to receive multipart messages. The same code using C version works just fine, but it leads to an exception with no explanations at all with C++. The multipart handling code is as follows: int _tmain(int argc, _TCHAR*…
mahonya
  • 9,247
  • 7
  • 39
  • 68
7
votes
1 answer

How can I send a ZeroMQ message from a ROUTER socket to a specific DEALER socket using cppzmq?

I've put together this minimal example in order to send a message from a Router socket to a specific DEALER socker (That has it's identity set). When running these two programs it appears to hang on the ROUTER waiting from the reply from the DEALER,…
Vpaladino
  • 320
  • 2
  • 12
7
votes
4 answers

PUB/SUB with short-lived publisher and long-lived subscribers

Context: OS: Linux (Ubuntu), language: C (actually Lua, but this should not matter). I would prefer a ZeroMQ-based solution, but will accept anything sane enough. Note: For technical reasons I can not use POSIX signals here. I have several identical…
Alexander Gladysh
  • 39,865
  • 32
  • 103
  • 160
7
votes
1 answer

How to I transfer an image(opencv Matrix/numpy array) from c++ publisher to python sender via ZeroMQ?

I know how to send a string message from c++ to python via zeromq. Here's the code for sending a string message I know : C++ sender code : void *context = zmq_ctx_new(); void *publisher = zmq_socket(context, ZMQ_PUB); int bind = zmq_bind(publisher,…
Rohit Lal
  • 2,791
  • 1
  • 20
  • 36
7
votes
1 answer

ZMQ socket connection timeout

I'm using C++ binding for ZMQ (cppzmq) and I'm trying to set the connection timeout of TCP socket using a .setsockopt()-method like this: int connectTimeout = 1000; socket.setsockopt(ZMQ_CONNECT_TIMEOUT, &connectTimeout,…
kreuzerkrieg
  • 3,009
  • 3
  • 28
  • 59
7
votes
2 answers

ZeroMQ operation throws EXC: [ Operation cannot be accomplished in current state ]

I am trying to make a class that will be able to send data and then receive them. Right now, it is working only for the first send/receive and with another attempt to .send() it will throw an error below. >Traceback (most recent call last): File…
Denyk
  • 99
  • 2
  • 7
7
votes
2 answers

What is the difference between using ZMQ PUB with .connect() or .bind() methods?

In Python ZMQ publisher/subscriber sample template, the publisher uses .bind() method and the subscriber uses .connect() method, that connected to the bind IP address. But we can replace .bind() and .connect() each with the other. My question is…
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
7
votes
2 answers

How to control the source IP address of a ZeroMQ packet on a machine with multiple IPs?

The Python standard library's socket.create_connection()method has a source address option, for controlling which source IP a connection uses. How do I do the same thing with a Python ZeroMQ socket, given a machine that has multiple addresses? In…
ceridwen
  • 550
  • 2
  • 5
  • 14
7
votes
1 answer

Sending messages from PHP script to multiple Ratchet Websocket apps (via ZMQ Socket)

So, I am running a Ratchet (php) websocket server with multiple routes that connect do multiple Ratchet apps (MessageComponentInterfaces): //loop $loop = \React\EventLoop\Factory::create(); //websocket app $app = new…
Erik Verboom
  • 365
  • 3
  • 17
7
votes
1 answer

How to protect ZeroMQ Request Reply pattern against potential drops of messages?

I'm trying to implement a ZeroMQ pattern on the TCP layer between a c# application and distributed python servers. I've gotten a version working with the request-reply REQ/REP pattern and it seems relatively stable when testing on localhost.…
UndeadBob
  • 1,110
  • 1
  • 15
  • 34