Merge branch 'master' of git@github.com:sustrik/zeromq2

This commit is contained in:
Martin Sustrik 2010-05-31 06:11:42 +02:00
commit 3bb60da0d0
7 changed files with 228 additions and 71 deletions

View File

@ -9,6 +9,8 @@ $(top_srcdir)/foreign/xmlParser/xmlParser.cpp \
$(top_srcdir)/foreign/xmlParser/xmlParser.hpp $(top_srcdir)/foreign/xmlParser/xmlParser.hpp
dist-hook: dist-hook:
-cp $(top_srcdir)/builds/redhat/zeromq.spec $(distdir)/zeromq.spec
-sed s/\@PACKAGE_VERSION\@/@PACKAGE_VERSION@/ -i $(distdir)/zeromq.spec
-rm -rf $(distdir)/foreign/openpgm/@pgm_basename@ -rm -rf $(distdir)/foreign/openpgm/@pgm_basename@
distclean-local: distclean-local:
-rm -rf $(top_srcdir)/foreign/openpgm/@pgm_basename@ -rm -rf $(top_srcdir)/foreign/openpgm/@pgm_basename@

130
builds/redhat/zeromq.spec Normal file
View File

@ -0,0 +1,130 @@
Name: zeromq
Version: @PACKAGE_VERSION@
Release: 1%{?dist}
Summary: The ZeroMQ messaging library
Group: Applications/Internet
License: LGPLv3+
URL: http://www.zeromq.org/
Source: http://www.zeromq.org/local--files/area:download/%{name}-%{version}.tar.gz
Prefix: %{_prefix}
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: uuid-devel, gcc, make, gcc-c++, libstdc++-devel
Requires: uuid, libstdc++
# Build pgm only on supported archs
%ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
BuildRequires: glib2-devel
Requires: glib2
%endif
%description
The 0MQ lightweight messaging kernel is a library which extends the
standard socket interfaces with features traditionally provided by
specialised messaging middleware products. 0MQ sockets provide an
abstraction of asynchronous message queues, multiple messaging
patterns, message filtering (subscriptions), seamless access to
multiple transport protocols and more.
This package contains the ZeroMQ shared library.
%package devel
Summary: Development files and static library for the ZeroMQ library
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}, pkgconfig
%description devel
The 0MQ lightweight messaging kernel is a library which extends the
standard socket interfaces with features traditionally provided by
specialised messaging middleware products. 0MQ sockets provide an
abstraction of asynchronous message queues, multiple messaging
patterns, message filtering (subscriptions), seamless access to
multiple transport protocols and more.
This package contains ZeroMQ related development libraries and header files.
%prep
%setup -q
%build
%ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
%configure --with-pgm
%else
%configure
%endif
%{__make} %{?_smp_mflags}
%install
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
# Install the package to build area
%makeinstall
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root,-)
# docs in the main package
%doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README
# libraries
%{_libdir}/libzmq.so.0
%{_libdir}/libzmq.so.0.0.0
%attr(0755,root,root) %{_bindir}/zmq_forwarder
%attr(0755,root,root) %{_bindir}/zmq_queue
%attr(0755,root,root) %{_bindir}/zmq_streamer
%{_mandir}/man7/zmq.7.gz
%{_mandir}/man1/zmq_forwarder.1.gz
%{_mandir}/man1/zmq_queue.1.gz
%{_mandir}/man1/zmq_streamer.1.gz
%files devel
%defattr(-,root,root,-)
%{_includedir}/zmq.h
%{_includedir}/zmq.hpp
%{_libdir}/libzmq.la
%{_libdir}/libzmq.a
%{_libdir}/pkgconfig/libzmq.pc
%{_libdir}/libzmq.so
%{_mandir}/man3/zmq_bind.3.gz
%{_mandir}/man3/zmq_close.3.gz
%{_mandir}/man3/zmq_connect.3.gz
%{_mandir}/man3/zmq_init.3.gz
%{_mandir}/man3/zmq_msg_close.3.gz
%{_mandir}/man3/zmq_msg_copy.3.gz
%{_mandir}/man3/zmq_msg_data.3.gz
%{_mandir}/man3/zmq_msg_init.3.gz
%{_mandir}/man3/zmq_msg_init_data.3.gz
%{_mandir}/man3/zmq_msg_init_size.3.gz
%{_mandir}/man3/zmq_msg_move.3.gz
%{_mandir}/man3/zmq_msg_size.3.gz
%{_mandir}/man3/zmq_poll.3.gz
%{_mandir}/man3/zmq_recv.3.gz
%{_mandir}/man3/zmq_send.3.gz
%{_mandir}/man3/zmq_setsockopt.3.gz
%{_mandir}/man3/zmq_socket.3.gz
%{_mandir}/man3/zmq_strerror.3.gz
%{_mandir}/man3/zmq_term.3.gz
%{_mandir}/man3/zmq_version.3.gz
%{_mandir}/man7/zmq_cpp.7.gz
%{_mandir}/man7/zmq_epgm.7.gz
%{_mandir}/man7/zmq_inproc.7.gz
%{_mandir}/man7/zmq_ipc.7.gz
%{_mandir}/man7/zmq_pgm.7.gz
%{_mandir}/man7/zmq_tcp.7.gz
%changelog
* Sat Apr 10 2010 Mikko Koppanen <mkoppanen@php.net> 2.0.7-1
- Initial packaging

