Skip to content

Connect to NATS

View as Markdown
Your servicessend messagesNATSsubjects, streamsYour servicesget each messagea subscription of its ownstreamviewonly readsYour browserthe timelineStreams with limits retention give history.Other subjects show new messages only.

You need the streamview program, Node.js, and the address of a NATS server.

Run this command with the address of your server:

streamview nats --servers localhost:4222

The first time, the command installs the NATS adapter. This takes some seconds. The browser then opens, and each subject is one lane.

  • For subjects that a JetStream stream stores, you see the history.
  • For all other subjects, you see only the messages that come after streamview starts.

Add --subjects, with a comma between the subjects. You can use the * and > wildcards.

streamview nats --servers localhost:4222 --subjects 'orders.>,payments.*'

Make one lane from subjects that contain IDs

Section titled “Make one lane from subjects that contain IDs”

If your subjects contain IDs, there are too many lanes. Add --depth with the number of subject parts that make one lane.

streamview nats --servers localhost:4222 --depth 2

With --depth 2, telemetry.courier.7 and telemetry.courier.8 are one lane, telemetry.courier. The full subject stays in the subject field of each event.

Add --latest. streamview then does not read the history of the streams.

To ignore JetStream fully, add --no-jetstream. streamview then subscribes to all subjects.

Add --correlation-field with the name of the field that all messages of one order contain.

streamview nats --servers localhost:4222 --correlation-field orderId

streamview also reads the correlationid header, the Correlation-Id header, and the traceparent header of a message.

Use one of these three options:

The server needs Add
A name and a password --user NAME --password TEXT
A token --token TEXT
A credentials file --creds FILE