1NN_REQREP(7) nanomsg 1.1.5 NN_REQREP(7)
2
3
4
6 nn_reqrep - request/reply scalability protocol
7
9 #include <nanomsg/nn.h>
10
11 #include <nanomsg/reqrep.h>
12
14 This protocol is used to distribute the workload among multiple
15 stateless workers.
16
17 Please note that request/reply applications should be stateless.
18
19 It’s important to include all the information necessary to process the
20 request in the request itself, including information about the sender
21 or the originator of the request if this is necessary to respond to the
22 request.
23
24 Sender information cannot be retrieved from the underlying socket
25 connection since, firstly, transports like IPC may not have a firm
26 notion of a message origin. Secondly, transports that have some notion
27 may not have a reliable one — a TCP disconnect may mean a new sender,
28 or it may mean a temporary loss in network connectivity.
29
30 For this reason, sender information must be included by the application
31 if required. Allocating 6 randomly-generated bytes in the message for
32 the lifetime of the connection is sufficient for most purposes. For
33 longer-lived applications, an UUID is more suitable.
34
35 Socket Types
36 NN_REQ
37 Used to implement the client application that sends requests and
38 receives replies.
39
40 NN_REP
41 Used to implement the stateless worker that receives requests and
42 sends replies.
43
44 Socket Options
45 NN_REQ_RESEND_IVL
46 This option is defined on the full REQ socket. If reply is not
47 received in specified amount of milliseconds, the request will be
48 automatically resent. The type of this option is int. Default value
49 is 60000 (1 minute).
50
52 nn_bus(7) nn_pubsub(7) nn_pipeline(7) nn_survey(7) nn_pair(7)
53 nanomsg(7)
54
56 Martin Sustrik <sustrik@250bpm.com>
57
58
59
60 2020-08-24 NN_REQREP(7)