GithubHelp home page GithubHelp logo

pete1313 / microservice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ewolff/microservice

0.0 1.0 0.0 271 KB

Sample of a Microservice setup for my book. Based on Spring Cloud / Netflix / Java / Docker / Docker Compose / Docker Machine / Vagrant

License: Apache License 2.0

HTML 19.04% Java 76.48% Ruby 1.74% Shell 0.25% Dockerfile 2.49%

microservice's Introduction

Microservice Sample

German / Deutsch

This is a sample for my Microservices Book (English / German) .

This project creates a VM with the complete micro service demo system in Docker containers inside a Vagrant VM. The services are implemented in Java using Spring and Spring Cloud.

It uses three microservices:

  • Order to process orders.
  • Customer to handle customer data.
  • Catalog to handle the items in the catalog.

Technologies

  • Eureka for Lookup
  • Ribbon for Load Balancing. See the classes CatalogClient and CustomerClient in com.ewolff.microservice.order.clients in the microservice-demo-order project.
  • Hystrix is used for resilience. See CatalogClient in com.ewolff.microservice.order.clients in the microservice-demo-order project . Note that the CustomerClient won't use Hystrix. This way you can see how a crash of the Customer microservices makes the Order microservice useless.
  • Hystrix has a dashboard. Turbine can be used to combine the data from multiple sources. However, this does not work at the moment.
  • Zuul is used to route HTTP requests from the outside to the different services.
  • Spring Cloud Config isn't used. It is disabled with spring.cloud.config.enabled=false in the bootstrap files.

How To Run

The demo can be run with Vagrant or Docker Machine and Docker Compose.

How to run includes more details.

Remarks on the Code

The servers for the infrastruture are pretty simple thanks to Spring Cloud:

  • microservice-demo-eureka is the Eureka server for service discovery.
  • microservice-demo-zuul is the Zuul server. It distributes the requests to the three microservices.
  • microservice-demo-turbine can be used to consolidate the Hystrix metrics and has a Hystrix dashboard.

The microservices are:

  • microservice-demo-catalog is the application to take care of items.
  • microserivce-demo-customer is responsible for customers.
  • microservice-demo-order does order processing. It uses microservice-demo-catalog and microservice-demo-customer. Ribbon is used for load balancing and Hystrix for resilience.

The microservices have an Java main application in src/test/java to run them stand alone. microservice-demo-order uses a stub for the other services then. Also there are tests that use customer driven contracts. That is why it is ensured that the services provide the correct interface. These CDC tests are used in microservice-demo-order to verify the stubs. In microserivce-demo-customer and microserivce-demo-catalog they are used to verify the implemented REST services.

microservice's People

Contributors

larzenegger avatar matthiasbalke avatar mvitz avatar 7-- avatar spencergibb avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.