Use NATS JetStream stream mirroring and sourcing for cross-account replication

domain: nats · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. On the destination NATS account/cluster, create a mirror stream that references the source stream: nats stream add --mirror <source-stream-name>; the mirror passively replicates all messages and cannot be directly published to
  2. For aggregating multiple streams into one, use a source stream instead: nats stream add --source <stream1> --source <stream2>; sources allow direct publish to the aggregate stream in addition to sourced messages
  3. Configure source/mirror with an optional FilterSubject to replicate only messages matching a subject pattern, reducing bandwidth
  4. Set StartSeq or StartTime on the mirror/source definition to begin replication from a specific point rather than the beginning of the source stream
  5. Secure cross-account replication by configuring import/export accounts in the NATS server config and granting the destination account an import permission on the source stream subjects
  6. Monitor replication lag: nats stream info <mirror-stream> shows the last sequence replicated and the source stream's last sequence; the delta is the replication lag

Known gotchas

Related routes

Configure a NATS JetStream stream's Republish setting to mirror new messages onto a core NATS subject without creating a consumer
nats · 6 steps · unrated
Create NATS JetStream streams and push/pull consumers
docs.nats.io · 5 steps · unrated
Configure a NATS JetStream consumer's ReplayPolicy alongside DeliverPolicy to replay a stream at its original publish pace instead of as fast as possible
nats · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans