当前位置:网站首页>消息队列消息存储设计(架构实战营 模块八作业)
消息队列消息存储设计(架构实战营 模块八作业)
2022-07-31 22:37:00 【InfoQ】
消息表

消费信息表
consume_log 表
- 我们支持多个消费者组,每个消费者组共享一条消费进度记录,所以表中需要有 group 字段来区分是哪个消费者组的消费记录;
- 消费偏移量是最重要的,记录了消费到哪条数据,用 offset 来标识,即 message 表中的 msg_id,因为 msg_id 在一个数据分组,一个 topic 下是严格递增的;

索引分析
发送消息
- 客户端完成分片路由,分配到某个 shard,发送消息数据
- 消息队列服务器根据 topic 找到对应的消息表 message_{topic},然后插入数据,msg_id 自增
消费消息
- 客户端完成分片的路由,向对应服务器拉取消息,带上参数 topic,group
- 查询 consumer_log 表,根据 topic,group 通过索引找到对应的数据,取出 offset
- 根据 offset 查询对应的 message 表,通过主键 id,找出下个 offset 的记录,取出并准备返回
- 更新 consumer_log 的 offset 信息
- 返回数据
边栏推荐
- 无状态与有状态的区别
- The article you worked so hard to write may not be your original
- 20. Support vector machine - knowledge of mathematical principles
- Recognize anomalies (you will understand after reading this)
- ICML2022 | 深入研究置换敏感的图神经网络
- Memblaze released the first enterprise-grade SSD based on long-lasting particles. What is the new value behind it?
- IDA PRO中汇编结构体识别
- [QNX Hypervisor 2.2 User Manual]9.14 set
- SQL注入 Less54(限制次数的SQL注入+union注入)
- BM5 merge k sorted linked lists
猜你喜欢
![[Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement

21. Support Vector Machine - Introduction to Kernel Functions

Summary of the classic drawing method of histogram

Chapter VII

Recognize anomalies (you will understand after reading this)

iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools

(26)Blender源码分析之顶层菜单的关于菜单

C程序设计-方法与实践(清华大学出版社)习题解析
![[NLP] What is the memory of the model!](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[NLP] What is the memory of the model!

高等代数_证明_任何矩阵都相似于一个上三角矩阵
随机推荐
Linux environment redis cluster to build "recommended collection"
[QNX Hypervisor 2.2用户手册]9.14 set
How to debug TestCafe
Bionic caterpillar robot source code
focus on!Haitai Fangyuan joins the "Personal Information Protection Self-discipline Convention"
Write a database document management tool based on WPF repeating the wheel (1)
Shell常用脚本:Nexus批量上传本地仓库脚本
[QNX Hypervisor 2.2用户手册]9.15 suppress
How to get useragent
renderjs usage in uni-app
[Code Hoof Set Novice Village 600 Questions] Merge two numbers without passing a character array
支付模块实现
如何减少软件设计和实现之间鸿沟
The latest masterpiece!Alibaba just released the interview reference guide (Taishan version), I just brushed it for 29 days
如何导入 Golang 外部包并使用它?
标段参数说明
"APIO2010" Patrol Problem Solution
Student management system on the first day: complete login PyQt5 + MySQL5.8 exit the operation logic
BM5 merge k sorted linked lists
Transfer Learning - Domain Adaptation