Class: ZMQ::Socket::Req

Inherits:
ZMQ::Socket show all
Defined in:
lib/zmq/socket/req.rb,
ext/rbczmq/socket.c

Constant Summary collapse

TYPE_STR =

ZMQ::Socket::Req

A socket of type ZMQ::Socket::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::Socket#send and subsequent ZMQ::Socket#recv calls. Each request sent is load-balanced among all services, and each reply received is matched with the last issued request.

When a ZMQ::Socket::Req socket enters an exceptional state due to having reached the high water mark for all services, or if there are no services at all, then any ZMQ::Socket#send operations on the socket shall block until the exceptional state ends or at least one service becomes available for sending; messages are not discarded.

Summary of ZMQ::Socket::Req characteristics

Compatible peer sockets

ZMQ::Socket::Rep

Direction

Bidirectional

Send/receive pattern

Send, Receive, Send, Receive, …

Outgoing routing strategy

Load-balanced

Incoming routing strategy

Last peer

ZMQ::Socket#hwm option action

Block

"REQ"

Constants inherited from ZMQ::Socket

BOUND, CONNECTED, DISCONNECTED, PENDING, PROTO_REXP

Instance Method Summary collapse

Methods inherited from ZMQ::Socket

#affinity, #affinity=, #backlog, #backlog=, #bind, #close, #connect, #connect_all, #delay_attach_on_connect=, #disconnect, #endpoint, #endpoints, #events, #fd, handle_fsm_errors, #identity=, #ipv4only=, #ipv4only?, #last_endpoint, #linger, #linger=, #maxmsgsize, #maxmsgsize=, #monitor, #multicast_hops, #multicast_hops=, #poll, #poll_readable?, #poll_writable?, #rate, #rate=, #rcvbuf, #rcvbuf=, #rcvhwm, #rcvhwm=, #rcvmore?, #rcvtimeo, #rcvtimeo=, #readable?, #real_bind, #real_connect, #reconnect_ivl, #reconnect_ivl=, #reconnect_ivl_max, #reconnect_ivl_max=, #recovery_ivl, #recovery_ivl=, #recv, #recv_frame, #recv_frame_nonblock, #recv_message, #recv_nonblock, #router_mandatory=, #router_raw=, #send, #send_message, #sendm, #sndbuf, #sndbuf=, #sndhwm, #sndhwm=, #sndtimeo, #sndtimeo=, #state, #subscribe, #to_s, #type_str, #unbind, #unsubscribe, unsupported_api, #verbose=, #writable?, #xpub_verbose=

Instance Method Details

#send_frame(frame, flags = 0) ⇒ Object

Raises:



33
34
35
36
# File 'lib/zmq/socket/req.rb', line 33

def send_frame(frame, flags = 0)
  raise ZMQ::Error, "cannot send multiple frames on REQ sockets" if (flags & ZMQ::Frame::MORE) == ZMQ::Frame::MORE
  super
end

#typeObject



26
27
28
# File 'lib/zmq/socket/req.rb', line 26

def type
  ZMQ::REQ
end