8. What is ? is a high-performance asynchronous messaging library developed by the “iMatix Corporation“ and an open sourcecommunity it is a “message queue” system, unlike “message oriented middleware” (no broker architecture) developed as a simple way contrary to AMQP (Advanced Message Queuing Protocol) LGPL/GPLv3 Software written in C++ 1. Introduction
9. 1. Introduction : it allows designing complex communication systems without much effort it is not a complete messaging system no out of the box product like unwrap it, configure it, start it up it is a higher level socket interface to build up your own messaging system
10. History the original designer of AMQP (Pieter Hintjens, CEO from iMatrix) started ZeroMQ on March 30, 2010 he left AMQP working group and now supports AMQP 1.0 with the new project ZeroMQ now the latest version is 2.0.10 1. Introduction
13. 2. Why use ? “If you've done any work with threads, protocols, or networks, you'll realize this is pretty much impossible. It's a dream. Even connecting a few programs across a few sockets is plain nasty, when you start to handle real life situations.”
14. Scalability one ZeroMQ socket can connect to multiple endpoints it automatically provides load balancing Simplicity the API looks simple compared with raw sockets it is really simple to deliver messages no buffer management is needed Performance no overhead of an over-engineered protocol 2. Why use ?
20. 3. Architecture concurrency model ØMQ's concurrency model may a bit confusing at first ØMQ is a multithreaded application without mutexes condition variables semaphores instead, each object will live in its own thread other threads never touch them
21. 3. Architecture concurrency model threads communicate with the aid of messages they called 'commands' to distinguish from user-level ØMQ-messages same way the objects can speak to other objects
23. 3. Architecture threading model Application ZeroMQ I/O Threads Application Thread created outside of ØMQ to access the API created inside of ØMQ to send messages
24. 3. Architecture mailboxsystem threads are only objects with a 'mailbox‘ basically mailboxes are queues to store commands threads retrieve commands from the mailbox mailbox.cpp
30. 3. Architecture possible ways to deliver a message: INPROC: an In-Process communication model IPC: an Inter-Process communication model MULTICAST: multicast via PGM, possibly encapsulated in UDP TCP: a network based transport
31. 3. Architecture PGM (Pragmatic General Multicast) is a reliablemulticasttransportprotocol provides a reliable sequence of packets to multiple recipients simultaneously making it suitable for applications like multi-receive
33. 3. Architecture possible infrastructures QUEUE: a forwarder for the request/response messaging pattern FORWARDER: a forwarder for the publish/subscribe messaging pattern STREAMER: a forwarder for the pipelined messaging pattern
35. 3. Architecture REQUEST/REPLY: bidirectional, load balanced and state based PUBLISH/SUBSCRIBE: publish to multiple recipients at once UPSTREAM / DOWNSTREAM: distribute data to nodes arranged in a pipeline PAIR: communication exclusively between peers old pattern only for specific applications
36. 3. Architecture valid socket combinations PUB and SUB REQ and REP REQ and XREP XREQ and REP XREQ and XREP XREQ and XREQ XREP and XREP PUSH and PULL PAIR and PAIR zmq.h
55. 4. Hands on! get : (only source code version) download source code (git://github.com/zeromq/zeromq2.git) build libraries (Windows MSVS or your favorite Compiler on Linux ) install on system additional language bindings only available as source package