Advanced NATS concepts
Using NATS in production-grade systems requires advanced capabilities such as clustering, monitoring, and security. We will cover these advanced concepts in this section.
Clustering the NATS server
NATS is designed to support complex distributed systems at a global scale. NATS supports clustering to deploy multiple NATS-server nodes connected in a full mesh topology to provide improved reliability and failure handling. If a server goes down for some reason, the client can automatically connect to a different server that contains a replica of the message. NATS servers form a mesh dynamically by gossiping and connecting to all the known servers without needing to preconfigure the nodes. Hence, clusters can grow, shrink, and self-heal.
Once the cluster has been set up, the NATS servers replicate messages by forwarding the messages to connected servers. It has a forwarding limit of 1 node. Every server on the cluster forwards the messages to one of the...