Home

REQREP

REQREP is a basic messaging pattern used in message-oriented middleware and libraries such as ZeroMQ and nanomsg to implement synchronous request-reply interactions. In this pattern, a requester (REQ) sends a single request to a responder (REP) and waits for a corresponding reply. The communication is intended to be strictly alternating: a REQ socket must perform a send operation followed by a receive operation, and a REP socket must perform a receive followed by a send. This makes the pair behave like a simple RPC channel, where requests are matched to replies in order.

Semantics and behavior: A REQ socket cannot issue a new request until the previous response has been

Applications and limitations: REQ/REP works well for straightforward synchronous services, such as a small number of

Limitations: It is not suited for out-of-order delivery, streaming, or asynchronous callbacks without additional framing or

received;
a
REP
must
not
emit
a
reply
until
it
has
received
a
request.
If
the
reply
is
delayed
or
lost,
the
peer
may
block
on
its
next
operation,
potentially
causing
deadlocks
in
simple
pipelines.
The
pattern
is
therefore
easy
to
reason
about
but
limits
in-flight
requests.
clients
querying
a
service
or
a
microservice
that
requires
a
tight
request-response
contract.
For
higher
throughput
or
asynchronous
workloads,
patterns
such
as
DEALER/ROUTER
or
a
brokered
queue
are
preferred,
as
they
allow
multiple
in-flight
requests
and
more
flexible
routing.
adapters.
In
practice,
developers
use
REQ/REP
for
simple
RPC-like
endpoints,
while
using
more
advanced
patterns
for
scalability.