I'm using NNG as my inter-server msg-queue.
Background:
My question: Does NNG automatically transmit a "Heartbeat" msg peroidically to each peer to keep the TCP connection alive, if there is no producing msg for a specific time duration?
If NOT, should I do "HeartBeat" by myself?
BTW, this is the first time I use NNG. I don't know whether there is a official/populated support forum of it, so I ask my question here.
Welcome to the NNG & distributed-processing
We can, under any circumstances send zero-sized "app-level" heartbeats, if we wish our transport be rock solid proven to be RTO
Yet, the NNG uses nn_setsockopt()
-configurator options { ... | NN_RECONNECT_IVL | NN_RECONNECT_IVL_MAX | ... }
to fine-tune low-level details, including the failed / closed sockets' reconnect management
The full call signature is :
int nn_setsockopt( int sock,
int level,
int option,
const void *val,
size_t sz
);
and a few details on NN_RECONNECT_*
-s :
NN_RECONNECT_IVL
Reconnect interval in milliseconds. After an outgoing connection is closed or fails, the socket will automatically attempt to reconnect after this many milliseconds. This is the starting value for the time, and is used in the first reconnection attempt after a successful connection is made. The default is 100.
NN_RECONNECT_IVL_MAX
Maximum reconnect interval in milliseconds. Subsequent reconnection attempts after a failed attempt are made at exponentially increasing intervals (back-off), but the interval is capped by this value. If this value is smaller thanNN_RECONNECT_IVL
, then no exponential back-off is performed, and each reconnect interval will be determined solely byNN_RECONNECT_IVL
. The default is zero.