Git Product home page Git Product logo

spring-cloud-rocketmq-transaction's Introduction

RocketMQ实现分布式事务

有关RocketMQ实现分布式事务前面写了一篇博客

1、RocketMQ实现分布式事务原理

下面就这个项目做个整体简单介绍。

一、项目概述

1、技术架构

项目总体技术选型

SpringCloud(Finchley.RELEASE) + SpringBoot2.0.4 + Maven3.5.4 + RocketMQ4.3 +MySQL + lombok(插件)

有关SpringCloud主要用到以下四个组建

Eureka Server +config-server(配置中心)+ Eureka Client + Feign(服务间调用) 

配置中心是用MySQL存储数据。

2、项目整体结构

config-service  # 配置中心
eureka          # 注册中心
service-order   #订单微服务
service-produce #商品微服务

各服务的启动顺序就安装上面的顺序启动。

大致流程

启动后,配置中心、订单微服务、商品微服务都会将信息注册到注册中心。

如果访问:localhost:7001(注册中心地址),以上服务都出现说明启动成功。

3、分布式服务流程

用户在订单微服务下单后,会去回调商品微服务去减库存。这个过程需要事务的一致性。

4、测试流程

页面输入:

http://localhost:9001/api/v1/order/save?userId=1&productId=1&total=4	

订单微服务执行情况(订单服务事务执行成功)

商品微服务执行情况(商品服务事务执行成功)

当然你也可以通过修改参数来模拟分布式事务出现的各种情况。


spring-cloud-rocketmq-transaction's People

Contributors

2017begin 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.