View File

@ -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

View File

@ -4,34 +4,36 @@ zmq_bind(3)
NAME NAME
---- ----
zmq_bind - assign a local address to a socket zmq_bind - accept connections on a socket
SYNOPSIS SYNOPSIS
-------- --------
*int zmq_bind (void '*socket', const char '*address');* *int zmq_bind (void '*socket', const char '*endpoint');*
DESCRIPTION DESCRIPTION
----------- -----------
The _zmq_bind()_ function shall assign a local address specified by the The _zmq_bind()_ function shall create an endpoint for accepting connections
'address' argument to the socket referenced by the 'socket' argument. and bind it to the socket referenced by the 'socket' argument.
The 'address' argument is a string consisting of two parts as follows: The 'endpoint' argument is a string consisting of two parts as follows:
'transport'://'endpoint'. The 'transport' part specifies the underlying 'transport'`://`'address'. The 'transport' part specifies the underlying
transport protocol to use. The meaning of the 'endpoint' part is specific to transport protocol to use. The meaning of the 'address' part is specific to
the underlying transport protocol selected. 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]
'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7]
'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7] 'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7]
'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7] 'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7]
'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7]
'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7]
A single socket may have an arbitrary number of local addresses assigned to it With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
using _zmq_bind()_, while also being connected to an arbitrary number of peer multiple endpoints using _zmq_connect()_, while simultaneously accepting
addresses using _zmq_connect()_. incoming connections from multiple endpoints bound to the socket using
_zmq_bind()_. Refer to linkzmq:zmq_socket[3] for a description of the exact
semantics involved when connecting or binding a socket to multiple endpoints.
RETURN VALUE RETURN VALUE
@ -63,7 +65,7 @@ EXAMPLE
/* Create a ZMQ_PUB socket */ /* Create a ZMQ_PUB socket */
void *socket = zmq_socket (context, ZMQ_PUB); void *socket = zmq_socket (context, ZMQ_PUB);
assert (socket); assert (socket);
/* Bind it to a in-process transport with the endpoint 'my_publisher' */ /* Bind it to a in-process transport with the address 'my_publisher' */
int rc = zmq_bind (socket, "inproc://my_publisher"); int rc = zmq_bind (socket, "inproc://my_publisher");
assert (rc == 0); assert (rc == 0);
/* Bind it to a TCP transport on port 5555 of the 'eth0' interface */ /* Bind it to a TCP transport on port 5555 of the 'eth0' interface */

View File

@ -4,34 +4,36 @@ zmq_connect(3)
NAME NAME
---- ----
zmq_connect - connect a socket to a peer address zmq_connect - connect a socket
SYNOPSIS SYNOPSIS
-------- --------
*int zmq_connect (void '*socket', const char '*address');* *int zmq_connect (void '*socket', const char '*endpoint');*
DESCRIPTION DESCRIPTION
----------- -----------
The _zmq_connect()_ function shall connect the socket referenced by the The _zmq_connect()_ function shall connect the socket referenced by the
'socket' argument to a peer address specified by the 'address' argument. 'socket' argument to the endpoint specified by the 'endpoint' argument.
The 'address' argument is a string consisting of two parts as follows: The 'endpoint' argument is a string consisting of two parts as follows:
'transport'`://`'endpoint'. The 'transport' part specifies the underlying 'transport'`://`'address'. The 'transport' part specifies the underlying
transport protocol to use. The meaning of the 'endpoint' part is specific to transport protocol to use. The meaning of the 'address' part is specific to
the underlying transport protocol selected. 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]
'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7]
'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7] 'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7]
'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7] 'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7]
'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7]
'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7]
A single socket may be connected to an arbitrary number of peer addresses using With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
_zmq_connect()_, while also having an arbitrary number of local addresses multiple endpoints using _zmq_connect()_, while simultaneously accepting
assigned to it using _zmq_bind()_. incoming connections from multiple endpoints bound to the socket using
_zmq_bind()_. Refer to linkzmq:zmq_socket[3] for a description of the exact
semantics involved when connecting or binding a socket to multiple endpoints.
NOTE: The connection will not be performed immediately but as needed by 0MQ. NOTE: The connection will not be performed immediately but as needed by 0MQ.
Thus a successful invocation of _zmq_connect()_ does not indicate that a Thus a successful invocation of _zmq_connect()_ does not indicate that a
@ -61,7 +63,7 @@ EXAMPLE
/* Create a ZMQ_SUB socket */ /* Create a ZMQ_SUB socket */
void *socket = zmq_socket (context, ZMQ_SUB); void *socket = zmq_socket (context, ZMQ_SUB);
assert (socket); assert (socket);
/* Connect it to an in-process transport with the endpoint 'my_publisher' */ /* Connect it to an in-process transport with the address 'my_publisher' */
int rc = zmq_connect (socket, "inproc://my_publisher"); int rc = zmq_connect (socket, "inproc://my_publisher");
assert (rc == 0); assert (rc == 0);
/* Connect it to the host server001, port 5555 using a TCP transport */ /* Connect it to the host server001, port 5555 using a TCP transport */

