Skip to content

johnatteachable/natsy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NATSY

An example project for learning how to use nats-server and async event patterns from Go services.

Overview

Project contains two small Go services: Api-Producer & Consumer. This repo is for learning purposes and to help us establish working norms when using this technology.

Api-Producer

Exposes API endpoints that cause async events to be created

  • POST /products

    • Creates event on subject
    • price.created
  • GET /ping

    • Creates event on subjects
    • ping.db.status
    • ping.api.status
    • ping.redis.status
  • API Request and Event models are clearly separated.

  • Higher level EventEnvelope captures lower level subject specific data

Consumer

Simulates long running consumer for messages. Trying to show power and importance of subject naming through ping example Subscribed to subjects:

  • ping.*.status
  • price.created

Processes top level EventEnvelope before switching on subject to parse underlying data.

Simulates a DB connection with a map

  • TODO add API to access keys

Running

From main directory run

docker compose up --build

About

Small example of NATS usages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published