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.
1. Start the example
Section titled “1. Start the example”Get the streamview source code, and start the example:
git clone https://github.com/event-catalog/streamviewcd streamview/example-rabbitmqdocker compose up -d --buildThe first build takes some minutes. The command starts a RabbitMQ server, four services, and streamview.
2. Open the page
Section titled “2. Open the page”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.
3. Follow one booking
Section titled “3. Follow one booking”- Click the time range button at the top right. Then click Last 30 s.
- Move the pointer onto the timeline. The button shows Live · paused, and the view does not move.
- Drag across approximately 5 seconds of the timeline. You now see thin marks.
- Click a mark in the
booking.requestedlane.
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”- Open
http://localhost:15673. This is the management page of RabbitMQ. - Type
streamviewas the user name and as the password. - 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_onThen 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 --traceOpen 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.
6. Stop the example
Section titled “6. Stop the example”docker compose down -v --remove-orphansThe command stops the containers and deletes the data.
What you did
Section titled “What you did”- 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.