Skip to content

Policies

The configuration of a bridge:

{
  "advertise": {"allow": ["cluster-a.public.>"], "max_subjects": 1000},
  "messages": {
    "default": "deny",
    "rules": [
      {"id": "partners", "subject": "cluster-a.public.>", "direction": "in", "cluster": "cluster-b",
       "action": "allow", "rate": 100, "burst": 200, "max_bytes": 65536},
      {"id": "out", "subject": "cluster-b.>", "direction": "out", "action": "allow"}
    ]
  },
  "trusted": {"cluster-b": "<public key>"},
  "max_payload": 900000
}

allow lists patterns of subjects that may be advertised. max_subjects limits their number.

messages

Rules are checked in order, and the first that matches decides. default decides if none matches.

Field Meaning
id Unique name
subject NATS pattern with * and >
direction in, out or both, seen from this cluster
cluster Only for this cluster. All if omitted
action allow or deny
rate, burst Messages per second and burst, for each cluster and direction
max_bytes Largest message

Rate limits survive restarts.

Limits

max_payload is at most 8 MiB, and limits messages in both directions. NATS itself allows 1 MiB by default. At most 1000 rules are allowed.