View File

@ -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_.

View File

@ -19,28 +19,8 @@ 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.
Publish-subscribe pattern
~~~~~~~~~~~~~~~~~~~~~~~~~
The publish-subscribe pattern is used for one-to-many distribution of data from
a single _publisher_ to multiple _subscribers_ in a fanout fashion.
Socket type:: 'ZMQ_PUB'
Compatible peer sockets:: 'ZMQ_SUB'
A socket of type 'ZMQ_PUB' is used by a _publisher_ to distribute data.
Messages sent are distributed in a fanout fashion to all connected peers.
The _zmq_recv()_ function is not implemented for this socket type.
Socket type:: 'ZMQ_SUB'
Compatible peer sockets:: 'ZMQ_PUB'
A socket of type 'ZMQ_SUB' is used by a _subscriber_ to subscribe to data
distributed by a _publisher_. Initially a 'ZMQ_SUB' socket is not subscribed to
any messages, use the 'ZMQ_SUBSCRIBE' option of _zmq_setsockopt()_ to specify
which messages to subscribe to. The _zmq_send()_ function is not implemented
for this socket type.
Request-reply pattern Request-reply pattern
@ -65,27 +45,68 @@ sequence of _zmq_recv(request)_ and subsequent _zmq_send(reply)_ calls. Each
reply is routed to the _client_ that issued the last received request. reply is routed to the _client_ that issued the last received request.
Parallelized pipeline pattern Publish-subscribe pattern
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
The parallelized pipeline pattern is used for distributing work between The publish-subscribe pattern is used for one-to-many distribution of data from
_components_ of a pipeline. Work travels down the pipeline and at each stage a single _publisher_ to multiple _subscribers_ in a fanout fashion.
can be processed by any number of _components_ in parallel.
Socket type:: 'ZMQ_UPSTREAM' Socket type:: 'ZMQ_PUB'
Compatible peer sockets:: 'ZMQ_DOWNSTREAM' Compatible peer sockets:: 'ZMQ_SUB'
A socket of type 'ZMQ_UPSTREAM' is used by a _component_ of a pipeline to A socket of type 'ZMQ_PUB' is used by a _publisher_ to distribute data.
receive messages from upstream stages of the pipeline. Messages are fair-queued Messages sent are distributed in a fanout fashion to all connected peers.
from among all connected upstream _components_. The _zmq_send()_ function is The _zmq_recv()_ function is not implemented for this socket type.
not implemented for this socket type.
Socket type:: 'ZMQ_SUB'
Compatible peer sockets:: 'ZMQ_PUB'
A socket of type 'ZMQ_SUB' is used by a _subscriber_ to subscribe to data
distributed by a _publisher_. Initially a 'ZMQ_SUB' socket is not subscribed to
any messages, use the 'ZMQ_SUBSCRIBE' option of _zmq_setsockopt()_ to specify
which messages to subscribe to. The _zmq_send()_ function is not implemented
for this socket type.
Pipeline pattern
~~~~~~~~~~~~~~~~
The pipeline pattern is used for distributing data to _nodes_ arranged in
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
connected to multiple _nodes_ data is processed by all connected _nodes_ in
parallel.
Socket type:: 'ZMQ_DOWNSTREAM' Socket type:: 'ZMQ_DOWNSTREAM'
Compatible peer sockets:: 'ZMQ_UPSTREAM' Compatible peer sockets:: 'ZMQ_UPSTREAM'
A socket of type 'ZMQ_DOWNSTREAM' is used by a _component_ of a pipeline to A socket of type 'ZMQ_DOWNSTREAM' is used by a pipeline _node_ to send messages
send messages to downstream stages of the pipeline. Messages are load-balanced to downstream pipeline _nodes_. Messages are load-balanced to all connected
to all connected downstream _components_. The _zmq_recv()_ function is not downstream _nodes_. The _zmq_recv()_ function is not implemented for this
implemented for this socket type. socket type.
Socket type:: 'ZMQ_UPSTREAM'
Compatible peer sockets:: 'ZMQ_DOWNSTREAM'
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.
Exclusive pair pattern
~~~~~~~~~~~~~~~~~~~~~~
The exclusive pair pattern is used for communicating exclusively between two
peers.
Socket type:: 'ZMQ_PAIR'
Compatible peer sockets:: 'ZMQ_PAIR'
A socket of type 'ZMQ_PAIR' can only be connected to a single peer at any one
time. No message routing or filtering is performed on messages sent over a
'ZMQ_PAIR' socket.
NOTE: 'ZMQ_PAIR' sockets are experimental, and are currently missing several
features such as auto-reconnection. Developers should consider other patterns
in preference to the exclusive pair pattern.
RETURN VALUE RETURN VALUE