go_sample_microservice

command module
v0.0.0-...-34bbb14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2020 License: MIT Imports: 8 Imported by: 0

README

Simple Cache Go microservice

This is a simple Microservice which will provide top commodity (Iron, Gold, Platinium and silver). Gorilla is used as web toolkit, It makes use of go-cache to store the data in cache-memory, scribble is used as database, Any update in the database Apache Kafaka will notify so that cache will be updated automatically.

Packages

  • gorilla : A Web Toolkit.
  • Sarama : Go client library for Apache Kafka.
  • scribble : A tiny JSON database in Golang.
  • go-cache : An in-memory key:value store.
  • Swagger : An API documentation toolkit

Usage

  • Clone the Repo
git clone https://github.com/akshayvijapur/Go_sample_microservice.git
  • Go to the repo directory
cd Go_sample_microservice/
  • perform docker compose up
docker-compose up -d
  • Initialize the Cache by calling to InitializeCommand REST API
curl -X POST http://localhost:3000/api/v1/InitializeCommodity
  • Now Cache will be updated with Commodity data from DB.

  • Get the Latest Commodity by calling GetCommodity REST API

curl http://localhost:3000/api/v1/GetCommodity
  • As DB is being updated with new Commodity data after every 10 seconds, Kafka will notify the receiver which in turns will update the cache.

Documentation

Overview

Sample go Cache microservice.

This application will retrieve the top commodities from the market.

Schemes: http
Host: localhost:3000
Version: 0.0.1
License: MIT http://opensource.org/licenses/MIT
Contact: akshay vijapur<akshayvijapur@gmail.com>

Consumes:
- text/plain

Produces:
- text/plain

swagger:meta

Directories

Path Synopsis
src
db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL