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

ZeroMQ, can we use inproc: transport along with pub/sub messaging pattern

Scenario : We were evaluating ZeroMQ (specifically jeroMq) for an event driven mechanism. The application is distributed where multiple services (both publishers and subscribers are services) can exist either in the same jvm or in distinct nodes,…
arunvg
  • 1,209
  • 1
  • 20
  • 31
6
votes
1 answer

ZeroMQ: REQ/REP with large messages

I am trying to send large messages ( 300 MB ) over a REP-socket. There are multiple clients, each connecting to the server via a REQ-socket. The server creates a dedicated socket for every client, waits for the request ( containing an identifier )…
mteutsch
  • 61
  • 3
6
votes
1 answer

zeromq w/ Electron: Could not locate the bindings file

I'm using Windows 7 x64, nodejs 5.1.0 and Electron 0.35. I followed the instructions from Electron Quick Start app and then added the line require("zmq") to the main.js. At this point, after npm install zmq --save, electron main.js displays: Error:…
adrian.nicolau
  • 516
  • 7
  • 17
6
votes
0 answers

How to talk to R from Node.js?

I'd like to do intensive, non-interactive calculations/data analysis using R. The analysis requests would be called from a Node.js/Express backend. The input structure is a JSON of ~100kB and the calculation should run asynchronously, of course. The…
hgoebl
  • 12,637
  • 9
  • 49
  • 72
6
votes
1 answer

How to Send Cap'n Proto Message over ZMQ

The example way to send messages using Cap'n Proto needs a file descriptor to write to: ::capnp::writeMessageToFd(fd, message); But in ZMQ the message needs to be passed to a ZMQ function: zmq_send(requester, "Hello", 5,…
BAR
  • 15,909
  • 27
  • 97
  • 185
6
votes
1 answer

Abort zeromq recv() or poll() from another thread - instantly and without the need to wait for timeout

I'm using ZeroMQ in Python and C++ in many configurations and I wonder which is the most elegant way to abort a recv() or poll() from another thread (e.g. in case of controlled program termination but also if you want to stop listening without the…
frans
  • 8,868
  • 11
  • 58
  • 132
6
votes
1 answer

Subscribe Authentication With ZeroMQ

I am having a hard time understanding the ZeroMQ messaging system, so before I dive in, I wanted to see if anyone knew if what I want to do is even possible. I want to setup a pubsub server with ZeroMQ that will publish certain streams of data and…
jps
  • 11,347
  • 3
  • 23
  • 19
6
votes
2 answers

ZeroMQ pattern for load balancing work across workers based on idleness

I have a single producer and n workers that I only want to give work to when they're not already processing a unit of work and I'm struggling to find a good zeroMQ pattern. 1) REQ/REP The producer is the requestor and creates a connection to each…
Arne Claassen
  • 14,088
  • 5
  • 67
  • 106
6
votes
1 answer

zmq_ctx_term() blocks while sockets closed

I am working with ZMQ and am running into issues when destroying a context. I have the code zmq_ctx_shutdown(context); zmq_ctx_term(context); This code always blocks on zmq_ctx_term() and will also block with zmq_ctx_destoy(); however, if that call…
Daniel Underwood
  • 2,191
  • 2
  • 22
  • 48
6
votes
3 answers

Send user ID from browser to websocket server while opening connection

Before asking this question, I did my best by reading severel questions on SO (tagged Ratchet and dealing with similar issues but to no avail. I even asked a question which received no attention and I therefore deleted it to write another one…
Adib Aroui
  • 4,981
  • 5
  • 42
  • 94
6
votes
3 answers

zeromq: unicode not allowed, use send_unicode

I am getting error on zeromq python while sending strings through ROUTER SOCKET. String type messages are receveid successfully but some times, a unicode message throws exception "Type Error: unicode not allowed. use send_unicode". Although I have…
Monster
  • 71
  • 1
  • 1
  • 6
6
votes
2 answers

How to drop inactive/disconnected peers in ZMQ

I have a client/server setup in which clients send a single request message to the server and gets a bunch of data messages back. The server is implemented using a ROUTER socket and the clients using a DEALER. The communication is asynchronous. The…
Carl Larsson
  • 61
  • 1
  • 3
6
votes
1 answer

Serializing mutable state and sending it asynchronously over the network with nearly-zero-copy (Cap'n Proto + ZeroMQ)

I have an application in which I'd like to send part of its mutable state over the network to another machine (there will be a cluster of those machines) to do some CPU-intensive computations on it and get back the results. Like asynchronous RPC.…
remv
  • 73
  • 8
6
votes
1 answer

There is an example of Spyne client?

I'm trying to use spyne (http://spyne.io) in my server with ZeroMQ and MsgPack. I've followed the examples to program the server side, but i can't find any example that helps me to know how to program the client side. I've found the class…
castarco
  • 1,368
  • 2
  • 17
  • 33
6
votes
3 answers

What's the appropriate way to use Flask with zeromq in production?

I have a Flask app that accepts HTTP requests. When certain HTTP requests come in, I want to trigger a message on a zeromq stream. I'd like to keep the zeromq stream open all the time. I'm wondering what the appropriate way to do this is. Since it…
repalviglator
  • 2,196
  • 4
  • 16
  • 15