当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 课堂练习
- 9.集群之间服务通信 RoutingMesh
- Reserved battery interface, built-in charge and discharge circuit and electricity meter, quickly help easily handle hand-held applications
- The use of Xunwei imx6 development board device tree kernel menuconfig
- RFID fixed assets management system for fire equipment
- Gantt chart grouping activities tutorial
- OpenCV計算機視覺學習(10)——影象變換(傅立葉變換,高通濾波,低通濾波)
- Logo design company, Nanjing
- August 14, 2020: what are the execution engines for data tasks?
- REM: the solution of PC and mobile
猜你喜欢

REM: the solution of PC and mobile

汽车维修app开发的好处与功能

RFID fixed assets management system for fire equipment

2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...

Image processing toolkit imagexpresshow to view events

WebAPI接口设计:SwaggerUI文档 / 统一响应格式 / 统一异常处理 / 统一权限验证

Insomnia all night

10000! Ideal car recalls all defective cars: 97 accidents have occurred and losses will be expanded

测试攻城狮必备技能点!一文带你解读DevOps下的测试技术

Count the number of project code lines
随机推荐
一种超参数优化技术-Hyperopt
Design of NAND flash interface control
About Devops seven misunderstandings, 99% of people have been hit!
gitlab 持续集成开发环境之CI/CD
Yum [errno 256] no more mirrors to try solution
8.Swarm创建维护和水平扩展Service
“非洲用户的付费意愿并不低”——专访四达时代研发总监张亮
Win7 how to quickly type CMD and get to the required directory
C# 枚举权限 |和||,&和&&的区别
2020-08-17: how to solve data skew in detail?
谈了多年的数字化转型,为什么还有很多企业依然“口头管理”
快進來!花幾分鐘看一下 ReentrantReadWriteLock 的原理!
如何解决谷歌Chrome浏览器空白页的问题
Bluetooth broadcast chip for Shanghai giant micro
20 XR projects roadshows, nearly 20 capital institutions attended! We sincerely invite you to attend the 2020 qcomm XR eco Partner Conference
And how to solve the conflict between pop-up menu and pop-up menu
条形码识别器Dynamsoft Barcode Reader v7.5全新上线!
Common mathematical basic formulas of recursive and backtracking algorithms
【QT】QThread原始碼淺析
Git remote library rollback specified version

