Awesome Open Source
Awesome Open Source

Microservices with Spring Cloud Demo Project Twitter

In this project I'm demonstrating you the most interesting features of Spring Cloud Project for building microservice-based architecture. Most of examples are based on Spring Boot 1.5.

Getting Started

Currently you may find here some examples of microservices implementation using different projects from Spring Cloud. All the examples are divided into the branches and described in a separated articles on my blog. Here's a full list of available examples:

  1. Introduction to Spring Cloud components like discovery with Eureka, load balancing with Ribbon, REST client Feign, API gataway with Zuul. The example is available in the branch master. A detailed description can be found here: Part 1: Creating microservice using Spring Cloud, Eureka and Zuul
  2. Introduction to Spring Cloud components used for microservices monitoring like Spring Cloud Sleuth and Zipkin. Integration with Logstash for sending logs to ELK. The example is available in the branch logstash. A detailed description can be found here: Part 2: Creating microservices – monitoring with Spring Cloud Sleuth, ELK and Zipkin
  3. Introduction to load balancing with Ribbon and Feign declarative HTTP client, circuit braker and fallback with Hystrix. The example is available in the branch hystrix. A detailed description can be found here: Part 3: Creating Microservices: Circuit Breaker, Fallback and Load Balancing with Spring Cloud
  4. Using tool Spring Boot Admin for managing and monitoring microservices-based system. The example is available in the branch admin. A detailed description can be found here: Monitoring Microservices With Spring Boot Admin
  5. Deploying and running Spring Boot microservices on Kubernetes including inter-service communication using Feign client and integration with database Mongo. The example is available in the branch kubernetes. A detailed description can be found here: Microservices with Kubernetes and Docker

Usage

In the most cases you need to have Maven, JDK8+ and Docker for running third-party software like Zipkin or Logstash. In the fifth example with Kubernetes you will have to run Minikube on your local machine. The best way to run the sample applications is with IDEs like IntelliJ IDEA or Eclipse.

How to Run

docker-compose up

If you want to change anything on any service(s), you need to build the service(s) you changed and then :

docker-compose build docker-compose up

How to Run

docker-compose down

Architecture

Our sample microservices-based system consists of the following modules:

  • gateway-service - a module that Spring Cloud Netflix Zuul for running Spring Boot application that acts as a proxy/gateway in our architecture.
  • config-service - a module that uses Spring Cloud Config Server for running configuration server in the native mode. The configuration files are placed on the classpath.
  • discovery-service - a module that depending on the example it uses Spring Cloud Netflix Eureka as an embedded discovery server.
  • account-service - a module containing the first of our sample microservices that allows to perform CRUD operation on in-memory repository of accounts
  • customer-service - a module containing the second of our sample microservices that allows to perform CRUD operation on in-memory repository of customers. It communicates with account-service.
  • zipkin-service - a module that runs embedded Zipkin instance.

The following picture illustrates the architecture described above.


In case of Kubernetes deployment we use only some of Spring Cloud components like Spring Cloud Feign or Sleuth without discovery or config server.

For similar examples of microservice applications with Spring Boot 2 you may refer to the repository https://github.com/piomin/sample-spring-microservices-new


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
java (31,121
kubernetes (1,732
spring-boot (764
microservices (453
spring-cloud (212
kibana (89
logstash (73
zipkin (55
eureka (53
ribbon (43
hystrix (43
zuul (43
spring-cloud-netflix (16