playing with patterns and libraries for distributed systems in the Go ecosystem.
inspired by the Hashicorp consul tutorial and golang-standards/project-layout
outbox: guarantees at least once delivery of messaging by first writing events to an outbox table within transactions that mutate the database. A Go routine periodically polls the outbox table, dispatches unsent messages onto the nats message bus and updates the outbox entries as sent.
a webapi in charge of coffee listings (GetAll/GetById/Add). service implements the outbox pattern and raises events on nats broker after db mutations (e.g. adding a new coffee)
a webapi that queries for a list of coffees from the product-service on startup via message bus (nats)
- i am new to go and many things aren't in their final shape
- striving to use as few dependencies as possible to understand the problems libraries and frameworks are addressing
- secret management will not be production ready
- to do:
- extract inline variables out to env
- durable messaging
- message retry
- go 1.17
- docker 20.10.11
- make
docker network create -d bridge coffee-service-network
# run the coffee-services
docker compose up
# run unit and integration tests
make test_all
nats realtime monitoring
go get github.com/nats-io/nats-top
nats-top
nats command line tool (osx)
brew tap nats-io/nats-tools
brew install nats-io/nats-tools/nats