create README_en.md
This commit is contained in:
parent
1bc32c407c
commit
27bf0098a9
19
README.md
19
README.md
@ -1,7 +1,3 @@
|
|||||||
# RabbitMQ 培训文档
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 1. MQ 的基本概念
|
## 1. MQ 的基本概念
|
||||||
|
|
||||||
### 1.1 什么是MQ?
|
### 1.1 什么是MQ?
|
||||||
@ -39,20 +35,13 @@ MQ全称为Message Queue即消息队列
|
|||||||
**5. 重试与容错**
|
**5. 重试与容错**
|
||||||
- 若消费者服务临时故障,消息队列会保留消息,待服务恢复后重新投递
|
- 若消费者服务临时故障,消息队列会保留消息,待服务恢复后重新投递
|
||||||
- 配合重试机制,可解决网络波动、服务暂时不可用等问题
|
- 配合重试机制,可解决网络波动、服务暂时不可用等问题
|
||||||
|
|
||||||
#### 典型应用场景:
|
|
||||||
- 电商下单:订单创建 → 消息队列 → 库存扣减、支付处理、物流通知等
|
|
||||||
- 日志收集:各服务日志发送到队列,由日志系统统一消费、存储、分析
|
|
||||||
- 分布式事务:通过消息队列实现最终一致性
|
|
||||||
- 延迟任务:如订单超时未支付自动取消
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. RabbitMQ
|
## 2. RabbitMQ
|
||||||
|
|
||||||
### 2.1 介绍
|
### 2.1 介绍
|
||||||
|
|
||||||
RabbitMQ 是一个开源的消息代理软件(也可称为消息队列中间件),由 Erlang 语言编写,基于 AMQP(高级消息队列协议) 实现,在分布式系统中用于实现应用程序之间的异步通信和解耦。
|
RabbitMQ 是一个开源的消息代理软件(也可称为消息队列中间件),由 Erlang 语言编写,在分布式系统中用于实现应用程序之间的异步通信和解耦。
|
||||||
|
|
||||||
#### 特点:
|
#### 特点:
|
||||||
- **多种协议支持**:除了 AMQP,RabbitMQ 还支持 STOMP、MQTT 等多种消息协议
|
- **多种协议支持**:除了 AMQP,RabbitMQ 还支持 STOMP、MQTT 等多种消息协议
|
||||||
@ -62,7 +51,7 @@ RabbitMQ 是一个开源的消息代理软件(也可称为消息队列中间
|
|||||||
- **管理界面友好**:具备一个可视化的管理界面
|
- **管理界面友好**:具备一个可视化的管理界面
|
||||||
|
|
||||||
### 2.2 核心组件
|
### 2.2 核心组件
|
||||||
|

|
||||||
```
|
```
|
||||||
生产者 → 信道 → 交换器(Exchange) → 队列(Queue) → 信道 → 消费者
|
生产者 → 信道 → 交换器(Exchange) → 队列(Queue) → 信道 → 消费者
|
||||||
```
|
```
|
||||||
@ -140,6 +129,7 @@ docker run -d --name rabbitmq -p 5673:5672 -p 15673:15672 rabbitmq
|
|||||||
## 3. Python集成
|
## 3. Python集成
|
||||||
|
|
||||||
基于python aio-pika库进行集成
|
基于python aio-pika库进行集成
|
||||||
|
仓库地址:https://gitea.freeleaps.mathmast.com/icecheng/rabbitmq-test
|
||||||
|
|
||||||
### 3.1 Fanout Exchange Demo
|
### 3.1 Fanout Exchange Demo
|
||||||
|
|
||||||
@ -979,13 +969,12 @@ Message sent: Normal system log (routing key: system.log.info)
|
|||||||
|
|
||||||
**3. 消息幂等性**
|
**3. 消息幂等性**
|
||||||
- 使用消息ID去重
|
- 使用消息ID去重
|
||||||
- 内存中记录已处理的消息ID
|
- 数据库记录已处理的消息ID
|
||||||
- 防止重复处理相同消息
|
- 防止重复处理相同消息
|
||||||
|
|
||||||
**4. 重试机制**
|
**4. 重试机制**
|
||||||
- 可配置最大重试次数
|
- 可配置最大重试次数
|
||||||
- 消费者内部重试,避免消息重新入队
|
- 消费者内部重试,避免消息重新入队
|
||||||
- 指数退避重试策略
|
|
||||||
|
|
||||||
**5. 死信队列**
|
**5. 死信队列**
|
||||||
- 处理失败消息的完整解决方案
|
- 处理失败消息的完整解决方案
|
||||||
|
|||||||
1362
README_en.md
Normal file
1362
README_en.md
Normal file
File diff suppressed because it is too large
Load Diff
BIN
RabbitMQ Usage.docx
Normal file
BIN
RabbitMQ Usage.docx
Normal file
Binary file not shown.
BIN
__pycache__/config.cpython-312.pyc
Normal file
BIN
__pycache__/config.cpython-312.pyc
Normal file
Binary file not shown.
BIN
__pycache__/config.cpython-313.pyc
Normal file
BIN
__pycache__/config.cpython-313.pyc
Normal file
Binary file not shown.
BIN
__pycache__/test.cpython-312-pytest-8.4.1.pyc
Normal file
BIN
__pycache__/test.cpython-312-pytest-8.4.1.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
comsumer/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
comsumer/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/direct_consumer.cpython-312.pyc
Normal file
BIN
comsumer/__pycache__/direct_consumer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/direct_consumer.cpython-313.pyc
Normal file
BIN
comsumer/__pycache__/direct_consumer.cpython-313.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/direct_multi_consumer.cpython-312.pyc
Normal file
BIN
comsumer/__pycache__/direct_multi_consumer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/direct_multi_consumer.cpython-313.pyc
Normal file
BIN
comsumer/__pycache__/direct_multi_consumer.cpython-313.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/fanout_consumer.cpython-312.pyc
Normal file
BIN
comsumer/__pycache__/fanout_consumer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/fanout_consumer.cpython-313.pyc
Normal file
BIN
comsumer/__pycache__/fanout_consumer.cpython-313.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/topic_consumer.cpython-312.pyc
Normal file
BIN
comsumer/__pycache__/topic_consumer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
comsumer/__pycache__/topic_consumer.cpython-313.pyc
Normal file
BIN
comsumer/__pycache__/topic_consumer.cpython-313.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
product/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
product/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
product/__pycache__/direct_multi_publish.cpython-312.pyc
Normal file
BIN
product/__pycache__/direct_multi_publish.cpython-312.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/direct_multi_publish.cpython-313.pyc
Normal file
BIN
product/__pycache__/direct_multi_publish.cpython-313.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/direct_publish.cpython-312.pyc
Normal file
BIN
product/__pycache__/direct_publish.cpython-312.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/direct_publish.cpython-313.pyc
Normal file
BIN
product/__pycache__/direct_publish.cpython-313.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/fanout_publish.cpython-312.pyc
Normal file
BIN
product/__pycache__/fanout_publish.cpython-312.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/fanout_publish.cpython-313.pyc
Normal file
BIN
product/__pycache__/fanout_publish.cpython-313.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/topic_publish.cpython-312.pyc
Normal file
BIN
product/__pycache__/topic_publish.cpython-312.pyc
Normal file
Binary file not shown.
BIN
product/__pycache__/topic_publish.cpython-313.pyc
Normal file
BIN
product/__pycache__/topic_publish.cpython-313.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
reliable_mq/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
reliable_mq/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/config.cpython-312.pyc
Normal file
BIN
reliable_mq/__pycache__/config.cpython-312.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/config.cpython-313.pyc
Normal file
BIN
reliable_mq/__pycache__/config.cpython-313.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/dead_letter_consumer.cpython-312.pyc
Normal file
BIN
reliable_mq/__pycache__/dead_letter_consumer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/dead_letter_consumer.cpython-313.pyc
Normal file
BIN
reliable_mq/__pycache__/dead_letter_consumer.cpython-313.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/queue_manager.cpython-312.pyc
Normal file
BIN
reliable_mq/__pycache__/queue_manager.cpython-312.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/reliable_consumer.cpython-312.pyc
Normal file
BIN
reliable_mq/__pycache__/reliable_consumer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/reliable_consumer.cpython-313.pyc
Normal file
BIN
reliable_mq/__pycache__/reliable_consumer.cpython-313.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/reliable_producer.cpython-312.pyc
Normal file
BIN
reliable_mq/__pycache__/reliable_producer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
reliable_mq/__pycache__/reliable_producer.cpython-313.pyc
Normal file
BIN
reliable_mq/__pycache__/reliable_producer.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user