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

Interrupting Flask app in iPythonNotebook cause ZMQerror

I'm trying to run a most simple demo of flask app in an iPython notebook like this. from flask import Flask app = Flask(__name__) @app.route('/') def hello_world():. return 'Hello World!' if __name__ == '__main__': app.run(d) The first…
zaxliu
  • 2,726
  • 1
  • 22
  • 26
8
votes
1 answer

ZMQ: Multiple request/reply-pairs

ZeroMQs Pub/Sub pattern makes it easy for the server to reply to the right client. However, it is less obvious how to handle communication that cannot be resolved within two steps, i.e. protocols where multiple request/reply pairs are necessary.…
DaVinci
  • 1,391
  • 2
  • 12
  • 27
8
votes
3 answers

Using the majordomo broker with asynchronous clients

While reading the zeromq guide, I came across client code which sends 100k requests in a loop, and then receives the reply in a second loop. #include "../include/mdp.h" #include int main (int argc, char *argv []) { int verbose = (argc…
user1274878
  • 1,275
  • 4
  • 25
  • 56
8
votes
1 answer

zero-mq: socket.recv() call is blocking

I am trying to use zero-mq.My requirement is very simple.I want to be able to communicate between two peers in a network.I came across this program in the examples in the book. $ pub_server.py import zmq import random import sys import time port =…
liv2hak
  • 14,472
  • 53
  • 157
  • 270
8
votes
2 answers

What ZeroMQ socket type to use for inter process communication?

When I had two threads, I used PAIR socket type. But now I am using two processes that can be either on one machine or on different machines. I don't need requests and responses, I don't need sending to multiple nodes, etc. I need same thing that I…
Marko Kevac
  • 2,902
  • 30
  • 47
8
votes
3 answers

JeroMQ shutdown correctly

I am wondering how to shutdown JeroMQ properly, so far I know three methods that all have their pro and cons and I have no clue which one is the best. The situation: Thread A: owns context, shall provide start/stop methods Thread B: actual listener…
8
votes
2 answers

jeromq: closing context fails

EDIT: solved myself, see below (although I'm not sure if I've stumbled upon a bug here) Using the simple hello-world request-reply example below, closing the context at the end of the program fails: Either it simply hangs at ctx.close() or it throws…
Kevin Bader
  • 327
  • 4
  • 11
8
votes
2 answers

Can ZeroMQ be used to accept traditional socket requests?

I'm trying to re-write one of our old Servers using ZeroMQ, for now I have the following Server setup, (which works for Zmq requests): using (var context = ZmqContext.Create()) using (var server = context.CreateSocket(SocketType.REP)) { …
Mark Kadlec
  • 8,036
  • 17
  • 60
  • 96
8
votes
1 answer

Can I use ZeroMQ with HAProxy, a software-based load balancer?

HAProxy is a software-based load balancer that supports http and tcp distribution. If I use ZeroMQ with pragmatic multicast enabled (pgm), will the use of HAProxy as an intermediary between zmq peers conflict with pgm, or should I use hardware-based…
raffian
  • 31,267
  • 26
  • 103
  • 174
8
votes
2 answers

Sending an existing dict through zmq ipc

I'm trying to send an existing dict through zmq ipc socket, I can send a string with this code, but I can't send a dict object import zmq, datetime d = {0: ('356612022462768', 'EVENT', 0, '2012-12-26 15:50:16', -20.22216, -70.13723, 6.44, 134.0,…
chespinoza
  • 2,638
  • 1
  • 23
  • 46
8
votes
1 answer

JSON-based API over ZeroMQ

Most modern API's are built using JSON with request/response messaging over HTTP. Since ZeroMQ is over TCP, could JSON-based API's be built over ZeroMQ? If so, what would the advantages be? The use is developers writing apps for clients/devices…
Henry Thornton
  • 4,381
  • 9
  • 36
  • 43
8
votes
2 answers

ZMQError: Cannot assign requested address

I'm using zeromq to develop a dynamic application which operate like upnp protocol( autoconfiguration and auto-discovery of equipment on a living room). To do it so, i use zeromq to distribute messages, my problem is that when i create a socket and…
scof007
  • 415
  • 2
  • 9
  • 15
8
votes
2 answers

ZeroMQ securely over the internet

I've been working with zeroMQ a bit and I want to be able to connect securely over the Internet. I'm in ruby and could use SSL and/or some sort of shh connection but cannot find any examples of how to do this. I found this old stackoverflow link,…
John Duff
  • 38,090
  • 5
  • 35
  • 45
8
votes
3 answers

N to N async pattern in ZeroMQ?

although I went through the guide I cant find a way to do the following: we have n publishers, we have m subscribers. Each subscriber subscribes to certain type of msg(one publisher can send more than one kind of the message, multiple pubs can emit…
NoSenseEtAl
  • 28,205
  • 28
  • 128
  • 277
7
votes
1 answer

What is the best way to send async no-reply messages between peers with ØMQ?

I have a small cluster of peers (e.g. 10 nodes) already publishing and subscribing for messages. This is working fine. The cluster is static and every node knows the address of the other nodes. In my use-case I also need all the nodes to be able to…
tle
  • 95
  • 1
  • 5