2

Section NATS Server Clustering states that:

Note that NATS clustered servers have a forwarding limit of one hop. This means that each gnatsd instance will only forward messages that it has received from a client to the immediately adjacent gnatsd instances to which it has routes. Messages received from a route will only be distributed to local clients. Therefore a full mesh cluster, or complete graph, is recommended for NATS to function as intended and as described throughout the documentation.

Let's assume that I have a NATS cluster of 3 nodes: A -> B -> C ( -> denotes a route). Would you please let me know what will happen wit NATS clients in the following scenario:

  • A message sent to node A
  • Node A suddenly terminates before delivering the message to node B

Thanks in advance

anhldbk
  • 4,559
  • 5
  • 29
  • 37

1 Answers1

4

In the case you described, the message will be dropped.

Core NATS provides a delivery guarantee of "at most once", so if you cannot tolerate lost messages, your application needs to detect that the message never arrived in its destination and resend the message. You might detect this from a timeout using the request/reply pattern, or implement your own type of remediation for lost messages.

Alternatively, you can use NATS streaming, which provides log based persistence and sits atop NATS. It will guarantee the message will be delivered "at least once".

Raghu Ariga
  • 1,059
  • 1
  • 19
  • 28