Commit 13f3481e authored by Pieter Hintjens's avatar Pieter Hintjens

Further cleanups on reference manual

- fixed unwrapped text in new man pages
- fixed over-long lines in older pages, where possible
- removed reference to old standalong devices from index page
- added refernce to new zmq_device[3] documented from index page
- some minor spelling corrections
parent 6ff19399
...@@ -140,20 +140,14 @@ Local in-process (inter-thread) communication transport:: ...@@ -140,20 +140,14 @@ Local in-process (inter-thread) communication transport::
Devices Devices
~~~~~~~ ~~~~~~~
Apart from the 0MQ library the 0MQ distribution includes 'devices' which are 0MQ provides 'devices', which are building blocks that act as intermediate
building blocks intended to serve as intermediate nodes in complex messaging nodes in complex messaging topologies. Devices can act as brokers that other
topologies. nodes connect to, proxies that connect through to other nodes, or any mix of
these two models.
The following devices are provided:
You can start a device in an application thread, see linkzmq:zmq_device[3],
Forwarder device for request-response messaging:: and you can also start devices externally, as standalone processes, see
linkzmq:zmq_queue[1] linkzmq:zmq_deviced[1].
Forwarder device for publish-subscribe messaging::
linkzmq:zmq_forwarder[1]
Streamer device for parallelized pipeline messaging::
linkzmq:zmq_streamer[1]
ERROR HANDLING ERROR HANDLING
......
...@@ -24,10 +24,15 @@ the underlying transport protocol selected. ...@@ -24,10 +24,15 @@ the underlying transport protocol selected.
The following transports are defined: The following transports are defined:
'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7] 'inproc'::
'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7] local in-process (inter-thread) communication transport, see
'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7] linkzmq:zmq_inproc[7]
'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7] 'ipc'::
local inter-process communication transport, see linkzmq:zmq_ipc[7]
'tcp'::
unicast transport using TCP, see linkzmq:zmq_tcp[7]
'pgm', 'epgm'::
reliable multicast transport using PGM, see linkzmq:zmq_pgm[7]
With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
multiple endpoints using _zmq_connect()_, while simultaneously accepting multiple endpoints using _zmq_connect()_, while simultaneously accepting
......
...@@ -24,10 +24,15 @@ the underlying transport protocol selected. ...@@ -24,10 +24,15 @@ the underlying transport protocol selected.
The following transports are defined: The following transports are defined:
'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7] 'inproc'::
'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7] local in-process (inter-thread) communication transport, see
'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7] linkzmq:zmq_inproc[7]
'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7] 'ipc'::
local inter-process communication transport, see linkzmq:zmq_ipc[7]
'tcp'::
unicast transport using TCP, see linkzmq:zmq_tcp[7]
'pgm', 'epgm'::
reliable multicast transport using PGM, see linkzmq:zmq_pgm[7]
With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
multiple endpoints using _zmq_connect()_, while simultaneously accepting multiple endpoints using _zmq_connect()_, while simultaneously accepting
......
...@@ -13,7 +13,8 @@ SYNOPSIS ...@@ -13,7 +13,8 @@ SYNOPSIS
DESCRIPTION DESCRIPTION
----------- -----------
The _zmq_device()_ function starts a built-in 0MQ device. The 'device' argument is one of: The _zmq_device()_ function starts a built-in 0MQ device. The 'device'
argument is one of:
'ZMQ_QUEUE':: 'ZMQ_QUEUE'::
starts a queue device starts a queue device
...@@ -22,48 +23,77 @@ The _zmq_device()_ function starts a built-in 0MQ device. The 'device' argument ...@@ -22,48 +23,77 @@ The _zmq_device()_ function starts a built-in 0MQ device. The 'device' argument
'ZMQ_STREAMER':: 'ZMQ_STREAMER'::
starts a streamer device starts a streamer device
The device connects a frontend socket to a backend socket. Conceptually, data flows from frontend to backend. Depending on the socket types, replies may flow in the opposite direction. The device connects a frontend socket to a backend socket. Conceptually, data
flows from frontend to backend. Depending on the socket types, replies may
flow in the opposite direction.
Before calling _zmq_device()_ you must set any socket options, and connect or bind both frontend and backend sockets. The two conventional device models are: Before calling _zmq_device()_ you must set any socket options, and connect or
bind both frontend and backend sockets. The two conventional device models
are:
*proxy*:: *proxy*::
bind frontend socket to an endpoint, and connect backend socket to downstream components. A proxy device model does not require changes to the downstream topology but that topology is static (any changes require reconfiguring the device). bind frontend socket to an endpoint, and connect backend socket to
downstream components. A proxy device model does not require changes to
the downstream topology but that topology is static (any changes require
reconfiguring the device).
*broker*:: *broker*::
bind frontend socket to one endpoint and bind backend socket to a second endpoint. Downstream components must now connect into the device. A broker device model allows a dynamic downstream topology (components can come and go at any time). bind frontend socket to one endpoint and bind backend socket to a second
endpoint. Downstream components must now connect into the device. A
broker device model allows a dynamic downstream topology (components can
come and go at any time).
_zmq_device()_ runs in the current thread and returns only if/when the current context is closed. _zmq_device()_ runs in the current thread and returns only if/when the current
context is closed.
QUEUE DEVICE QUEUE DEVICE
------------ ------------
'ZMQ_QUEUE' creates a shared queue that collects requests from a set of clients, and distributes these fairly among a set of services. Requests are fair-queued from frontend connections and load-balanced between backend connections. Replies automatically return to the client that made the original request. 'ZMQ_QUEUE' creates a shared queue that collects requests from a set of
clients, and distributes these fairly among a set of services. Requests are
fair-queued from frontend connections and load-balanced between backend
connections. Replies automatically return to the client that made the original
request.
This device is part of the 'request-reply' pattern. The frontend speaks to clients and the backend speaks to services. You should use 'ZMQ_QUEUE' with a 'ZMQ_XREP' socket for the frontend and a 'ZMQ_XREQ' socket for the backend. Other combinations are not documented. This device is part of the 'request-reply' pattern. The frontend speaks to
clients and the backend speaks to services. You should use 'ZMQ_QUEUE' with a
'ZMQ_XREP' socket for the frontend and a 'ZMQ_XREQ' socket for the backend.
Other combinations are not documented.
Refer to linkzmq:zmq_socket[3] for a description of these socket types. Refer to linkzmq:zmq_socket[3] for a description of these socket types.
FORWARDER DEVICE FORWARDER DEVICE
---------------- ----------------
'ZMQ_FORWARDER' collects messages from a set of publishers and forwards these to a set of subscribers. You will generally use this to bridge networks, e.g. read on TCP unicast and forward on multicast. 'ZMQ_FORWARDER' collects messages from a set of publishers and forwards these
to a set of subscribers. You will generally use this to bridge networks, e.g.
read on TCP unicast and forward on multicast.
This device is part of the 'publish-subscribe' pattern. The frontend speaks to publishers and the backend speaks to subscribers. You should use 'ZMQ_FORWARDER' with a 'ZMQ_SUB' socket for the frontend and a 'ZMQ_PUB' socket for the backend. Other combinations are not documented. This device is part of the 'publish-subscribe' pattern. The frontend speaks to
publishers and the backend speaks to subscribers. You should use
'ZMQ_FORWARDER' with a 'ZMQ_SUB' socket for the frontend and a 'ZMQ_PUB' socket
for the backend. Other combinations are not documented.
Refer to linkzmq:zmq_socket[3] for a description of these socket types. Refer to linkzmq:zmq_socket[3] for a description of these socket types.
STREAMER DEVICE STREAMER DEVICE
--------------- ---------------
'ZMQ_STREAMER' collects tasks from a set of pushers and forwards these to a set of pullers. You will generally use this to bridge networks. Messages are fair-queued from pushers and load-balanced to pullers. 'ZMQ_STREAMER' collects tasks from a set of pushers and forwards these to a set
of pullers. You will generally use this to bridge networks. Messages are
fair-queued from pushers and load-balanced to pullers.
This device is part of the 'pipeline' pattern. The frontend speaks to pushers and the backend speaks to pullers. You should use 'ZMQ_STREAMER' with a 'ZMQ_PULL' socket for the frontend and a 'ZMQ_PUSH' socket for the backend. Other combinations are not documented. This device is part of the 'pipeline' pattern. The frontend speaks to pushers
and the backend speaks to pullers. You should use 'ZMQ_STREAMER' with a
'ZMQ_PULL' socket for the frontend and a 'ZMQ_PUSH' socket for the backend.
Other combinations are not documented.
Refer to linkzmq:zmq_socket[3] for a description of these socket types. Refer to linkzmq:zmq_socket[3] for a description of these socket types.
RETURN VALUE RETURN VALUE
------------ ------------
The _zmq_device()_ function always returns `-1` and 'errno' set to *ETERM* (the 0MQ 'context' associated with either of the specified sockets was terminated). The _zmq_device()_ function always returns `-1` and 'errno' set to *ETERM* (the
0MQ 'context' associated with either of the specified sockets was terminated).
EXAMPLE EXAMPLE
......
...@@ -14,22 +14,32 @@ SYNOPSIS ...@@ -14,22 +14,32 @@ SYNOPSIS
DESCRIPTION DESCRIPTION
----------- -----------
Starts one or more 0MQ devices. If you specify a DEVICE, FRONTEND, and BACKEND then _zmq_device_ starts a single device acting as a mini-broker. If you specify a CONFIGFILE, you can configure _zmq_device_ to start multiple concurrent devices with arbitrary configurations. Starts one or more 0MQ devices. If you specify a DEVICE, FRONTEND, and BACKEND
then _zmq_device_ starts a single device acting as a mini-broker. If you
specify a CONFIGFILE, you can configure _zmq_device_ to start multiple
concurrent devices with arbitrary configurations.
*Note* - zmq_deviced is not yet implemented. This is a design. *Note* - zmq_deviced is not yet implemented. This is a design.
MINI-BROKER USAGE MINI-BROKER USAGE
----------------- -----------------
Runs as a mini-broker that accepts connects to both frontend and backend. This creates a hub-and-spoke topology in which all peers connect to the device. This is a robust and easy to manage topology. Runs as a mini-broker that accepts connects to both frontend and backend. This
creates a hub-and-spoke topology in which all peers connect to the device. This
is a robust and easy to manage topology.
DEVICE is one of: *queue*, *forwarder*, or *streamer*. See linkzmq:zmq_device[3] for a specification of these device types. DEVICE is one of: *queue*, *forwarder*, or *streamer*. See
linkzmq:zmq_device[3] for a specification of these device types.
FRONTEND and BACKEND are endpoints in the format 'transport'`://`'address', See linkzmq:zmq_bind[3] for a specification of valid transports and addresses. FRONTEND and BACKEND are endpoints in the format 'transport'`://`'address', See
linkzmq:zmq_bind[3] for a specification of valid transports and addresses.
CONFIGURED USAGE CONFIGURED USAGE
---------------- ----------------
CONFIGFILE is the name of an XML file, readable by 'zmq_device'. This file provides a specification of the devices to start and how to connect and/or bind their frontends and backends. If CONFIGFILE is absent or *-* then the configuration is read from standard input. CONFIGFILE is the name of an XML file, readable by 'zmq_device'. This file
provides a specification of the devices to start and how to connect and/or bind
their frontends and backends. If CONFIGFILE is absent or *-* then the
configuration is read from standard input.
The configuration file has this general syntax: The configuration file has this general syntax:
...@@ -52,19 +62,28 @@ The configuration file has this general syntax: ...@@ -52,19 +62,28 @@ The configuration file has this general syntax:
---- ----
*iothreads*:: *iothreads*::
specifies the number of I/O threads for the process. Specify this only for high-volume scenarios. See linkzmq:zmq_init[3]. specifies the number of I/O threads for the process. Specify this only for
high-volume scenarios. See linkzmq:zmq_init[3].
*device*:: *device*::
defines one device. For each device element you define, 'zmq_device' will start a thread. defines one device. For each device element you define, 'zmq_device' will
start a thread.
*frontend*:: *frontend*::
defines the frontend for the device. Occurs once per device element. You may override the default socket type. defines the frontend for the device. Occurs once per device element. You
may override the default socket type.
*backend*:: *backend*::
defines the backend for the device. Occurs once per device element. You may override the default socket type. defines the backend for the device. Occurs once per device element. You
may override the default socket type.
*set*:: *set*::
defines a socket option for the frontend or backend. The valid names are *hwm*, *swap*, *identity*, *subscribe*, *unsubscribe*, *rate*, *recovery_ivl*, *mcast_loop*, *sndbuf*, and *rcvbuf*. See linkzmq:zmq_setsockopt[3]. defines a socket option for the frontend or backend. The valid names are
*hwm*, *swap*, *identity*, *subscribe*, *unsubscribe*, *rate*,
*recovery_ivl*, *mcast_loop*, *sndbuf*, and *rcvbuf*. See
linkzmq:zmq_setsockopt[3].
*bind*:: *bind*::
binds the frontend or backend to the specified endpoint. See linkzmq:zmq_bind[3]. binds the frontend or backend to the specified endpoint. See
linkzmq:zmq_bind[3].
*connect*:: *connect*::
binds the frontend or backend to the specified endpoint. See linkzmq:zmq_connect[3]. binds the frontend or backend to the specified endpoint. See
linkzmq:zmq_connect[3].
SOCKET TYPES SOCKET TYPES
------------ ------------
...@@ -78,9 +97,12 @@ By default 'zmq_device' uses these socket types: ...@@ -78,9 +97,12 @@ By default 'zmq_device' uses these socket types:
*streamer* device:: *streamer* device::
frontend is *pull*, backend is *push*. frontend is *pull*, backend is *push*.
You can override the socket type for frontend or backend. The valid types are: *req*, *rep*, *xreq*, *xrep*, *sub*, *pub*, *pull*, *push*, and *pair*. See linkzmq:zmq_socket[3]. You can override the socket type for frontend or backend. The valid types are:
*req*, *rep*, *xreq*, *xrep*, *sub*, *pub*, *pull*, *push*, and *pair*. See
linkzmq:zmq_socket[3].
*Note*: if you use a *sub* socket you must explicitly set a subscription filter or your socket will not receive any data. *Note*: if you use a *sub* socket you must explicitly set a subscription filter
or your socket will not receive any data.
EXAMPLE EXAMPLE
......
...@@ -70,7 +70,7 @@ ZMQ_SWAP: Retrieve disk offload size ...@@ -70,7 +70,7 @@ ZMQ_SWAP: Retrieve disk offload size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_SWAP' option shall retrieve the disk offload (swap) size for the The 'ZMQ_SWAP' option shall retrieve the disk offload (swap) size for the
specified 'socket'. A socket which has 'ZMQ_SWAP' set to a non-zero value may specified 'socket'. A socket which has 'ZMQ_SWAP' set to a non-zero value may
exceed it's high water mark; in this case outstanding messages shall be exceed its high water mark; in this case outstanding messages shall be
offloaded to storage on disk rather than held in memory. offloaded to storage on disk rather than held in memory.
The value of 'ZMQ_SWAP' defines the maximum size of the swap space in bytes. The value of 'ZMQ_SWAP' defines the maximum size of the swap space in bytes.
......
...@@ -55,7 +55,7 @@ and a port number. ...@@ -55,7 +55,7 @@ and a port number.
An 'interface' may be specified by either of the following: An 'interface' may be specified by either of the following:
* The interface name as defined by the operating system. * The interface name as defined by the operating system.
* The primary IPv4 address assigned to the interface, in it's numeric * The primary IPv4 address assigned to the interface, in its numeric
representation. representation.
NOTE: Interface names are not standardised in any way and should be assumed to NOTE: Interface names are not standardised in any way and should be assumed to
...@@ -63,7 +63,7 @@ be arbitrary and platform dependent. On Win32 platforms no short interface ...@@ -63,7 +63,7 @@ be arbitrary and platform dependent. On Win32 platforms no short interface
names exist, thus only the primary IPv4 address may be used to specify an names exist, thus only the primary IPv4 address may be used to specify an
'interface'. 'interface'.
A 'multicast address' is specified by an IPv4 multicast address in it's numeric A 'multicast address' is specified by an IPv4 multicast address in its numeric
representation. representation.
......
...@@ -100,13 +100,13 @@ associated 0MQ 'context' was terminated. ...@@ -100,13 +100,13 @@ associated 0MQ 'context' was terminated.
EXAMPLE EXAMPLE
------- -------
.Polling indefinitely for input events on both a 0MQ socket and a standard socket. .Polling indefinitely for input events on both a 0MQ socket and a TCP socket.
---- ----
zmq_pollitem_t items [2]; zmq_pollitem_t items [2];
/* First item refers to 0MQ socket 'socket' */ /* First item refers to 0MQ socket 'socket' */
items[0].socket = socket; items[0].socket = socket;
items[0].events = ZMQ_POLLIN; items[0].events = ZMQ_POLLIN;
/* Second item refers to standard socket 'fd' */ /* Second item refers to TCP socket 'fd' */
items[1].socket = NULL; items[1].socket = NULL;
items[1].fd = fd; items[1].fd = fd;
items[1].events = ZMQ_POLLIN; items[1].events = ZMQ_POLLIN;
......
...@@ -48,7 +48,7 @@ Applicable socket types:: all ...@@ -48,7 +48,7 @@ Applicable socket types:: all
ZMQ_SWAP: Set disk offload size ZMQ_SWAP: Set disk offload size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_SWAP' option shall set the disk offload (swap) size for the specified The 'ZMQ_SWAP' option shall set the disk offload (swap) size for the specified
'socket'. A socket which has 'ZMQ_SWAP' set to a non-zero value may exceed it's 'socket'. A socket which has 'ZMQ_SWAP' set to a non-zero value may exceed its
high water mark; in this case outstanding messages shall be offloaded to high water mark; in this case outstanding messages shall be offloaded to
storage on disk rather than held in memory. storage on disk rather than held in memory.
......
...@@ -31,7 +31,8 @@ colon and the TCP port number to use. ...@@ -31,7 +31,8 @@ colon and the TCP port number to use.
An 'interface' may be specified by either of the following: An 'interface' may be specified by either of the following:
* The interface name as defined by the operating system. * The interface name as defined by the operating system.
* The primary IPv4 address assigned to the interface, in it's numeric representation. * The primary IPv4 address assigned to the interface, in its numeric
representation.
* The wildcard `*`, meaning that the interface address is unspecified. * The wildcard `*`, meaning that the interface address is unspecified.
NOTE: Interface names are not standardised in any way and should be assumed to NOTE: Interface names are not standardised in any way and should be assumed to
...@@ -48,15 +49,15 @@ a colon and the TCP port number to use. ...@@ -48,15 +49,15 @@ a colon and the TCP port number to use.
A 'peer address' may be specified by either of the following: A 'peer address' may be specified by either of the following:
* The DNS name of the peer. * The DNS name of the peer.
* The IPv4 address of the peer, in it's numeric representation. * The IPv4 address of the peer, in its numeric representation.
WIRE FORMAT WIRE FORMAT
----------- -----------
0MQ messages are transmitted over TCP in frames consisting of an encoded 0MQ messages are transmitted over TCP in frames consisting of an encoded
'payload length', followed by a 'flags' field and the message body. The 'payload 'payload length', followed by a 'flags' field and the message body. The
length' is defined as the combined length in octets of the message body and the 'payload length' is defined as the combined length in octets of the message
'flags' field. body and the 'flags' field.
For frames with a 'payload length' not exceeding 254 octets, the 'payload For frames with a 'payload length' not exceeding 254 octets, the 'payload
length' shall be encoded as a single octet. The minimum valid 'payload length' length' shall be encoded as a single octet. The minimum valid 'payload length'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment