Go examples and CLI clients for the NATS messaging system.
This repo contains go-gettable nats.go examples and client code as well as api examples from the documentation.
Install your own server, or optionally utilize the demo server
- Get and run nats-sub:
go get github.com/nats-io/go-nats-examples/tools/nats-sub nats-sub -s demo.nats.io subject_name
- Get and run nats-pub:
go get github.com/nats-io/go-nats-examples/tools/nats-pub nats-pub -s demo.nats.io subject_name msg
- Verify publisher output:
Published [subject_name] : 'message'
- Verify subscriber output:
Listening on [subject_name] [#1] Received on [subject_name]: 'message'
The patterns directory contains a listing of example messaging patterns: