All Projects → cassiomolin → Microservices Springboot

cassiomolin / Microservices Springboot

Licence: mit
Example of microservices application with Spring Boot, Zuul, Eureka, MongoDB and RabbitMQ.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Microservices Springboot

Superboot
随着技术日新月异,新技术新平台不断出现,对现如今的开发人员来说选择快速高效的框架进行项目开发,既能提高产出,又能节约时间。本框架无需开发即可实现服务注册、服务发现、负载均衡、服务网关、配置中心、API管理、分布式事务、支撑平台、集成框架、数据传输加密等功能,是学习SpringCloud整体业务模式的完整示例,并且可以直接用于生产环境
Stars: ✭ 341 (+543.4%)
Mutual labels:  eureka, mongodb, springboot, zuul
Lamp Cloud
lamp-cloud 基于Jdk11 + SpringCloud + SpringBoot的微服务快速开发平台,其中的可配置的SaaS功能尤其闪耀, 具备RBAC功能、网关统一鉴权、Xss防跨站攻击、自动代码生成、多种存储系统、分布式事务、分布式定时任务等多个模块,支持多业务系统并行开发, 支持多服务并行开发,可以作为后端服务的开发脚手架。代码简洁,注释齐全,架构清晰,非常适合学习和企业作为基础框架使用。
Stars: ✭ 4,125 (+7683.02%)
Mutual labels:  eureka, spring, springboot, zuul
Java Spring Cloud
Distributed tracing for Spring Boot, Cloud and other Spring projects
Stars: ✭ 326 (+515.09%)
Mutual labels:  mongodb, spring, springboot, zuul
Springcloudlearning
《史上最简单的Spring Cloud教程源码》
Stars: ✭ 16,218 (+30500%)
Mutual labels:  eureka, spring, zuul
Mall
mall项目是一套电商系统,包括前台商城系统及后台管理系统,基于SpringBoot+MyBatis实现,采用Docker容器化部署。 前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。 后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。
Stars: ✭ 54,797 (+103290.57%)
Mutual labels:  mongodb, spring, springboot
Spring Cloud Study
SpringCloud源码实战微服务框架(202003更新到SpringCloud的Greenwich版本,即基于SpringBoot2.1.7版本,以及新增SpringCloud Alibaba从入门到精通教程),涉及内容:配置中心,注册中心,服务提供者,服务消费者,熔断器,配置服务,API Gateway,API网关限流ratelimit,服务链路追踪zipkin,hystrix监控,监控聚合中心turbine等
Stars: ✭ 215 (+305.66%)
Mutual labels:  eureka, springboot, zuul
Spring Boot Vue Bank
我,请始皇[打钱]是一个前后端分离的工具人系统,项目采用 SpringBoot+Go+Vue 开发,项目加入常见的企业级应用所涉及到的技术点,例如 Redis、RabbitMQ 等(主要是多用用工具多踩踩坑)。
Stars: ✭ 157 (+196.23%)
Mutual labels:  mongodb, spring, springboot
Spring Petclinic Rest
REST version of the Spring Petclinic sample application
Stars: ✭ 257 (+384.91%)
Mutual labels:  rest, jackson, spring
Docs
Java知识总结:MySQL实战45讲,多线程和JVM知识总结,,SpringBoot,SpringCloud,Storm系列,微信小程序开发,ELK,《JAVA核心技术36讲笔记》,《深入理解JVM虚拟机笔记》,《高性能MySQL笔记》,《数据结构与算法》等等
Stars: ✭ 308 (+481.13%)
Mutual labels:  mongodb, spring, springboot
Tutorial
Java全栈知识架构体系总结
Stars: ✭ 407 (+667.92%)
Mutual labels:  mongodb, spring, springboot
Spring Samples For All
spring、spring-boot、spring-cloud 常用整合用例
Stars: ✭ 401 (+656.6%)
Mutual labels:  eureka, mongodb, zuul
Mini Platform
Mini-Platform致力于更简洁易用的轻量级微服务治理平台。
Stars: ✭ 45 (-15.09%)
Mutual labels:  eureka, spring, zuul
Spring Boot Examples
about learning Spring Boot via examples. Spring Boot 教程、技术栈示例代码,快速简单上手教程。
Stars: ✭ 26,812 (+50488.68%)
Mutual labels:  mongodb, spring, springboot
Spring Cloud Examples
Spring Cloud 学习案例,服务发现、服务治理、链路追踪、服务监控等
Stars: ✭ 5,829 (+10898.11%)
Mutual labels:  eureka, springboot, zuul
Fw Cloud Framework
基于springcloud全家桶开发分布式框架(支持oauth2认证授权、SSO登录、统一下单、微信公众号服务、Shardingdbc分库分表、常见服务监控、链路监控、异步日志、redis缓存等功能),实现基于Vue全家桶等前后端分离项目工程
Stars: ✭ 717 (+1252.83%)
Mutual labels:  eureka, springboot, zuul
Spring Petclinic Microservices
Distributed version of Spring Petclinic built with Spring Cloud
Stars: ✭ 814 (+1435.85%)
Mutual labels:  eureka, zuul
Radar
实时风控引擎(Risk Engine),自定义规则引擎(Rule Script),完美支持中文,适用于反欺诈(Anti-fraud)应用场景,开箱即用!!!移动互联网时代的风险管理利器,你 Get 到了吗?
Stars: ✭ 781 (+1373.58%)
Mutual labels:  mongodb, springboot
Szt Bigdata
深圳地铁大数据客流分析系统🚇🚄🌟
Stars: ✭ 826 (+1458.49%)
Mutual labels:  mongodb, springboot
Springbootunity
rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,different bussiness scence with different technology。)
Stars: ✭ 845 (+1494.34%)
Mutual labels:  mongodb, spring
Springcloud Learning
Spring Cloud基础教程,持续连载更新中
Stars: ✭ 6,839 (+12803.77%)
Mutual labels:  eureka, zuul

Sample microservices application with Spring Boot, Zuul, Eureka, MongoDB and RabbitMQ

Build Status MIT Licensed

Sample microservices application for managing products and shopping lists using:

  • Spring Boot: Framework for creating standalone Java applications.
  • Jersey: JAX-RS reference implementation for creating RESTful web services in Java.
  • Jackson: JSON parser for Java.
  • MapStruct: Framework for mapping objects in Java.
  • Netflix Zuul: API gateway.
  • Netflix Eureka: Service discovery.
  • RabbitMQ: Message broker.
  • MongoDB: NoSQL database based on documents.

This application consists of four different services:

  • Product service: Provides API for managing products. By default it runs on port 8001.
  • Shopping list service: Provides API for managing shopping lists. By default it runs on port 8002.
  • Service discovery: Netflix Eureka service that discovers and registers other service instances. By default it runs on port 8761.
  • API gateway: Netflix Zuul API gateway that sits on the top of the product and shopping list services, providing a gateway for those services. By default it runs on port 8765.

See the diagram below:

Architecture diagram

External services

This application depends on external services that must be up and running before attempting to run the application:

MongoDB

Shopping and product services use MongoDB for persistence, but different databases are used for each service.

Before running the application, ensure that you have a MongoDB instance running on localhost port 27017 (default port). The product and shopping-list databases will be created by the application if they don't exist.

RabbitMQ

RabbitMQ is used as message broker for communication between the services. When a product is deleted, a message is produced by the product service. This message contains details about the product that has been deleted. The shopping list service consumes the message and removes the deleted product from the shopping lists.

Before running the application, ensure that a RabbitMQ instance is running on localhost port 5672 (default port).

Building and running this application

To build and run this application, follow these steps:

  1. Open a command line window or terminal.
  2. Navigate to the root directory of the project, where the pom.xml resides.
  3. Compile the project: mvn clean compile.
  4. Package the application: mvn package.
  5. Change into the target directory of the dist module: cd dist/target.
  6. You should see a folder with the following or a similar name: microservices-1.0. Change into this folder: cd microservices-1.0.
  7. Start the services as indicated below (the order doesn't matter).

Running the service discovery application

  1. Open a command line window or terminal.
  2. Start the service-discovery application: java -jar service-discovery-1.0.jar.
  3. A Netflix Eureka console will be available at http://localhost:8761.

Running the product service application

  1. Open a command line window or terminal.
  2. Start the product-service application: java -jar product-service-1.0.jar.
  3. This service will start on the port 8001 and it will automatically register itself in the service discovery. Check the Eureka console.

Running the shopping list service application

  1. Open a command line window or terminal.
  2. Start the shopping-list-service application: java -jar shopping-list-service-1.0.jar.
  3. This service will start on the port 8002 and it will automatically register itself in the service discovery. Check the Eureka console.

Running the API gateway application

  1. Open a command line window or terminal.
  2. Start the api-gateway application: java -jar api-gateway-1.0.jar.

Running extra instances (optional)

If you want to, you can run extra instances of product-service and shopping-list-service applications, just use a different port: java -DPORT=8003 -jar product-service-1.0.jar. New instances will automatically register themselves in the service discovery.

Requests coming from the api-gateway service will be balanced between the instances.

REST API overview

The application provides a REST API for managing tasks. See the curl scripts below with the supported operations:

Get all products

curl -X GET \
  'http://localhost:8765/api/products' \
  -H 'Accept: application/json'

Create a product

curl -X POST \
  'http://localhost:8765/api/products' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Cake"
}'

Get a product by id

curl -X GET \
  'http://localhost:8765/api/products/{product-id}' \
  -H 'Accept: application/json'

Update a product

curl -X POST \
  'http://localhost:8765/api/products/{product-id}' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Chocolate cake"
}'

Delete a product by id

curl -X DELETE \
  'http://localhost:8765/api/products/{product-id}'

Get all shopping lists

curl -X GET \
  'http://localhost:8765/api/shopping-lists' \
  -H 'Accept: application/json'

Create a shopping list

curl -X POST \
  'http://localhost:8765/api/shopping-lists' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "My shopping list",
  "items": [
    {
      "id": "{product-id}"
    },
    {
      "id": "{product-id}"
    },
    ...
  ]
}'

Get a shopping list by id

curl -X GET \
  'http://localhost:8765/api/shopping-lists/{shopping-list-id}' \
  -H 'Accept: application/json'

Update a shopping list

curl -X PUT \
  'http://localhost:8765/api/shopping-lists/{shopping-list-id}' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Birthday party",
  "items": [
    {
      "id": "{product-id}"
    },
    {
      "id": "{product-id}"
    },
    ...
  ]
}'

Delete a shopping list by id

curl -X DELETE \
  'http://localhost:8765/api/shopping-lists/{shopping-list-id}'

Targeting the REST API with Postman

Alternatively to curl, you can use Postman to target the REST API. Check the Postman collection and the environment variables as well.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].