ZeroMQ Sockets
1314462038|%e %B %Y, %H:%M
Tags zeromq
ZeroMQ provides a scaleability layer between application endpoints. It implements several different message topologies, provided by a series of Socket Types, each with their own well-defined function and behaviour. This article summaries the behaviour and function of each Socket Type, and the most typical Socket combinations, valid in ZeroMQ 2.1.x.
ZeroMQ Socket Types
Socket | Topology | Send/Receive | Incoming Routing / Msg Action | Outgoing Routing / Msg Action | HWM Action |
---|---|---|---|---|---|
REQ | Request-Reply | Send, Receive, Send, … | Last peer / Removes empty part |
Load balanced / Prepends empty part, queue unsent msgs |
Block |
REP | Request-Reply | Receive, Send, Receive, … | Fair-queued / Retains message parts up to 1st empty part |
Last peer / Prepends retained parts, queue unsent msgs |
Drop |
DEALER | Request-Reply | Unrestricted | Fair-queued / No changes made |
Load-balanced / No changes made, queue unsent msgs |
Block |
ROUTER | Request-Reply | Unrestricted | Fair-queued / Prepends reply address to message |
Addressed peer / Strips 1st message part, drops message if identity not known or peer available |
Drop |
PUB | Pub-Sub | Send only | n/a | Fan out / No changes made, drops message if no subscribers |
Drop |
SUB | Pub-Sub | Receive only | Fair-queued, optional filtering / No changes made |
n/a | Drop |
PUSH | Pipeline | Send only | n/a | Load balanced / No changes made, queue unsent msgs |
Block |
PULL | Pipeline | Receive only | Fair-queued / No changes made |
n/a | n/a |
PAIR | Exclusive Pair | Unrestricted | n/a | Queue unsent msgs | Block |
Where:
- Fair-queued means the socket gets input from all sockets connected to it in turn.
- Load-balanced means the socket sends messages to all sockets connected to it in turn.
- Last peer means the socket sends the message to the last socket that sent it a message
- Fan-out means message is sent to all connected peers simultaneously
ZeroMQ Socket Combinations
ZeroMQ only supports the following Socket combinations in a connect-bind pair:
Further Reading
Comments: 0
Add a New Comment
page revision: 11, last edited: 30 Aug 2011 10:08