当前位置:网站首页>Manually push a message platform
Manually push a message platform
2022-06-23 22:10:00 【Is paidaxing there】
Design implementation
design scheme
Ready to push material
- Import the data of the message recipient
- Select conditions to pull the data of message recipients from each business line
The first point : Importing the data of the message receiver can support excel Import , Then go to each business line to get complete users id that will do , The imported data needs to be submitted to the service or dropped in the database in pages
Second point : Select conditions to pull message receiver data from each business line , First drop the task and its information into the database , It will be difficult to get millions of stores synchronously from the business line , It is designed to be delivered in the form of sequential messages mq Carry out self production and self marketing .
Design sequential consumption mq To pull store data by using customer service screening criteria
The system adopts rocketmq Natural support to ensure sequential delivery (messageQueueSelector), The principle can be referred to This article .
Limit the number of threads consumed to ensure the self-protection of services in the case of large data consumption
Using this method will lead to mq Performance degradation of , If there is a large amount of data and high concurrent consumption ,mq The throughput of the service will decrease , So in order to prevent mq The service has collapsed, and there are not many such data itself , This can be limited topic Number of consuming threads .
consumption mq The message starts to pull store data
adopt mq The task information delivered , Pull the conditions selected by the user to pull the data of the message receiver to be sent from each business line ( At this stage, you only need to pull stores ). After pulling the store data, all push materials are ready , At this time, users can click start sending or make an appointment to send .
Problems in fetching store data online
Because the conditions of message push center are the conditions of user filtering , And these conditions are some enumeration values , So there is no way to get to the index when getting store data , If you check through these conditions and the amount of data that meets these conditions is very small, it will lead to full table scanning and call interface timeout , Reach... Online 8 second .
Solution
Each business line can pull data from the database through the cursor every time, and then put it into the database redis To filter the data according to the conditions , Then return , In this way, the problem of interface timeout can be solved .
Push message
Two push strategies need to be supported ,mq Push and multithreaded push
Multithreaded push
Use multithreading to push , Pull the recipient's data from the database page , Execute the task of sending messages according to the task submitted to the thread pool , After sending the message, return the number of messages sent , Use future Get the asynchronous execution result of the thread by blocking .
mq Push
Push all message recipients to mq Self marketing , Consumption to mq Push the message to the recipient
边栏推荐
- Benchclock: a benchmark for evaluating semantic analysis language models
- Detailed explanation of logical structure, physical structure and data operation
- How to batch generate video QR code
- HDLBits->Circuits->Arithmetic Circuitd->3-bit binary adder
- Explain the rainbow ingress universal domain name resolution mechanism
- What is the use of PMP certification?
- Find my information | Apple may launch the second generation airtag. Try the Lenz technology find my solution
- Take you to understand the working process of the browser
- CMU博士论文 | 通过记忆的元强化学习,118页pdf
- 使用 Provider 改造屎一样的代码,代码量降低了2/3!
猜你喜欢

HDLBits-> Circuits-> Arithmetic Circuitd-> 3-bit binary adder

Polar cycle graph and polar fan graph of high order histogram

Installation and use of Minio

使用 Provider 改造屎一样的代码,代码量降低了2/3!

Minimize outlook startup + shutdown

Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)

高阶柱状图之极环图与极扇图

Simple code and design concept of "back to top"

Leetcode algorithm interview sprint sorting algorithm theory (32)

MySQL de duplication query only keeps one latest record
随机推荐
HDLBits->Circuits->Arithmetic Circuitd->3-bit binary adder
KnowDA: All-in-One Knowledge Mixture Model for Data Augmentation in Few-Shot NLP(KnowDA:用于 Few-Shot NLP 中数据增强的多合一知识混合模型)
Assembly deployment process
Open source C # WPF control library -newbeecoder UI usage guide (I)
Detailed explanation of redisson distribution lock
How to dynamically insert a picture into a QR code
How API gateway extends the importance of gateway extension
Notepad++ installing the jsonview plug-in
[proteus simulation] lcd1602+ds1307 key setting simple clock
How to set the life cycle of API gateway
Practice of business level disaster recovery switching drill
How the API gateway obtains the URI path and how the API handles local access failure
Analysis of a series a e-commerce app docommandnative
How to build an API gateway and how to maintain an API gateway?
How do API gateways set up dynamic routing? What are the benefits of dynamic routing?
A batch layout WAF script for extraordinary dishes
What causes the applet SSL certificate to expire? How to solve the problem when the applet SSL certificate expires?
高阶柱状图之极环图与极扇图
Use of dotenv in nestjs
Dart series: look at me for security. The security feature in dart is null safety