NATS is a publish subscribe messaging system based on subjects. Subscribers listening on a subject receive messages published on that subject. If the subscriber is not actively listening on the subject, the message is not received. Subscribers can use the wildcard tokens such as * and > to match a single token or to match the tail of a subject.
Go and the NATS server should be installed. Optionally you can use the demo server located at nats://demo.nats.io
1. Start the NATS server
When the server starts successfully, you will see the following messages:
2019/31/05 15:18:22.301550 [INF] Starting nats-server version 2.0.0
2019/31/05 15:18:22.301762 [INF] Listening for client connections on 0.0.0.0:4222
2019/31/05 15:18:22.301769 [INF] nats-server is ready
The NATS server listens for client connections on TCP Port 4222.
2. Start a shell or command prompt session
You will use this session to run an example NATS client subscriber program.