Skip to content

Watch a RabbitMQ system

In this tutorial, you start a small bike-rental system that uses a real RabbitMQ server. You follow one booking across three exchanges. Then you turn on the tracer to see more messages.

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-rabbitmq
docker compose up -d --build

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

Open http://localhost:4749.

After some seconds, you see eight lanes. Each lane is one routing key on one exchange. The text below the name of a lane does not show the exchange. Move the pointer over the name to see it.

Lane Exchange Kind of exchange
booking.requested, booking.confirmed, booking.rejected events Topic
payment.charged, payment.declined, email.sent events Topic
charge payments Direct
audit audit Fanout

You see only new messages. RabbitMQ does not keep old messages for a new queue.

  1. Click the time range button at the top right. Then click Last 30 s.
  2. Move the pointer onto the timeline. The button shows Live · paused, and the view does not move.
  3. Drag across approximately 5 seconds of the timeline. You now see thin marks.
  4. Click a mark in the booking.requested lane.

A panel opens. The trace shows the events of this booking:

booking.requested, audit, charge, payment.charged, booking.confirmed, and email.sent.

A blue line on the timeline connects them. The services send plain JSON. streamview connects the messages because all of them have the field bookingId.

4. Make sure that streamview takes no messages

Section titled “4. Make sure that streamview takes no messages”
  1. Open http://localhost:15673. This is the management page of RabbitMQ.
  2. Type streamview as the user name and as the password.
  3. Click Queues and Streams.

You see the six queues of the services, and one queue with a name that starts with amq.gen-. That queue is the queue of streamview. The queues of the services have no messages that wait.

5. See the messages that go directly to a queue

Section titled “5. See the messages that go directly to a queue”

The trace has a step that is not there. The bookings service sends a message directly to the queue email.send. This message does not go through one of the three exchanges, thus streamview does not see it.

The tracer of RabbitMQ gives a copy of each published message. Turn it on:

docker compose exec rabbitmq rabbitmqctl trace_on

Then start streamview again with --trace:

docker compose run --rm -d -p 127.0.0.1:4750:4747 streamview \
rabbitmq --url amqp://streamview:streamview@rabbitmq:5672 --correlation-field bookingId --trace

Open http://localhost:4750. After some seconds, you see a ninth lane, email.send. Open a booking.requested event again. The trace now has the step email.send before email.sent.

docker compose down -v --remove-orphans

The command stops the containers and deletes the data.

  • You started a system with a topic exchange, a direct exchange, and a fanout exchange.
  • You followed one booking across the three exchanges.
  • You saw that streamview uses a queue of its own.
  • You used the tracer to see a message that goes directly to a queue.

To connect streamview to your own server, see Connect to RabbitMQ.