Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
5219e4ce
Commit
5219e4ce
authored
May 27, 2010
by
Martin Lucina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify socket types in documentation, reinstate ZMQ_PAIR
parent
8408ae06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
44 deletions
+65
-44
zmq.txt
doc/zmq.txt
+2
-2
zmq_setsockopt.txt
doc/zmq_setsockopt.txt
+7
-7
zmq_socket.txt
doc/zmq_socket.txt
+56
-35
No files found.
doc/zmq.txt
View file @
5219e4ce
...
@@ -90,8 +90,8 @@ Standard sockets present a _synchronous_ interface to either connection-mode
...
@@ -90,8 +90,8 @@ Standard sockets present a _synchronous_ interface to either connection-mode
reliable byte streams (SOCK_STREAM), or connection-less unreliable datagrams
reliable byte streams (SOCK_STREAM), or connection-less unreliable datagrams
(SOCK_DGRAM). In comparison, 0MQ sockets present an abstraction of a
(SOCK_DGRAM). In comparison, 0MQ sockets present an abstraction of a
asynchronous _message queue_, with the exact queueing semantics depending on
asynchronous _message queue_, with the exact queueing semantics depending on
the socket type
(_messaging pattern_) in use. See linkzmq:zmq_socket[3] for the
the socket type
in use. See linkzmq:zmq_socket[3] for the socket types
_messaging patterns_
provided.
provided.
0MQ sockets being _asynchronous_ means that the timings of the physical
0MQ sockets being _asynchronous_ means that the timings of the physical
connection setup and teardown, reconnect and effective delivery are organized
connection setup and teardown, reconnect and effective delivery are organized
...
...
doc/zmq_setsockopt.txt
View file @
5219e4ce
...
@@ -61,13 +61,13 @@ The 'ZMQ_AFFINITY' option shall set the I/O thread affinity for connections
...
@@ -61,13 +61,13 @@ The 'ZMQ_AFFINITY' option shall set the I/O thread affinity for connections
created by subsequent _zmq_connect()_ or _zmq_bind()_ calls on the specified
created by subsequent _zmq_connect()_ or _zmq_bind()_ calls on the specified
'socket'.
'socket'.
sockets. Affinity determines which threads from the 0MQ I/O thread pool
Affinity determines which threads from the 0MQ I/O thread pool associated with
associated with the socket's _context_ shall handle newly created connections.
the socket's _context_ shall handle newly created connections. A value of zero
A value of zero specifies no affinity, meaning that work shall be distributed
specifies no affinity, meaning that work shall be distributed fairly among all
fairly among all 0MQ I/O threads in the thread pool. For non-zero values, the
0MQ I/O threads in the thread pool. For non-zero values, the lowest bit
lowest bit corresponds to thread 1, second lowest bit to thread 2 and so on.
corresponds to thread 1, second lowest bit to thread 2 and so on. For example,
For example, a value of 3 specifies that subsequent connections on 'socket'
a value of 3 specifies that subsequent connections on 'socket' shall be handled
shall be handled
exclusively by I/O threads 1 and 2.
exclusively by I/O threads 1 and 2.
See also linkzmq:zmq_init[3] for details on allocating the number of I/O
See also linkzmq:zmq_init[3] for details on allocating the number of I/O
threads for a specific _context_.
threads for a specific _context_.
...
...
doc/zmq_socket.txt
View file @
5219e4ce
...
@@ -19,7 +19,31 @@ The 'zmq_socket()' function shall create a 0MQ socket within the specified
...
@@ -19,7 +19,31 @@ The 'zmq_socket()' function shall create a 0MQ socket within the specified
argument specifies the socket type, which determines the semantics of
argument specifies the socket type, which determines the semantics of
communication over the socket.
communication over the socket.
The following _messaging patterns_ are defined:
The following sections present the socket types defined by 0MQ, grouped by the
general _messaging pattern_ built from related socket types.
Request-reply pattern
~~~~~~~~~~~~~~~~~~~~~
The request-reply pattern is used for sending requests from a _client_ to a
_service_, and receiving subsequent replies to each request sent.
Socket type:: 'ZMQ_REQ'
Compatible peer sockets:: 'ZMQ_REP'
A socket of type 'ZMQ_REQ' is used by a _client_ to send requests to and
receive replies from a _service_. This socket type allows only an alternating
sequence of _zmq_send(request)_ and subsequent _zmq_recv(reply)_ calls. Each
request sent is load-balanced among all connected _services_.
Socket type:: 'ZMQ_REP'
Compatible peer sockets:: 'ZMQ_REQ'
A socket of type 'ZMQ_REP' is used by a _service_ to receive requests from and
send replies to a _client_. This socket type allows only an alternating
sequence of _zmq_recv(request)_ and subsequent _zmq_send(reply)_ calls. Each
reply is routed to the _client_ that issued the last received request.
Publish-subscribe pattern
Publish-subscribe pattern
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
...
@@ -43,49 +67,46 @@ which messages to subscribe to. The _zmq_send()_ function is not implemented
...
@@ -43,49 +67,46 @@ which messages to subscribe to. The _zmq_send()_ function is not implemented
for this socket type.
for this socket type.
Request-reply
pattern
Pipeline
pattern
~~~~~~~~~~~~~~~~
~~~~~
~~~~~~~~~~~~~~~~
The
request-reply pattern is used for sending requests from a _client_ to a
The
pipeline pattern is used for distributing data to _nodes_ arranged in
_service_, and receiving subsequent replies to each request sent.
a pipeline. Data always flows *down* the pipeline, and each stage of the
pipeline is connected to at least one _node_. When a pipeline stage is
Socket type:: 'ZMQ_REQ'
connected to multiple _nodes_ data is processed by all connected _nodes_ in
Compatible peer sockets:: 'ZMQ_REP'
parallel.
A socket of type 'ZMQ_REQ' is used by a _client_ to send requests to and
Socket type:: 'ZMQ_DOWNSTREAM'
receive replies from a _service_. This socket type allows only an alternating
Compatible peer sockets:: 'ZMQ_UPSTREAM'
sequence of _zmq_send(request)_ and subsequent _zmq_recv(reply)_ calls. Each
request sent is load-balanced among all connected _services_.
Socket type:: 'ZMQ_REP'
A socket of type 'ZMQ_DOWNSTREAM' is used by a pipeline _node_ to send messages
Compatible peer sockets:: 'ZMQ_REQ'
to downstream pipeline _nodes_. Messages are load-balanced to all connected
downstream _nodes_. The _zmq_recv()_ function is not implemented for this
socket type.
A socket of type 'ZMQ_REP' is used by a _service_ to receive requests from and
Socket type:: 'ZMQ_UPSTREAM'
send replies to a _client_. This socket type allows only an alternating
Compatible peer sockets:: 'ZMQ_DOWNSTREAM'
sequence of _zmq_recv(request)_ and subsequent _zmq_send(reply)_ calls. Each
reply is routed to the _client_ that issued the last received request.
A socket of type 'ZMQ_UPSTREAM' is used by a pipeline _node_ to receive
messages from upstream pipeline _nodes_. Messages are fair-queued from among
all connected upstream _nodes_. The _zmq_send()_ function is not implemented
for this socket type.
Parallelized pipeline pattern
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The parallelized pipeline pattern is used for distributing work between
_components_ of a pipeline. Work travels down the pipeline and at each stage
can be processed by any number of _components_ in parallel.
Socket type:: 'ZMQ_UPSTREAM'
Exclusive pair pattern
Compatible peer sockets:: 'ZMQ_DOWNSTREAM'
~~~~~~~~~~~~~~~~~~~~~~
The exclusive pair pattern is used for communicating exclusively between two
peers.
A socket of type 'ZMQ_UPSTREAM' is used by a _component_ of a pipeline to
Socket type:: 'ZMQ_PAIR'
receive messages from upstream stages of the pipeline. Messages are fair-queued
Compatible peer sockets:: 'ZMQ_PAIR'
from among all connected upstream _components_. The _zmq_send()_ function is
not implemented for this socket type.
Socket type:: 'ZMQ_DOWNSTREAM'
A socket of type 'ZMQ_PAIR' can only be connected to a single peer at any one
Compatible peer sockets:: 'ZMQ_UPSTREAM'
time. No message routing or filtering is performed on messages sent over a
'ZMQ_PAIR' socket.
A socket of type 'ZMQ_DOWNSTREAM' is used by a _component_ of a pipeline to
NOTE: 'ZMQ_PAIR' sockets are experimental, and are currently missing several
send messages to downstream stages of the pipeline. Messages are load-balanced
features such as auto-reconnection. Developers should consider other patterns
to all connected downstream _components_. The _zmq_recv()_ function is not
in preference to the exclusive pair pattern.
implemented for this socket type.
RETURN VALUE
RETURN VALUE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment