A message pushing method, a computer device and a storage medium
By introducing message queues and preset rules to control request speed, the crash problem caused by inconsistent concurrency capabilities of external channel systems was solved, achieving stability and efficiency in multi-channel push.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU PINWEI SOFTWARE CO LTD
- Filing Date
- 2021-12-21
- Publication Date
- 2026-04-28
AI Technical Summary
During the process of pushing coupons through multiple channels, the inconsistent concurrency capabilities of external channel systems led to frequent errors and system crashes, causing losses to both parties.
A message queue is introduced and preset rules are set to control the request speed of the message queue to make external calls, so as to meet the minimum system concurrency capacity of each external channel. The message queue is used to queue and schedule message push requests.
It prevents system crashes during multi-channel push notifications, ensures that all external channels can push messages normally, and reduces system losses.
Smart Images

Figure CN114281569B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of push notification technology, and in particular to a push notification method, computer device, and storage medium. Background Technology
[0002] With the development of mobile internet, push notifications have become increasingly popular. Push technology refers to the technology of sending information to users via the internet according to certain sending rules, relevant standards, and protocols. E-commerce companies are actively pushing various types of information to users' smart mobile devices.
[0003] Coupons, as a marketing tool used in modern business activities to enhance brand awareness and consumer loyalty, allow businesses to increase customer numbers and sales by pushing out coupons and similar information, while consumers can use coupons to get discounts, achieving a win-win situation for both businesses and consumers.
[0004] Currently, due to operational needs, businesses need to collaborate with multiple external channels to mutually push coupon information, thereby attracting more new customers at a lower cost and achieving a win-win or even multi-win situation.
[0005] However, to achieve a win-win situation with multiple external channels, it's necessary to integrate these channels with our platform to facilitate the mutual push of coupon information. But with multiple external channels involved, each channel's system has inconsistent concurrency capabilities. Pushing internal coupon information involves high traffic, and if the traffic is redeemed at a 1:1 ratio, some external systems will frequently report errors, causing them to crash. This can lead to significant losses for both parties. Summary of the Invention
[0006] Therefore, it is necessary to provide a message push method, computer device, and storage medium to address the aforementioned technical problems.
[0007] A message push method, the method comprising:
[0008] Obtain message push requests from external channels, and generate internal push requests and external push requests based on the message push requests;
[0009] Internal messages are pushed according to the generated internal push request;
[0010] The generated external push request is pushed to the message queue. Preset rules for external calls to the message queue are set within a specific time period, and the push request is retrieved from the message queue according to the preset rules.
[0011] External messages are pushed based on the obtained push requests;
[0012] The preset rules include sorting the system concurrency capabilities of each external channel and controlling the request speed of the message queue to call externally to meet the requirement of the external channel with the lowest system concurrency capability; the concurrency capability is the maximum number of messages that can be pushed simultaneously per unit time.
[0013] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, performs the following steps:
[0014] Obtain message push requests from external channels, and generate internal push requests and external push requests based on the message push requests;
[0015] Internal messages are pushed according to the generated internal push request;
[0016] The generated external push request is pushed to the message queue. Preset rules for external calls to the message queue are set within a specific time period, and the push request is retrieved from the message queue according to the preset rules.
[0017] External messages are pushed based on the obtained push requests;
[0018] The preset rules include sorting the system concurrency capabilities of each external channel and controlling the request speed of the message queue to call externally to meet the requirement of the external channel with the lowest system concurrency capability; the concurrency capability is the maximum number of messages that can be pushed simultaneously per unit time.
[0019] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps:
[0020] Obtain message push requests from external channels, and generate internal push requests and external push requests based on the message push requests;
[0021] Internal messages are pushed according to the generated internal push request;
[0022] The generated external push request is pushed to the message queue. Preset rules for external calls to the message queue are set within a specific time period, and the push request is retrieved from the message queue according to the preset rules.
[0023] External messages are pushed based on the obtained push requests;
[0024] The preset rules include sorting the system concurrency capabilities of each external channel and controlling the request speed of the message queue to call externally to meet the requirement of the external channel with the lowest system concurrency capability; the concurrency capability is the maximum number of messages that can be pushed simultaneously per unit time.
[0025] The aforementioned message push method, computer equipment, and storage media have limitations. Since the internal channels have relatively high system concurrency capabilities, when connecting to multiple external channels, the concurrency capabilities of each external channel are inconsistent. Therefore, a 1:1 exchange of push messages cannot be implemented, otherwise, it could easily lead to frequent errors and crashes in the systems of external channels with lower concurrency capabilities. Therefore, a message queue is introduced. External push requests from external channels are first pushed to the message queue for queuing. Simultaneously, preset rules are established to control external calls, ensuring that the request speed from the message queue within a specific time period is based on the external channel with the lowest system concurrency capability. This allows for normal message push from multiple external channels. Attached Figure Description
[0026] Figure 1 , one Application environment diagram of message push in one embodiment;
[0027] Figure 2 , one A detailed flowchart illustrating the message push steps in one embodiment;
[0028] Figure 3 , one A schematic diagram of the system flow for message push in one embodiment;
[0029] Figure 4 , one An internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0031] It is understood that the term "or / and" used in this application describes the relationship between related objects, indicating that three relationships can exist. For example, A or / and B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the related objects before and after it have an "or" relationship.
[0032] The message push method provided in this application can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. Terminal 102 can send a message push request to server 104. After receiving the message push request, server 104 can generate an internal push request and an external push request, and then push internal messages according to the generated internal push request; push the generated external push request to a message queue, set preset rules for external calls to the message queue within a specific time period, and retrieve requests to be pushed from the message queue according to the preset rules; and push external messages based on the retrieved requests to be pushed. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices, and server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0033] In one embodiment, such as Figure 2 , Figure 3 As shown, a message push method is provided, which can be applied to... Figure 1 Taking the server in the example, the following steps are included:
[0034] S101. Obtain parameters for external channel access and enable multiple external channels to connect with the open platform;
[0035] In this embodiment, it should be noted that message push is described in detail using coupon distribution as an example, but it is not limited to coupon distribution and can also include other information. Therefore, the message push described in this embodiment refers to coupon distribution. In one example, due to operational needs, a company needs to cooperate with multiple external channels to achieve mutual coupon distribution. Therefore, multiple external channels need to connect with the company's open platform through external push interfaces. In this embodiment, Vipshop is used as an example, but it is not limited to Vipshop and can also include other merchants. In addition, in this embodiment, distributing internal coupons mainly refers to distributing Vipshop coupons to users, while distributing external coupons mainly refers to distributing coupons from other external channels besides Vipshop to users. External channels refer to merchants other than Vipshop. When external channels need to access the open platform, they need to obtain access parameters and reach a consensus on the parameters through the open platform and the external push interface to complete the access of the external channel. The access parameters obtained can be the activity ID number, key, or API (Application Program Interface) verification sequence number, etc. Therefore, when accessing, an encryption method is agreed upon with the open platform, such as symmetric encryption or other encryption methods. The information transmitted through the external push interface is decrypted, thereby realizing the mutual communication connection between the open platform and external channels.
[0036] S102. Perform pre-verification on message push requests from external channels, and request to call the external push interface if the preset conditions are met.
[0037] In this embodiment, it should be noted that a pre-verification is performed before calling the message push request from an external channel to determine whether the verification result meets preset conditions. If the preset conditions are met, a request to call the external push interface will be sent to distribute coupons. If the preset conditions are not met, a request to call the external push interface will not be sent, and the system will enter a silent state to wait for the next resend request. Furthermore, the request is sent via the network. Considering that network factors may affect the activity system's call to the external push interface, timeout issues are likely to occur. Therefore, if a call error occurs, several retries are required. Additionally, during the process of calling the external push interface to distribute coupons, to protect user information privacy, different encryption methods are used to encrypt the user's mobile phone number based on the nature of each external channel.
[0038] In some embodiments, determining whether the verification result meets preset conditions includes: determining whether the external channel needs to push messages or whether it exceeds the total number of push messages for the day, that is, determining whether the external channel needs to distribute coupons or whether it exceeds the total number of coupons to be distributed for the day. When the external channel needs to distribute coupons, it will request to call the external push interface; otherwise, when the external channel's coupon distribution amount for the day exceeds the total number of coupons to be distributed for the day, it will not request to call the external push interface.
[0039] S103. Call the message push request from the external channel, and generate an internal push request and an external push request based on the message push request;
[0040] In this embodiment, it should be noted that after an external channel accesses the open platform, it requests coupon distribution via an external push interface. At this time, the open platform generates a corresponding coupon distribution message based on the push request and transmits the message to the activity system. During transmission, the coupon distribution message needs to be encrypted. Therefore, upon receiving the message, the activity system needs to decrypt it. The activity system then categorizes the decrypted message into internal push requests and external push requests. The coupon distribution message includes a mobile phone number and an activity ID. During decryption, the activity system also needs to convert the activity ID into an activity number to be used in conjunction with the mobile phone number. The mobile phone number includes both registered and unregistered users on Vipshop's internal open platform.
[0041] Additionally, in this embodiment, it's important to note that as the number of external channels increases, the interface documentation for each channel differs. Therefore, to enhance the scalability of the open platform, a factory pattern and Spring Bean features are used for each external channel. The key feature is Spring Bean's Inversion of Control (IoC). Class creation is handled by the container, and the class name is retrieved from the container during usage. Thus, the interface content can be encapsulated according to the needs and customizations of each external channel. Different classes for connecting to external channels can be defined and created independently. These encapsulated classes are placed in the system's container (Spring's ApplicationContext container), and the class's coupon distribution method is called to distribute coupons to the external channel based on the configuration. For example, the method for processing Qunar.com is designated as class a, and the method for Hello Chuxing is designated as class b. The configuration determines which class a and class b to retrieve from the container for execution.
[0042] S104. Push the generated external push request to the message queue, retrieve the message to be pushed from the message queue according to the preset rules within a specific time period, and push the external message according to the retrieved message to be pushed.
[0043] In this embodiment, it should be noted that, to improve processing efficiency, a new thread is used to distribute external coupons, thus not affecting the efficiency and response time of the original activity. In some embodiments, since the concurrency capabilities of each external channel are inconsistent, a message queue is introduced to avoid affecting the external channel system. The message queue is a linked list of messages; each message can be viewed as a record with a specific format and priority. Processes with write permissions to the message queue can add new messages according to certain rules; processes with read permissions can read messages from the message queue. Thus, generated external push requests can be first pushed to the message queue, and then the scheduled task system retrieves the push request messages from the message queue according to preset rules within a specific time period for consumption. Message queues are important components in distributed systems; their use is mainly to improve system performance and reduce peak loads and coupling through asynchronous processing.
[0044] The specific time period could be for distributing coupons for the annual Double Eleven shopping festival or year-end coupons. This specific time period is set within a certain period before Double Eleven or within a certain period at the end of each year. During this specific period, messages in the message queue are consumed by a scheduled task system. Because the concurrency capabilities of each external channel's system are inconsistent, preset rules are set for external calls to the message queue. External channels retrieve push request messages from the message queue according to these preset rules, ensuring that all external channels can distribute coupons normally without causing system crashes.
[0045] In one example, the default rule is to sort each external channel system according to its concurrency capacity and control the request speed of the message queue to meet the minimum concurrency capacity of the external channel. When the open platform connects to external channels, the operations team will inquire about the concurrency capacity supported by the external channel system in the early stages. Then, based on the external channels that have been connected, each external channel is marked with a numerical code, such as 1, 2, 3, etc. The order of the marked numbers represents the concurrency capacity of the external channel system. Therefore, when calling the external channel to distribute coupons, the external channels are sorted according to the pre-marked numerical values, and the request speed of the message queue to be called is adjusted in real time to meet the minimum concurrency capacity of the external channel. This way, all external channels can distribute coupons normally without causing the other party's system to crash.
[0046] Concurrency capacity refers to the maximum number of messages that can be pushed simultaneously within a unit of time. For example, if the external channels are Hello Bike and Qunar, Hello Bike's system can distribute 10,000 coupons per hour, and Qunar can distribute 20,000 coupons per hour. If the message queue contains 20,000 coupons, and Qunar and Hello Bike request and consume coupons from the message queue at a rate of 20,000 coupons per hour, Hello Bike's system processing capacity is limited and cannot handle it, potentially leading to system crashes or errors. Therefore, it is necessary to adjust the request speed of the message queue to meet the concurrency capacity of Hello Bike's system, allowing consumption at a rate of 10,000 coupons per hour. In this case, the concurrency capacity of both Hello Bike and Qunar is within the system's processing range.
[0047] In some embodiments, after obtaining the message to be pushed, the activity ID is identified, and the corresponding external push interface is called based on the activity ID. External coupons are then distributed according to the configuration, which mainly includes the activity name, activity start and end times, activity type, channel configuration, audience configuration, coupon distribution time period, hourly coupon distribution limit, coupon type, etc. The coupon type can be dynamically added or deleted, and necessary information for configuring external coupons is configured, such as coupon ID, daily coupon distribution volume, etc.
[0048] S105. Record the volume and status of push messages to external channels during the push period;
[0049] In this embodiment, it should be noted that Redis (Remote DIctionary Server) is used for data recording and caching. Redis is a single-threaded, non-relational database primarily used for data caching, which protects the database and improves query efficiency. Therefore, the volume of push messages from external channels, i.e., the amount of coupons distributed, is recorded in Redis in real time. A preset threshold is set based on the recorded push message volume. When the push message volume exceeds the preset threshold, the distribution of external coupons is stopped. The push time period can be 7:00-19:00 daily, or other time periods. This embodiment only uses 7:00-19:00 as an example for illustration. During this time period, the volume of push messages from external channels is recorded, mainly recording the total number of push messages per hour and the daily push message volume of a single external channel. To avoid push messages being concentrated at a certain time point while no messages are pushed at other times, it is necessary to limit the push message volume, distributing the push message volume evenly across each time point or time period.
[0050] Because coupon distribution requires rate limiting, external coupons will stop being distributed when either the total number of messages pushed per hour or the daily number of messages pushed through a single external channel exceeds a preset threshold. For example, the preset threshold could be set to 300,000 coupons pushed per hour or 1 million coupons pushed through a single external channel per day. Since the push period is from 7:00 AM to 7:00 PM, the records for that day need an expiration date. This expiration date could be set to automatically expire at midnight each day or be reset to zero, requiring a new round of recording.
[0051] In this embodiment, it should also be noted that, since the request speed for external calls to the message queue is controlled, messages may accumulate in the message queue during the push period. If too many messages accumulate, it will also affect the stability of the system. Therefore, it is necessary to pay attention to whether there is message accumulation during the push period. In addition, if the accumulated messages exceed a certain threshold, the system will send a warning message to the terminal of the open platform or the official account, etc., to remind the staff to pay attention to the cause of the accumulation and make adjustments.
[0052] In one example, the status of push messages from external channels is recorded in Redis in real time. This includes recording the number of successful pushes, the number of failed pushes, and the total number of pushes. Redis also has a timer function, which writes the recorded data to the database every hour and generates a push data statistics table. The push data statistics table is pushed to the data warehouse, and operators can download the push data statistics table from the data warehouse to view the details of the daily coupon pushes and perform data verification with external channels.
[0053] In another example, the push records of external channels are also monitored graphically. The daily coupon push volume of the system can be monitored graphically through the monitoring system to track the number of coupons pushed to each external channel and the number of failed requests. Some critical errors, such as configuration errors causing push failures, excessive backlog in the push queue, and network anomalies, will also trigger WeChat or email alerts, making it easier to detect abnormal traffic in a timely manner and make adjustments to the system. These adjustments could include adjusting the daily coupon push volume of external channels, etc.
[0054] S106. Perform risk control verification based on the generated internal push request, and distribute internal coupons in non-risk control situations.
[0055] In this embodiment, it should be noted that the activity system first calls the risk control verification service of the risk control system to check whether the decrypted mobile phone number is subject to risk control. Only when no risk control is detected will the system call the coupon distribution system to distribute the configured internal coupons to the user based on the mobile phone number. If a risk control anomaly is detected, the activity system will send a request failure message to the mobile phone number and provide a friendly prompt. The mobile phone number risk control verification mainly includes checking whether the mobile phone number is used by a fake account or whether there is malicious coupon claiming.
[0056] In one example, the coupon distribution system also verifies user tags, mainly to check whether the user who received the coupon is a new customer, an old customer, or a registered member. The user tag system can query user tags, and after querying, user information can be obtained, mainly to know whether the user is a registered member or an old customer, and prompting unregistered users to register, or conducting coupon feedback surveys for old customers, etc.
[0057] In another example, the coupon distribution system can also return the coupon distribution results to the user, informing the user that they have not yet registered as a member or to check the coupon and use it in time. The returned results include an identifier of the user's group, which mainly includes information such as whether the user is a new or old customer or a registered member.
[0058] S107. Return the coupon distribution results to external channels;
[0059] In this embodiment, it should be noted that the coupon distribution system also returns the coupon distribution results to external channels. The external channels edit different text messages according to the identifiers used for their respective groups. The text messages may include information such as the type of coupon received and the usage period. The coupon distribution results are then sent to users via push notification or SMS.
[0060] In one embodiment, a computer device is provided, which may be a server or a terminal. Its internal structure diagram can be as follows: Figure 4As shown. The computer device includes a processor, memory, and network interface connected via a system bus. Depending on the needs, the computer device may also include a display screen and input devices, or it may also include a database. Figure 4 The illustration shows a configuration including a display screen and input devices, but excluding a database. The processor of this computer device provides computational and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs, and may store a database as needed. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communication with external terminals or terminals via a network connection. When the computer program is executed by the processor, it implements a message push method. The display screen of the computer device can be an LCD screen or an e-ink screen. The input devices of the computer device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad located on the computer device casing, or an external keyboard, touchpad, or mouse, etc.
[0061] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0062] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the message push method of any of the above embodiments.
[0063] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the message push method of any of the above embodiments.
[0064] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0065] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0066] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A message push method, characterized in that, The method includes: Obtain message push requests from external channels, and generate internal push requests and external push requests based on the message push requests; Internal messages are pushed according to the generated internal push request; The generated external push request is pushed to the message queue. A preset rule for the message queue to make external calls is set within a specific time period, and the push request is retrieved from the message queue according to the preset rule. A backlog threshold for the message queue is set within a specific time period. When the backlog of message requests in the message queue exceeds the backlog threshold, the request speed for the message queue to make external calls is adjusted. External messages are pushed based on the obtained push requests; Pushing external messages based on the acquired push requests includes: recording the number of push messages and / or the push status in real time during the push period; setting a preset threshold based on the recorded number of push messages, and stopping the push of external messages when the number of push messages exceeds the preset threshold; generating a data statistics table based on the recorded push status for external channels to perform data verification. Real-time recording of push message volume and / or push status during the push period includes: recording the total number of push messages per hour and the daily push message volume of a single external channel; stopping external message push when either exceeds a preset threshold; recording the number of successful pushes, the number of failed pushes, and the total number of pushes. The preset rules include sorting the system concurrency capabilities of each external channel and controlling the request speed of the message queue to call externally to meet the requirement of the external channel with the lowest system concurrency capability; the concurrency capability is the maximum number of messages that can be pushed simultaneously per unit time.
2. The method according to claim 1, characterized in that, Obtaining message push requests from external channels and generating internal and external push requests based on the message push requests includes: obtaining configuration information of external channels, configuring corresponding external push interfaces based on the obtained configuration information, and calling message push requests from external channels based on the external push interfaces.
3. The method according to claim 2, characterized in that, Before calling the message push request of the external channel according to the external push interface, the method also includes: performing a pre-verification of the external channel during the push period to determine whether the verification result meets the preset conditions. If it meets the conditions, a push request to call the external channel is sent. If the push request fails, it is called again. If it does not meet the conditions, it enters a silent state and waits for the next call.
4. The method according to claim 3, characterized in that, The determination of whether the verification result meets the preset conditions includes: determining whether the external channel needs to push messages or whether it exceeds the total number of push messages for the day.
5. The method according to claim 1, characterized in that, Before pushing an internal message based on the generated internal push request, the process also includes: performing risk control verification on the generated internal push request; if the risk control verification is normal, then pushing the internal message; if the risk control verification is abnormal, then sending the request fails and a prompt is given.
6. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for controlling multi-machine distributed accesses to external system and distributed system for accessing external system
CN108234481A
Message queue-based data processing method and device, computer equipment and medium
CN112612607A