当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- “非洲用户的付费意愿并不低”——专访四达时代研发总监张亮
- JS string - string string object method
- Nonvolatile MRAM memory used in all levels of cache
- 南京标识标牌设计制作,导视VI系统设计
- Ora-02292: complete constraint violation (midbjdev2.sys_ C0020757) - subrecord found
- confd
- Two dimensional code location and alarm system of Expressway
- Yum [errno 256] no more mirrors to try solution
- 谈了多年的数字化转型,为什么还有很多企业依然“口头管理”
- Talk about sharing before paying
猜你喜欢

2020-08-20: the difference between go and python?

JS array the usage of array is all here (array method reconstruction, array traversal, array de duplication, array judgment and conversion)

Gantt chart grouping activities tutorial

Insomnia all night

Characteristics of magnetic memory chip STT-MRAM

Empty test suite appears in JUnit test

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

关于DevOps的七大误解,99%的人都曾中过招!
![yum [Errno 256] No more mirrors to try 解决方法](/img/3b/00bc81122d330c9d59909994e61027.jpg)
yum [Errno 256] No more mirrors to try 解决方法

How to solve the problem of blank page in Google Chrome browser
随机推荐
如何使用甘特图图层和筛选器
git 提交规范
Google browser realizes video playback acceleration function
Jenkins pipline stage setting timeout
And how to solve the conflict between pop-up menu and pop-up menu
2020-08-29: process thread differences, in addition to the inclusion relationship, the underlying details?
REM: the solution of PC and mobile
2020-09-04: do you understand the function call convention?
yum [Errno 256] No more mirrors to try 解决方法
快進來!花幾分鐘看一下 ReentrantReadWriteLock 的原理!
python3操作gitlab
C# 枚举权限 |和||,&和&&的区别
A good thing for working people -- to temper the will of iron and steel requires such an efficient computer
Three steps to understand Kerberos Protocol easily
Git remote library rollback specified version
频收罚单的浦发银行:增收不增利,曾遭骗贷数亿元,内控缺位?
cubemx做stm32 USB开发
JS string - string string object method
垃圾分类知识竞赛
Getting started with varhart xgantt

