Skip to content

Watch a NATS system

In this tutorial, you start a small food-delivery system that uses a real NATS server with JetStream. You see subjects with history and subjects without history. Then you follow one order.

You need Docker and Git. You do not need to install streamview or Node.js.

Get the streamview source code, and start the example:

git clone https://github.com/event-catalog/streamview
cd streamview/example-nats
docker compose up -d --build

The first build takes some minutes. The command starts a NATS server, four services, and streamview.

Open http://localhost:4748 in your browser.

You see one lane for each subject, for example orders.created and kitchen.accepted.

Click the time range button at the top right. Then click All. The view shows all events that streamview has.

  • orders.created has events from the time when the example started. A JetStream stream stores this subject.
  • search.performed has events only from the time when streamview started. NATS does not store this subject.

streamview reads a stored subject from the first message of its stream. For the other subjects, it sees only the new messages.

4. See how streamview makes one lane from many subjects

Section titled “4. See how streamview makes one lane from many subjects”

Find the telemetry.courier lane.

Each courier sends to its own subject, for example telemetry.courier.7. The example starts streamview with --depth 2. Thus all courier subjects are one lane.

  1. Click the time range button. Then click Last 30 s.
  2. Drag across approximately five seconds of the timeline. Each event is now one thin mark.
  3. Click a mark in the orders.created lane.

The panel opens. The trace shows the steps of the order, for example kitchen.accepted and delivery.assigned. An order takes some time, thus the last steps arrive later.

  1. Wait some seconds. Then press Escape, and click the mark again.

The trace now shows more steps.

The example makes a bad release automatically, at intervals of some minutes. During the bad release, the courier service sends distanceKm as text.

  1. Click the time range button. Then click All.
  2. Press /, select is, and then select violation.

If the bad release occurred, the delivery.completed lane shows amber events. If the timeline is empty, wait some minutes and look again.

  1. Press Backspace in the empty search box to remove the filter.

Run this command in the example-nats directory:

docker compose down -v

The command stops the containers and deletes their data.

You saw a real NATS system on the timeline, with stored subjects and subjects that NATS does not store.

Next steps: