当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- confd
- 条形码识别性能低,如何优化Dynamsoft Barcode Reader解码性能
- Git SSH bad permissions
- Solution to st link USB communication error in stlink Download
- OpenCV計算機視覺學習(10)——影象變換(傅立葉變換,高通濾波,低通濾波)
- WebAPI接口设计:SwaggerUI文档 / 统一响应格式 / 统一异常处理 / 统一权限验证
- VARCHART XGantt如何在日历上表示工作日
- 汽车维修app开发的好处与功能
- August 24, 2020: what are small documents? What's wrong with a lot of small files? How to solve many small files? (big data)
- 南京标识标牌设计制作,导视VI系统设计
猜你喜欢
频收罚单的浦发银行:增收不增利,曾遭骗贷数亿元,内控缺位?
Git SSH bad permissions
Exclusive interview with Yue Caibo
Common mathematical basic formulas of recursive and backtracking algorithms
南京标识标牌设计制作,导视VI系统设计
图像处理工具包ImagXpress使用教程,如何查看事件
Three steps to understand Kerberos Protocol easily
About Devops seven misunderstandings, 99% of people have been hit!
How to solve the problem of blank page in Google Chrome browser
Configuration of AP hotspot on xunwei-imx6ull development board
随机推荐
Top 5 Chinese cloud manufacturers in 2018: Alibaba cloud, Tencent cloud, AWS, telecom, Unicom
7. Swarm builds clusters
K-vim installation and the ycmd server shut down (restart with ': ycmrestartserver')
Count the number of project code lines
Stm32f030k6t6 compatible replacement smart mm32f031k6t6
2020-11-06:go中,谈一下调度器。
条形码识别器Dynamsoft Barcode Reader v7.5全新上线!
Composition of MRAM cache
Getting started with varhart xgantt
Win7 AppCrash (solution)
Dynamsoft barcode reader v7.5!
The first choice for lightweight GPU applications is the NVIDIA vgpu instance launched by Jingdong Zhilian cloud
Ora-02292: complete constraint violation (midbjdev2.sys_ C0020757) - subrecord found
【原創】ARM平臺記憶體和cache對xenomai實時性的影響
The advantages and functions of psychological counseling app
Mongo user rights login instruction
10000! Ideal car recalls all defective cars: 97 accidents have occurred and losses will be expanded
Experiment one
QT audio and video development 46 video transmission UDP version
REM: the solution of PC and mobile