Skip to content

jon-ton/nats-jetstream-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NATS JetStream Example Environment

A simple docker-compose environment to bring up a NATS JetStream environment to play with.

Some golang JetStream example code copied from: https://github.com/shijuvar/go-distsys

Bring up Environment

docker compose up -d

This will bring up:

The prometheus targets and grafana datasource and dashboards should be automatically provisioned.

The NATS JetStream dashboard should look something like this:
Nats JetStream Grafana Dashboard

Publish messages and subscribe to streams

Run the go publisher:

cd create-order go run main.go

Run the order-review subscriber (subscribes to ORDERS.created and publishes ORDERS.approved messages)

cd monitor go run main.go

Run the monitor subscriber (simply subscribes to all subjects in the ORDERS stream)

cd monitor go run main.go

Open up the NATS CLI

Open up the NATS cli:

docker run -ti --network go-nats_nats natsio/nats-box

Some useful commands:

nats -s nats account info nats -s nats stream ls nats -s nats stream ORDERS nats -s nats stream view ORDERS nats -s nats stream info ORDERS nats -s nats stream view ORDERS 2 nats -s nats consumer info ORDERS monitor nats -s nats consumer info ORDERS order-review nats -s nats stream rm ORDERS

About

NATS JetStream docker-compose example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 100.0%