NATS-orderStream-service is a Go service that processes order data. The service connects and subscribes to a channel in nats-streaming, writes the received data to a PostgreSQL database, and caches them in-memory. In case of service failure, the cache is restored from the database. The service also launches an HTTP server that outputs data by id from the cache.
The project uses Docker and Makefile to simplify the installation and launch process. Here are the main commands:
# Building Docker images
make build
# Launching Docker containers
make up
# After launching Docker Compose, manually run 'model.sql' to create the necessary tables
# Running the Go service
make run
# Stopping Docker containers
make down
After launching the service, you can get order data using its id. Just go to the following URL in your browser:
http://localhost:8080/order?id={id}
where {id}
is the order id.