当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 失眠一个整晚上
- 【笔记】Error while loading PyV8 binary: exit code 1解决方法
- cubemx做stm32 USB开发
- How does varhart xgantt represent working days on a calendar
- Python3 operating gitlab
- Windows 10 Bluetooth management page 'add Bluetooth or other devices' option click no response solution
- Bluetooth broadcast chip for Shanghai giant micro
- How to use Gantt chart layers and filters
- The advantages and functions of psychological counseling app
- Chinese sub forum of | 2020 PostgreSQL Asia Conference: Pan Juan
猜你喜欢

条形码识别性能低,如何优化Dynamsoft Barcode Reader解码性能

Empty test suite appears in JUnit test

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

The use of Xunwei imx6 development board device tree kernel menuconfig

And how to solve the conflict between pop-up menu and pop-up menu

ImageMagick - add watermark

RECH8.0版本学习 days 12 rh134部分

In 2020, how can wechat seal numbers be quickly lifted?

2020-11-06:go中,谈一下调度器。

September 9, 2020: naked writing algorithm: two threads print numbers 1-100 in turn.
随机推荐
廬山真面目之二微服務架構NGINX版本實現
Talk about sharing before paying
August 14, 2020: what are the execution engines for data tasks?
yum [Errno 256] No more mirrors to try 解决方法
心理咨询app开发所具备的优点与功能
Jenkins入门(二)声明式流水线Jenkins Pipeline
如何使用甘特图图层和筛选器
2020年新规,微信封号怎么快速解除?
Count the number of project code lines
confd
Stm32f030f4p6 compatible with smart micro mm32f031f4p6
11.Service更新
Developing STM32 USB with cubemx
Benefits and functions of auto maintenance app development
Gantt chart grouping activities tutorial
In 2020, how can wechat seal numbers be quickly lifted?
Application layer software development Godfather teaches you how to refactor, senior programmers must professional skills
How does LeadTools detect, read and write barcodes
Jenkins installation and deployment process
The advantages and functions of psychological counseling app

