ZeroMQ

table of contents

ZeroMQ base

Socket types and NetMQ counterparts

ZeroMQ pattern NetMQ corresponding class comments
PUB PublisherSocket used to publish messages
SUB SubscriberSocket subscribe to message(s)
XPUB XPublisherSocket used to publish messages. XPUB and XSUB are used where you may have to bridge different networks.
XSUB XSubscriberSocket used to subscribe to message(s) where you may have to bridge different networks
REQ RequestSocket synchronous blocking socket, that would initiate a request message.
REP ResponseSocket synchronous blocking socket, that would provide a response to a message.
ROUTER RouterSocket broker socket. Fully asynchronous (non blocking). tracks every connection. identity frame. ROUTER is like an asynchronous REP socket
DEALER DealerSocket Dealer is typically a worker socket, and doesn’t provide any routing (ie it doesn’t know about the calling sockets identity), but it is fully asynchronous (non blocking). DEALER is like an asynchronous REQ socket.
PUSH PushSocket push messages at worker, within a pipeline pattern
PULL PullSocket within a pipeline pattern, which would pull from a PUSH socket and then do some work.
PAIR PairSocket PairSocket

Socket pairs

ROUTER Broker and REQ Workers.
Standard ZeroMQ Socket Pairs comments
PUB and SUB Pub/Sub arrangement
XPUB and XSUB Pub/Sub arrangement
REQ/DEALER and REP/ROUTER _In the same way that we can replace REQ with DEALER ….we can replace REP with ROUTER. This gives us an asnchronous server that can talk to multiple REQ clients at the same time._ . Where we use a REQ socket, we can use a DEALER; we just have to read and write the envelope ourselves. Where we use a REP socket, we can stick a ROUTER; we just need to manage the identities ourselves
REQ client talking to a REP server A standard synchronous request/response arrangement. The REQ client must initiate the message flow
REQ and ROUTER A standard synchronous request with an asynchronous server responding, where the router will know how to do the routing back the correct request socket
DEALER and REP An asynchronous request with a synchronous server responding. When we use a standard REQ (ie not a DEALER for the client) socket, it does one extra thing for us, which is to include an empty frame. So when we switch to using a Dealer for the client, we need to do that part ourselves, by using SendMore
DEALER and ROUTER An asynchronous request with an asynchronous server responding, where the router will know how to do the routing back the correct request socket. ROUTER Broker and DEALER Workers. 1-to-N use case where one server talks asynchronously to multiple workers. Turn this upside down to get a very useful N-to-1 architecture where various clients talk to a single server, and do this asynchronously
DEALER and DEALER An asynchronous request with an asynchronous server responding (this should be used if the DEALER is talking to one and only one peer).
ROUTER and ROUTER An asynchronous request with an asynchronous server responding. perfect for N-to-N connections, but it’s the most difficult combination to use.
PUSH and PULL Push socket connected to a Pull, which you may see in a divide and conquer type arrangement.
PAIR and PAIR Pair sockets should ONLY talk to another pair, it is a well defined pair, Typically you would use this for connecting two threads in a process.
In the request-reply pattern, the message envelope holds the return address for replies. It is how a ŘMQ network with no state can create round-trip request-reply dialogs. The ŘMQ reply envelope formally consists of zero or more reply addresses, followed by an empty frame (the envelope delimiter), followed by the message body (zero or more frames). The envelope is created by multiple sockets working together in a chain. - [zguide](http://zguide.zeromq.org/php:all) - [cs:hwclient](http://zguide.zeromq.org/cs:hwclient) - [cs:hwserver](http://zguide.zeromq.org/cs:hwserver) - [hintjens blog](http://hintjens.com/blog:86) - [0mq Labs](http://zeromq.org/docs:labs) - [0mq Messaging Presentation Slides Pdf](http://zeromq.wdfiles.com/local--files/area%3Awhitepapers/messaging-2010-02-17.pdf) - [**(Pieter Hintjens) ZeroMQ: Messaging for Many Applications (ebook)**](http://www.reedbushey.com/89Zeromq.pdf) - [**(Pieter Hintjens) ZeroMQ: Messaging for Many Applications (local)**](../../CARTI/0mq/2013.Zeromq.Messaging.For.many.Applications.pdf ) ## NetMQ Update: As of 2014 C# binding (CLRZMQ) is no longer maintained and NetMQ is the default choice for ZeroMQ and .Net. Update: As of 2014 NetMQ is a stable project with a growing community and is in production use by multiple companies. January 20th, 2016
Id Version Description Authors DownloadCount
NetMQ 3.3.2.2 A 100% native C# port of the lightweight high performance messaging library ZeroMQ NetMQ 36985
clrzmq 2.2.5 The clrzmq project contains .NET bindings for ŘMQ (ZeroMQ), an open source, high performance transport layer. Includes a compiled version of the native libzmq library. WARNING: This package targets the x86 build platform. zeromq 25312
clrzmq-x64 2.2.5 The clrzmq project contains .NET bindings for ŘMQ (ZeroMQ), an open source, high performance transport layer. Includes a compiled version of the native libzmq library. WARNING: This package targets the x64 build platform. zeromq 10238
ZeroMQ 4.1.0.17 ZeroMQ CLR namespace metadings, Pieter Hintjens, Martin Sustrik 7272
- [netmq-asp-net](http://somdoron.com/2014/08/netmq-asp-net/) - [netmq-xpub-xsub](http://netmq.readthedocs.org/en/latest/xpub-xsub/) - [ZeroMQ-NetMq-Quick-Intro](http://blog.scottlogic.com/2015/03/20/ZeroMQ-Quick-Intro.html) - [Comparing OpenDDS and ZeroMQ Usage and Performance](http://mnb.ociweb.com/mnb/MiddlewareNewsBrief-201004.html) - [SO tag netmq](http://stackoverflow.com/questions/tagged/netmq) - [NetMQ on GitHub](https://github.com/zeromq/netmq) ## Sacha barber demos - [**All demos on GitHub**](https://github.com/sachabarber/ZeroMqDemos) - [zeromq-1-introduction](https://sachabarbs.wordpress.com/2014/08/19/zeromq-1-introduction/) - [ZeroMQ #2 : The Socket Types](https://sachabarbs.wordpress.com/2014/08/21/zeromq-2-the-socket-types-2/) - [ZeroMQ #3 : Socket Options/Identity And SendMore](https://sachabarbs.wordpress.com/2014/08/26/zeromq-3-socket-optionsidentity-and-sendmore/) - [ZeroMQ #4 : Multiple Sockets Polling](https://sachabarbs.wordpress.com/2014/08/27/zeromq-4-multiple-sockets-polling/) - [ZeroMQ #5 : Sending From Multiple Sockets](https://sachabarbs.wordpress.com/2014/08/30/zeromq-sending-from-multiple-sockets/) - [ZeroMQ #6: Divide And Conquer](https://sachabarbs.wordpress.com/2014/09/01/zeromq-6-divide-and-conquer/) - [ZeroMQ #7: A Simple Actor Model](https://sachabarbs.wordpress.com/2014/09/05/zeromq-7-a-simple-actor-model/) ## ZeroMQ and services - [WebAPI-or-WCF](http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx) - [NetMQ-RX-Streaming-Data-Demo-App](http://www.codeproject.com/Articles/853476/NetMQplus-RX-Streaming-Data-Demo-App-of) - [Lightweihjt rpc 0mq and proto](http://blogs.mulesoft.com/biz/mule/lightweight-rpc-with-%C3%B8mq-and-protocol-buffers/) - [omq and proto](http://www.dotkam.com/2011/09/09/zeromq-and-google-protocol-buffers/) - [rpcz](https://github.com/thesamet/rpcz) - [zmqpbexample](https://github.com/joshrotenberg/zmqpbexample) - [cpp zmq_protobuf](http://docs.biicode.com/c++/examples/zmq_protobuf.html) - [brokerless whitepaper zguide](http://zeromq.org/whitepapers:brokerless) - [NetMQRxDemo Sacha](https://github.com/sachabarber/NetMQRxDemo)