当前位置:网站首页>Architecture training module 7

Architecture training module 7

2022-06-12 11:27:00 InfoQ

Message queues store message data  MySQL  The table is designed as follows , Store different message queues in the same table , Partition by message type or time .
Message type table :
queue_name: varchar(64), Message queue name
queue_other_attributes:  Other properties of message queue , Can be divided into multiple fields
 
queue_name:  A primary key
 
Message table :
id: bigint, news  ID, Self growth
msg_type: varchar(64), Message type , Get the... Of the message type table  queue_name  Field
message: text, The message content
publisher: varchar(64), Unique identifier of the publisher
publish_time: timestamp, Time of news release
 
id: A primary key
publisher+publish_time: Create index , It is convenient for publishers to query what messages they have published according to time
 
When the news increases , It can be divided by message type or message publishing time
 
Consumption table :
msg_id: bigint, news  UUID, Cancellation of interest sheet  id  Field
consumer: varchar(64), Unique identifier of the message consumer
consume_time: timestamp, Message consumption time
 
consumer+ consume_time: A primary key , It is convenient for consumers to query what messages they have consumed by time
msg_id:  Create index , It's convenient to see which consumers consume a message
原网站

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121105207852.html