/microservices-sample

Sample project to create an application using microservices architecture

Primary LanguageJava

Microservices Sample

Build Status Docker Repository on Quay Docker Repository on Quay Docker Repository on Quay Docker Repository on Quay Docker Repository on Quay

NOTE

This repository is no longer maintained. Please refer https://github.com/microservices-sample for latest enhancements.

What is it?

"Microservices", a trending buzz word nowadays. What problems does it solve?

Many organizations nowadays are driving the technology migrations and one of the biggest challenges is to migrate from monolithic application to micro-services based application.

This mircoservices-sample project demonstrates how multiple services run independently leveraging on the best microservices patterns to enable scale, performance and resilience.

https://www.youtube.com/watch?v=AYcsnuIOW2M

Use case

The sample application has three services namely service-one, service-two and service-three. Each of the service has its own database service-one-db, service-two-db and service-three-db respectively. During the startup of the services, it persists the service name and an auto generated UUID in its perspective database and sends the data to the RabbitMQ exchange which then broadcasts the data to all the queues based on the routing key. Every microservices listens to its own RabbitMQ queue and keeps updating the database as and when it receives the data.

Below are the screens of the application.

alt tag

Clicking on the tab's one, two or three the data that you see on the screen is based on the data fetched by the respective service by calling its database.

alt tag

Notice that the UUID generated for service-one which lies in service-one-db is in sync with service-two and service-three tabs which is achieved by RabbitMQ (asychronous communication between microservices).

alt tag

alt tag

Service Registration

During the initialization of a service, it would get registered to the discovery and registration server (which in our example is Hashicorp's Consul).

alt tag

Service Discovery

When one service (say api-gateway) needs to access a resource from another service (say service-one), all it has to do is ask discovery and registration server (Consul) to give one of the service-one's instance information.

alt tag

Architecture

Below is the architectural diagram for microservices sample project.

alt tag

Technology

Microservices sample project uses a number of open source projects to work properly:

Tools

Development

Below are the steps to bring up the development environment and get started.

  1. Install Git, Java, Maven and Docker
  2. For the project using https://github.com/vmudigal/microservices-sample.git
  3. Clone the fork using https://github.com/{YOUR_GIT_ID}/microservices-sample.git
  4. Execute "cd /microservices-sample/build/docker/scripts/"
  5. To deploy docker please run "./deploy.sh docker".
  6. Access the Application at http://localhost/

Help

Feel free to reach "vijayendrap@gmail.com" incase of any concerns.