Skip to content

emilianozublena/microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


gRPC + Golang microservice PoC

A simple idea for microservice implementation using Golang and gRPC(+protobuf)
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Contact

About The Project

This project was created with the sole purpose of learning. I come from typical object-oriented synchronous language, so moving away from that into the Golang world, came with a lot of challenges. This project was a mere excuse for me to understand topics surrounding golang (such as Types, Concurrency, etc) while trying to understand how does Golang suggest to implement things that i'm used to work with in an object-oriented language (such as polymorphism, just to name one).

There are A LOT of these examples, and this is just a humble attempt of my own, by no means this should be used in production, nor should be understood as the best way to achieve a ms arch...

The implementation is quite simple, this is a routes microservices, which will be responsible for CRUD'ing routes that a given driver will attempt to access. Each route will belong to a driver, a customer and a given order. And the solution (aka which route should the driver take to deliver the order) will be served by Routific's API

Further definition of this microservice API can be found in protobuf's folder

Built With

Getting Started

You can either choose to build the go package or just simply run it by using the go run command. Choice is yours. Keep in mind that under /internal/client you have an example gRPC client built in Golang just for testing the service. The client is doesn't have any unit tests and it'll remain that way. This client is just for validating this PoC but shouldn't even exists on a typical service repository like this one.

Prerequisites

Follow installation for Golang, gRPC and protobuf

Usage

You need to first create all the code for gRPC. If you're unfamiliar with how protoc works you should start here.

Otherwise there's a bash script for you already in this same repository:

./internal/scripts/protobgenerate.sh

After code has been generated, start the server directly:

go run main.go

Or either build it and run it

go build
./microservices

After server is running, you can play with your own client, or just use the one shipped here. The client will accept os.Args, in which you can tell the client what actions should it be taking

cd internal/client
go run main.go {command-name}

Existing command names are:

  • create
  • read
  • byDriver

Keep in mind that the arguments are hard-coded in the client itself

License

Distributed under the GPL-3.0 License. See LICENSE for more information.

Contact

Emiliano Zublena - @emilianozublena - [email protected]

Project Link: https://github.com/emilianozublena/microservices

About

PoC for Golang w/ gRPC micro-service architecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published