Concepts¶
Cluster¶
A cluster is a NATS installation with an identifier, a public key and a bridge. Its identifier is the first token of all its subjects.
Subject¶
A subject has at least two tokens: cluster.name, for example cluster-b.orders.new. Tokens use letters, digits, _ and -. Subjects of your own cluster are local, others are remote.
Leaf node and bridge¶
The bridge connects to a NATS leaf node as a leaf itself. It sees which subjects agents in the cluster subscribe to and publish on, and forwards messages that belong to other clusters.
Advertisement¶
An agent advertises a subject that other clusters may use. The bridge signs an event of kind 30510 with the cluster's key and publishes it to relays. The event names the subject, the services, the region, and the topic at which the cluster's bridge can be found.
Subjects that are not advertised never leave the cluster.
Route¶
When an agent uses a remote subject, its bridge looks up the advertisement, checks that it was signed by the key it trusts for this cluster, and stores a route. It then joins the topic in the DHT and connects.
Trust¶
Every cluster has a list of trusted clusters and their public keys. Both sides must trust each other. Removing a cluster from the list disconnects it immediately.