当前位置:网站首页>Using rabbitmq to implement distributed transaction
Using rabbitmq to implement distributed transaction
2020-11-07 16:49:00 【PHP open source community】

RabbitMQ The idea of solving distributed transaction :
Case study : Classic case , In the case of the current popular takeout , After the user orders , Call the order service , Let the post order service call the dispatch system to inform the delivery personnel to deliver the order , At this time, the order system and dispatch system adopt MQ Asynchronous communication .
RabbitMQ Solve the principle of distributed transaction : Using the principle of final consistency .
The following three elements need to be guaranteed
1、 Confirm that the producer must deliver the data to MQ Server ( use MQ Message confirmation mechanism )
2、MQ Consumer news can consume information correctly , Use manual ACK Pattern ( Note the idempotency problem of retrial )
3、 How to ensure that the first transaction is executed first , Using compensation mechanism , Create a replenishment consumer to monitor , If the order is not created successfully , Make up the order .
If the producer delivers a message to MQ Server success
scene 1: If the consumer fails to consume the news , The producer does not need to roll back the transaction .
Solution : Consumers use manual ack Response mode , use MQ Compensation and retrial mechanism , Be careful MQ The problem of compensating idempotency .
problem : How to ensure that producers deliver messages to MQ The server will succeed ?
Solution :confirm Mechanism ( Confirmation response mechanism ).
scene 2 If the producer delivers a message to MQ Server failed , How to solve ?
Solution : Using the producer retry mechanism to send messages , Pay attention to idempotency .
scene 3 How to ensure that a transaction is executed first , The producer delivers a message to MQ Server success , Consumer spending is successful , But the order rolled back .
Solution : Replenishment mechanism .
Traditional solutions :
RabbitMq Solution :

版权声明
本文为[PHP open source community]所创,转载请带上原文链接,感谢
边栏推荐
- git 提交规范
- Google browser realizes video playback acceleration function
- C# 枚举权限 |和||,&和&&的区别
- 嘉宾介绍|2020 PostgreSQL亚洲大会中文分论坛:潘娟
- Talk about sharing before paying
- Application of UHF RFID medical blood management system
- 插件Bilibili新版0.5.5
- Gantt chart grouping activities tutorial
- Application layer software development Godfather teaches you how to refactor, senior programmers must professional skills
- 快進來!花幾分鐘看一下 ReentrantReadWriteLock 的原理!
猜你喜欢

Solution to st link USB communication error in stlink Download

August 30, 2020: naked write algorithm: the nearest common ancestor of two nodes in a binary tree.

8. Swarm creates maintenance and horizontal extension service

Detailed software engineering -- the necessary graphs in each stage

Dynamsoft barcode reader v7.5!

cubemx做stm32 USB开发

Utility class functions (continuous update)

南京标识标牌设计制作,导视VI系统设计

Stm32f030k6t6 compatible replacement smart mm32f031k6t6

September 9, 2020: naked writing algorithm: two threads print numbers 1-100 in turn.
随机推荐
Nonvolatile MRAM memory used in all levels of cache
一种超参数优化技术-Hyperopt
How to deploy Gantt chart quickly and correctly
Using JSON webtoken (JWT) to generate token in nodejs
“非洲用户的付费意愿并不低”——专访四达时代研发总监张亮
如何利用PopupWindow实现弹出菜单并解决焦点获取以及与软键盘冲突问题
jenkins pipline stage 设置超时
[graffiti Internet of things footprints] panoramic introduction of graffiti cloud platform
August 24, 2020: what are small documents? What's wrong with a lot of small files? How to solve many small files? (big data)
How does varhart xgantt represent working days on a calendar
The first choice for lightweight GPU applications is the NVIDIA vgpu instance launched by Jingdong Zhilian cloud
Jenkins入门(二)声明式流水线Jenkins Pipeline
Utility class functions (continuous update)
QT audio and video development 46 video transmission UDP version
Common mathematical basic formulas of recursive and backtracking algorithms
甘特图对活动进行分组教程
Count the number of project code lines
如何解决谷歌Chrome浏览器空白页的问题
New features of vue3
Stm32f030f4p6 compatible with smart micro mm32f031f4p6

