A socket of type ZMQ_PUB is used by a publisher to distribute data.
Messages sent are distributed in a fan out fashion to all connected
peers.
When a ZMQ_PUB socket enters an exceptional state due to having reached
the high water mark for a subscriber, then any messages that would be
sent to the subscriber in question shall instead be dropped until the
exceptional state ends. The zmq_send() function shall never block for
this socket type.
Table 5. Summary of ZMQ_PUB characteristics Compatible peer sockets
ZMQ_SUB
Direction Unidirectional
Send/receive pattern Send only
Incoming routing strategy N/A
Outgoing routing strategy Fan out
ZMQ_HWM option action Drop
This command
non-blocking as all Eiffel commands are in a concurrent enviroment.
Processing will flow to the next commands and queris without waiting for
the command to finish. If you need a syncronous, blocking behaviour
please use the has_sent query.
Note: a_message is destroyed (nullified) by this command. If you
want to send the same message to multiple sockets you have to copy
it (with twin or copy).
Note: A successful invocation does not indicate that the message has
been transmitted to the network, only that it has been queued on the
socket and 0MQ has assumed responsibility for the message.
is_successful and errno are updated. Possible errno values:
eagain: Non-blocking mode was requested and the message cannot be sent at the moment.
enotsup: the send operation is not supported by this socket type.
efsm: send operation cannot be performed on this socket at the
moment due to the socket not being in the appropriate state. This
error may occur with socket types that switch between several
states, such as ZMQ_REP. See the messaging patterns section of
ZMQ_SOCKET for more information.
eterm: The 0MQ context associated with the specified socket was terminated.
enotsock: The provided socket was invalid.
eintr: The operation was interrupted by delivery of a signal before the message was sent.
efault: Invalid message.
This class does not offer an analogue of this command that blocks
the control flow until a_message has been queued or an error
occurred. In fact, in order to adhere to command-query-separation
principle "a query shall never change the state of the system" so an
eventual "is_sent(a_message: ZMQ_MESSAGE): BOOLEAN' could not change
`a_message' yet since the underlying implementation (C) will nullify
the given message given a copy would be required. This requirement
coupled with the zero-copy architecture requirement that
significately concour to the efficiency of ZMQ means that an Eiffel
wrapper shall not offer such a query.
O
This command
blocks the control flow until finished. If you need a asyncronous,
non-blocking behaviour please use the post command.
Note: a_message is destroyed (nullified) by this command. If you
want to send the same message to multiple sockets you have to copy
it (with twin or copy).
Note: A successful invocation does not indicate that the message has
been transmitted to the network, only that it has been queued on the
socket and 0MQ has assumed responsibility for the message.
is_successful and errno are updated. Possible errno values:
eagain: Non-blocking mode was requested and the message cannot be sent at the moment.
enotsup: the send operation is not supported by this socket type.
efsm: send operation cannot be performed on this socket at the
moment due to the socket not being in the appropriate state. This
error may occur with socket types that switch between several
states, such as ZMQ_REP. See the messaging patterns section of
ZMQ_SOCKET for more information.
eterm: The 0MQ context associated with the specified socket was terminated.
enotsock: The provided socket was invalid.
eintr: The operation was interrupted by delivery of a signal before the message was sent.
The zmq_bind() function shall create an endpoint for accepting connections and bind it to the socket referenced by the socket
argument.
The endpoint argument is a string consisting of two parts as follows: transport://address. The transport part specifies the
underlying transport protocol to use. The meaning of the address part is specific to the underlying transport protocol
selected.
The following transports are defined:
inproc
local in-process (inter-thread) communication transport, see zmq_inproc(7)
ipc
local inter-process communication transport, see zmq_ipc(7)
tcp
unicast transport using TCP, see zmq_tcp(7)
pgm, epgm
reliable multicast transport using PGM, see zmq_pgm(7)
With the exception of ZMQ_PAIR sockets, a single socket may be connected to multiple endpoints using zmq_connect(), while
simultaneously accepting incoming connections from multiple endpoints bound to the socket using zmq_bind(). Refer to
zmq_socket(3) for a description of the exact semantics involved when connecting or binding a socket to multiple endpoints.
Connect Current socket to the endpoint specified by an_address.
an_address consists of two parts as follows: transport://address.
The transport part specifies the underlying transport protocol to
use. The meaning of the address part is specific to the underlying
transport protocolselected.
The following transports are defined:
inproc: local in-process (inter-thread) communication transport, see zmq_inproc(7) manpage
ipc: local inter-process communication transport, see zmq_ipc(7) manpage
tcp: unicast transport using TCP, see zmq_tcp(7) manpage.
pgm, epgm: reliable multicast transport using PGM, see zmq_pgm(7)
With the exception of ZMQ_PAIR sockets, a single socket may be
connected to multiple endpoints using connect, while
simultaneously accepting incoming connections from multiple
endpoints bound to the socket using bind. See each effective heirs
of ZMQ_SOCKET and creation procedures in ZMQ_CONTEXT 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. Thus a successful invocation of connect does not indicate
that a physical connection was or can actually be established.
This exception occurs when Void is passed as the expression
to inspect ("inspect on STRING only).
This exception also occurs when the inspected value selects no branch (when the keyword "else"
not used, one "when" branch _must_ be selected). Some value which is not one of the inspect
constants, if there is no Else_part
Build a FAST_ARRAY of STRINGs from a_pointer which must be of a
NULL-terminated array of C strings, that is a "char**" String
contents and array itself are copied.
Operation not supported on socket (POSIX.1) (ENOTSUP and EOPNOTSUPP have the same value on Linux, but according to POSIX.1 these error values should be distinct.)