Message processing method, device, equipment and computer storage medium
By dynamic splitting and flow control configuration adjustment of message queues, the problem of poor message sending flexibility is solved, the flexibility and efficiency of message sending is improved, and the sending time is met.
Patent Information
- Application Number
- CN202110209925.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-24
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-02-24
AI Technical Summary
In the prior art, the flexibility of sending messages is poor, and the sending parameters of the message queue cannot be dynamically adjusted, resulting in the failure to meet the actual sending time requirements.
By obtaining the pending message queue, splitting it according to the preset sending time requirements, dynamically adjusting the flow control configuration information of the message queue to ensure that the message queue meets the sending time requirements.
It realizes the flexibility of message transmission, and can dynamically adjust the sending method of message queue according to actual needs, ensure that message transmission meets the preset transmission time requirements, and improves the sending efficiency and accuracy of message queues.
Smart Images

Figure CN112925659B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to customer message notification management technology of financial technology (Fintech), and is related to but not limited to a message processing method, device, electronic device and computer storage medium. Background Art
[0002] With the development of computer technology, more and more technologies are being applied in the financial field. Traditional finance is gradually transforming into financial technology. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology.
[0003] Currently, in a message sending scenario, it is necessary to pre-configure message sending parameters, for example, it is necessary to pre-configure message sending priority and information such as the number of transactions per second (TPS), so that messages in a message queue can be sent based on the pre-configured sending parameters. However, in the related art, message sending is only based on pre-configured fixed sending parameters, resulting in poor flexibility in message sending. Summary of the invention
[0004] The embodiments of the present application provide a message processing method, device, electronic device and computer storage medium, which can solve the problem of poor flexibility in message sending in the related art.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present invention provides a message processing method, which includes:
[0007] Get the queue of messages to be processed;
[0008] When the message queue to be processed does not meet the preset sending timeliness requirement, the message queue is split according to the preset queue splitting strategy to obtain each message queue after splitting, and each message queue after splitting is determined as the message queue to be processed;
[0009] When the message queue to be processed meets the preset sending timeliness requirement, the messages in the message queue to be processed are sent.
[0010] In some embodiments of the present application, the method further includes:
[0011] When the average sending time length of the message queue to be processed is greater than the first preset time length, or the overall sending time length of the message queue to be processed is greater than the second preset time length, or the number of messages in the message queue to be processed that do not need to be sent in priority is greater than the first preset value, it is determined that the message queue to be processed does not meet the preset sending time requirement;
[0012] When the average sending duration of the message queue to be processed is less than or equal to the first preset duration, and the overall sending duration of the message queue to be processed is less than or equal to the second preset duration, and the number of messages that do not need to be sent in priority in the message queue to be processed is less than or equal to the first preset value, it is determined that the message queue to be processed meets the preset sending timeliness requirement.
[0013] It can be seen that in an embodiment of the present application, the message queue can be split based on factors such as the average sending time of the message queue to be processed, the overall sending time, and the messages in the message queue to be processed that do not need to be sent in priority. Thus, when the split message queue meets the preset sending time requirement, it can be considered that the average sending time of the message queue to be processed, the overall sending time, and the messages in the message queue to be processed that do not need to be sent in priority meet the preset sending time requirement, thereby making the sending of messages in the message queue meet actual needs.
[0014] In some embodiments of the present application, the method further includes:
[0015] After splitting the message queue, determining flow control configuration information of each message queue after the split;
[0016] According to the flow control configuration information of the message queue to be processed, the average sending duration of the message queue to be processed is determined; according to the average sending duration of the message queue to be processed, the overall sending duration of the message queue to be processed is determined.
[0017] It can be seen that the embodiment of the present application can accurately determine the average sending time and the overall sending time of the message queue to be processed based on the flow control configuration information of the message queue to be processed, thereby facilitating accurate judgment of whether the message queue to be processed meets the preset sending time requirement, and further, facilitating accurate message sending in accordance with the sending time requirement.
[0018] In some embodiments of the present application, the determining of the flow control configuration information of each message queue after splitting includes:
[0019] The flow control configuration information of each message queue after the splitting is determined according to the number of messages in each message queue after the splitting and the preset sending timeliness requirement.
[0020] In this way, based on the flow control configuration information of each message queue after splitting, it is helpful to make each message queue after splitting meet the sending time requirement, that is, it is helpful to timely obtain the pending message queue that meets the sending time requirement, thereby improving the sending efficiency of the pending message queue.
[0021] In some embodiments of the present application, the determining of the flow control configuration information of each message queue after splitting includes:
[0022] According to the type of messages in each message queue after the splitting, flow control configuration information of each message queue after the splitting is determined.
[0023] In this way, based on the flow control configuration information of each message queue after splitting, it is beneficial to make the sending of each message queue after splitting conform to the objective situation of the message type, and it is beneficial to the classified loading and sending of various types of messages.
[0024] In some embodiments of the present application, the message queue is split according to a preset queue splitting strategy to obtain each message queue after splitting, including:
[0025] When the average sending time of the message queue to be processed is greater than the first preset time or the overall sending time of the message queue to be processed is greater than the second preset time, in the message queue to be processed, the messages having a priority higher than the pre-priority are split to obtain each message queue after the split;
[0026] When the number of messages that do not need to be sent with priority in the message queue to be processed is greater than a first preset value, the messages that do not need to be sent with priority in the message queue to be processed are split to obtain each message queue after the splitting.
[0027] It can be seen that the embodiment of the present application can specifically process messages that do not need to be sent with priority, and specifically process messages with a priority higher than the pre-priority, thus facilitating the implementation of message sending according to objective actual needs.
[0028] In some embodiments of the present application, when the message queue to be processed meets a preset sending timeliness requirement, sending the message in the message queue to be processed includes:
[0029] When the message queue to be processed meets the preset sending timeliness requirement, the type of the message queue to be processed is determined according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set; the old queue set represents the set of message queues currently processed by each application instance, each application instance represents a service for processing message queues, and the new queue set represents the set of each message queue after splitting;
[0030] According to the type of the message queue to be processed, the messages in the message queue to be processed are sent.
[0031] It can be seen that the embodiment of the present application can accurately determine the type of the message queue to be processed based on the relationship between the message queue to be processed and the old queue set, as well as the relationship between the message queue to be processed and the new queue set. This is beneficial for accurately sending messages in the message queue to be processed according to the type of the message queue to be processed.
[0032] In some embodiments of the present application, determining the type of the message queue to be processed according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set, includes:
[0033] When the message queue to be processed is in the old queue set and the message queue to be processed is not in the new queue set, determining that the message queue to be processed is a message queue that needs to stop sending;
[0034] When the message queue to be processed is in the old queue set and the message queue to be processed is in the new queue set, determining that the message queue to be processed is a message queue that needs to update flow control configuration information;
[0035] When the message queue to be processed is not in the old queue set and the message queue to be processed is in the new queue set, it is determined that the message queue to be processed is a newly added queue.
[0036] It can be seen that the embodiment of the present application can accurately determine whether the message queue to be processed is a message queue that needs to stop sending, a message queue that needs to update the flow control configuration information, or a newly added queue based on the relationship between the message queue to be processed and the old queue set, as well as the relationship between the message queue to be processed and the new queue set. This is beneficial for subsequent targeted processing of the message queue according to the type of the message queue to be processed.
[0037] In some embodiments of the present application, sending the message in the message queue to be processed according to the type of the message queue to be processed includes:
[0038] When the message queue to be processed is a message queue that needs to stop sending, in each application instance, stopping the processing process of the message queue to be processed;
[0039] When the message queue to be processed is a message queue for which flow control configuration information needs to be updated, in each application instance, the flow control configuration information of the message queue to be processed is updated;
[0040] When the message queue to be processed is a newly added queue, in each application instance, a processing process for the message queue to be processed is started.
[0041] It can be seen that the embodiment of the present application can perform subsequent targeted processing on the message queue according to the type of the message queue to be processed.
[0042] In some embodiments of the present application, in each application instance, updating the flow control configuration information of the message queue to be processed includes:
[0043] When the states of the various application instances are synchronized, in each of the application instances, the flow control configuration information of the message queue to be processed is updated;
[0044] In each of the application instances, starting a process for processing the message queue to be processed includes:
[0045] When the states of the various application instances are synchronized, the processing process of the to-be-processed message queue is started in each of the application instances.
[0046] It can be seen that the embodiment of the present application can update the flow control configuration information or start the processing process of the message queue to be processed when the status of each application instance is synchronized, so that each application instance can perform message processing synchronously.
[0047] In some embodiments of the present application, the method further includes:
[0048] In each application instance, an application instance with an abnormal status is eliminated, wherein the interval between the heartbeat time of the application instance with the abnormal status and the current time is greater than the preset time interval.
[0049] It can be seen that the embodiment of the present application can eliminate application instances that have not updated data for a long time by eliminating application instances with abnormal status, which is beneficial to saving resources and improving the accuracy and reliability of message queue processing.
[0050] In some embodiments of the present application, the method further includes:
[0051] When the identifier of the message in the to-be-processed message queue is consistent with the identifier of the sent message, the sending of the message in the to-be-processed message queue is stopped.
[0052] It can be seen that the embodiment of the present application can achieve the bottom-line control of preventing duplicate sending through the uniqueness of the message identifier.
[0053] In some embodiments of the present application, the method further includes:
[0054] When the time interval from the last message sending exceeds the third preset time length, the messages in the to-be-processed message queue are sent using a preset message sending method.
[0055] It can be seen that when the time interval from the last message sending exceeds the third preset time length, it can be considered that the application instance has not processed messages for a long time, which may lead to missed messages. In an embodiment of the present application, the messages in the message queue to be processed are sent through the preset message sending method, which is conducive to preventing missed messages.
[0056] The present application provides a message processing device, the device comprising:
[0057] The acquisition module is used to obtain the message queue to be processed;
[0058] A processing module is used to split the message queue according to a preset queue splitting strategy when the message queue to be processed does not meet the preset sending time requirement, to obtain each message queue after the split, and to determine each message queue after the split as the message queue to be processed; when the message queue to be processed meets the preset sending time requirement, to send the messages in the message queue to be processed.
[0059] An embodiment of the present application provides an electronic device, the electronic device comprising:
[0060] A memory for storing executable instructions;
[0061] The processor is used to implement any one of the above-mentioned message processing methods when executing the executable instructions stored in the memory.
[0062] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for implementing any of the above-mentioned message processing methods when executed by a processor.
[0063] In an embodiment of the present application, a message queue to be processed is obtained; when the message queue to be processed does not meet the preset sending time requirement, the message queue is split according to a preset queue splitting strategy to obtain each message queue after the split, and each message queue after the split is determined as the message queue to be processed; when the message queue to be processed meets the preset sending time requirement, the messages in the message queue to be processed are sent.
[0064] It can be seen that in the embodiment of the present application, the message queue can be dynamically split according to the relationship between the message queue to be processed and the preset sending time requirement. Therefore, the embodiment of the present application does not need to rely on pre-configured fixed sending parameters to send messages, but can flexibly change the message sending method during the message sending process, that is, the message sending has high flexibility, and by dynamically splitting the message queue, the sending of the message can meet the preset sending time requirement, so that the embodiment of the present application can send the message in the message queue according to the actual time requirement. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A flow chart of a message processing method according to an embodiment of the present application;
[0066] Figure 2 Another flow chart of the message processing method according to an embodiment of the present application;
[0067] Figure 3 This is a schematic diagram of an optional composition structure of a message processing device according to an embodiment of the present application;
[0068] Figure 4 A schematic diagram of an optional composition structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The present application will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the embodiments provided herein are only used to explain the present application and are not intended to limit the present application. In addition, the embodiments provided below are partial embodiments for implementing the present application, rather than providing all embodiments for implementing the present application. In the absence of conflict, the technical solutions recorded in the embodiments of the present application can be implemented in any combination.
[0070] It should be noted that, in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or device including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other related elements (such as steps in a method or units in a device, for example, a unit may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or device including the element.
[0071] For example, the message processing method provided in the embodiment of the present application includes a series of steps, but the message processing method provided in the embodiment of the present application is not limited to the recorded steps. Similarly, the message processing device provided in the embodiment of the present application includes a series of modules, but the device provided in the embodiment of the present application is not limited to including the modules explicitly recorded, and may also include modules that need to be set up to obtain relevant information or perform processing based on information.
[0072] In related technologies, a message queue can represent a collection of several messages to be sent that meet a certain preset rule. The preset rule is determined according to the message type. In some embodiments, messages can be classified according to message priority, product, business scenario, etc. Here, message priority represents the priority order of loading and sending messages; product represents the product corresponding to the message, for example, when two messages belong to two different loan products, the two messages belong to different products; business scenario represents different message scenarios under a product, for example, for loan product A, the repayment reminder message and the loan success reminder message of loan product A belong to different business scenarios.
[0073] In the related art, for a message queue, messages in the message queue are sent based on pre-configured sending parameters. However, this message sending solution has the following problems: 1) It is necessary to pre-define the message priority, and configure the mapping relationship between business products and business scenarios to priorities. The sending of messages depends on the pre-defined and configured information. After the message is saved to the to-be-sent table, its queue attributes are fixed according to the pre-configured information and cannot be dynamically updated again. The newly split queue cannot be applied to the saved but unsent data, and the flexibility is low; 2) The flow control configuration information of the message sending, such as TPS, is equal to the pre-configured fixed information, that is, the TPS when the message is sent is a fixed TPS, and the dynamic prediction model cannot be used to calculate and allocate the flow control configuration information in real time.
[0074] In view of the above technical problems, the technical solutions of the embodiments of the present application are proposed. The embodiments of the present application can be applied to terminals and / or servers, where the terminals can be thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, programmable consumer electronics products, network personal computers, small computer systems, etc. The servers can be small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.
[0075] Electronic devices such as servers may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules may include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers may be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules may be located on local or remote computing system storage media including storage devices.
[0076] Figure 1 A flow chart of a message processing method according to an embodiment of the present application is shown in FIG. Figure 1 As shown, the process may include:
[0077] Step 101: Get the message queue to be processed.
[0078] In an embodiment of the present application, the message queue to be processed represents a collection of messages that need to be loaded and sent, and the message queue to be processed includes at least one message; the number of message queues to be processed can be one or more, and the embodiment of the present application does not limit this.
[0079] In some embodiments, a message sending request may be obtained, and the message to be loaded and sent may be carried in the message sending request. In this way, by processing the message sending request, a message queue to be processed may be determined.
[0080] In some embodiments, after obtaining the message queue to be processed, the product or business scenario to which the messages in the message queue belong can be determined. The product or business scenario to which the messages belong can be determined by the indication information in the message sending request. Therefore, by performing message processing on the message queue to be processed, the product or business scenario to which the messages in the message queue belong can be determined.
[0081] Exemplarily, Structured Query Language (SQL) can be used to directly count the to-be-sent table, which is used to record the number of messages to be sent for each product or each business scenario. The disadvantage of using SQL to directly count the to-be-sent table is that when the amount of data in the messages to be sent is large, the SQL execution efficiency is low. According to predetermined performance requirements, such SQL may need to be executed in the standby database. Due to the synchronization delay between the primary and standby databases and the limitation of query efficiency, the timeliness of statistical data is poor.
[0082] In response to the problems of the solution using SQL statistics with sending tables, in some embodiments, the message counter in the cache can record the number of messages to be sent for each product or each business scenario. In this case, even when the amount of data in the messages to be sent is large, the cache can be used to record the number of messages to be sent. There is no need to record data based on the primary and standby databases, and it is not limited by the synchronization delay of the primary and standby databases, and the query efficiency. Therefore, compared with the above-mentioned solution using SQL statistics with sending tables, statistical data can be obtained more timely to a certain extent.
[0083] Step 102: When the message queue to be processed does not meet the preset sending time requirement, the message queue is split according to the preset queue splitting strategy to obtain each message queue after the split, and each message queue after the split is determined as the message queue to be processed; when the message queue to be processed meets the preset sending time requirement, the messages in the message queue to be processed are sent.
[0084] In the embodiment of the present application, the sending time requirement is used to characterize the parameters that make the message sending time meet the actual needs. For example, the message of product 1 needs to be sent first, and the message in business scenario 2 does not need to be sent first.
[0085] The queue splitting strategy may be related to the sending time requirement. It should be noted that after the message queue to be processed is split for the first time according to the preset queue splitting strategy, each message queue after the split may not meet the preset time sending requirement. When any of the split message queues does not meet the preset time sending requirement, any of the above message queues may be split again until each of the split message queues meets the preset time sending requirement.
[0086] In an embodiment of the present application, after each split message queue is determined as a message queue to be processed, step 102 can be repeatedly executed until the message queue to be processed meets the preset sending time requirement, and the messages in the message queue to be processed are sent.
[0087] In some embodiments, when the message queue to be processed does not meet the preset sending time requirement, the message queue may not be split, but the flow control configuration information of the messages in the message queue may be changed, and then the message queue with the changed flow control configuration information is determined as the message queue to be processed.
[0088] In practical applications, steps 101 to 102 can be implemented based on a processor of an electronic device, and the processor can be at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor. It can be understood that the electronic device that implements the above-mentioned processor function can also be other, and the embodiments of the present application are not limited.
[0089] It can be seen that the embodiment of the present application can dynamically split the message queue according to the relationship between the message queue to be processed and the preset sending time requirement. Therefore, the embodiment of the present application does not need to rely on pre-configured fixed sending parameters to send messages, but can flexibly change the message sending method during the message sending process, that is, the message sending has high flexibility, and by dynamically splitting the message queue, the sending of the message can meet the preset sending time requirement, so that the embodiment of the present application can send the message in the message queue according to the actual time requirement.
[0090] In some embodiments, the preset sending time requirement may include at least one of the following: the average sending time of the message queue to be processed is less than or equal to a first preset time, the overall sending time of the message queue to be processed is less than or equal to a second preset time, and the number of messages in the message queue to be processed that do not need to be sent in priority is less than or equal to a first preset value.
[0091] In the embodiment of the present application, the average sending time of the message queue to be processed represents the estimated average sending time, rather than the actual average sending time; in some embodiments, the first preset time can be preset according to actual needs, for example, the first preset time can be the maximum acceptable sending time configured in the service parameters, and the service parameters can be pre-configured parameters. Exemplarily, when the average sending time of the message queue to be processed is greater than the first preset time, it can be considered that there is a risk of delay for high-priority messages; when the average sending time of the message queue to be processed is less than or equal to the first preset time, it can be considered that there is no risk of delay for high-priority messages.
[0092] In an embodiment of the present application, after the average sending duration of the message queue to be processed is obtained, the overall sending duration of the message queue to be processed can be determined according to the number of messages in the message queue to be processed, that is, the number of messages in the message queue to be processed is multiplied by the average sending duration to obtain the overall sending duration of the message queue to be processed. Obviously, the overall sending duration of the message queue to be processed is also an estimated value. In some embodiments, the second preset duration can be pre-set according to actual needs. For example, the second preset duration can be 150% of the preset threshold. Exemplarily, when the overall sending duration of the message queue to be processed is greater than the second preset duration, it can be considered that the overall sending duration of the message queue to be processed does not meet the actual delay requirements; when the overall sending duration of the message queue to be processed is less than or equal to the second preset duration, it can be considered that the overall sending duration of the message queue to be processed meets the actual delay requirements.
[0093] In an embodiment of the present application, messages that do not need to be sent as priority represent messages that are not sensitive to duration, and the first preset value may be set empirically based on actual scenario requirements, or may be set based on the historical sending duration of the message queue; illustratively, when the number of messages that do not need to be sent as priority in the message queue to be processed is greater than the first preset value, it may be considered that the messages that do not need to be sent as priority in the message queue need to be processed in a targeted manner.
[0094] It can be seen that in an embodiment of the present application, the message queue can be split based on factors such as the average sending time of the message queue to be processed, the overall sending time, and the messages in the message queue to be processed that do not need to be sent in priority. Thus, when the split message queue meets the preset sending time requirement, it can be considered that the average sending time of the message queue to be processed, the overall sending time, and the messages in the message queue to be processed that do not need to be sent in priority meet the preset sending time requirement, thereby making the sending of messages in the message queue meet actual needs.
[0095] In some embodiments, after the message queue is split, the flow control configuration information of each message queue after the split can also be determined; then, based on the flow control configuration information of the message queue to be processed, the average sending time of the message queue to be processed is determined; based on the average sending time of the message queue to be processed, the overall sending time of the message queue to be processed is determined.
[0096] Exemplarily, if the message queue to be processed is split when the overall sending duration of the message queue to be processed is greater than a second preset duration, the average sending duration of the message queue to be processed can be determined based on the flow control configuration information of the message queue to be processed; then, the overall sending duration of the message queue to be processed is updated based on the average sending duration of the message queue to be processed.
[0097] If the message queue to be processed is not split when the overall sending duration of the message queue to be processed is greater than the second preset duration, then after the message queue to be processed is split, the average sending duration of the message queue to be processed can be determined according to the flow control configuration information of the message queue to be processed; then, the overall sending duration of the message queue to be processed can be directly determined according to the average sending duration of the message queue to be processed.
[0098] Exemplarily, before the message queue is split for the first time, the flow control configuration information of the message queue to be processed can be determined according to the type of the message, and the type of the message can be the product type to which the message belongs and / or the business scenario type to which the message belongs.
[0099] Regarding the implementation method of determining the average sending time of the message queue to be processed based on the flow control configuration information of the message queue to be processed, in some embodiments, the ratio of the number of messages in the message queue to be processed to the TPS of the message queue to be processed can be determined, and then the average sending time of the message queue to be processed is determined based on the above ratio.
[0100] The following is an example description of an application scenario. In this application scenario, the message queue to be processed is recorded as queue Q, which contains messages of type A, type B, and type C. Type A, type B, and type C are distinguished according to the product or business scenario to which the messages belong; the number of messages in type A, type B, and type C is X respectively. 1 , X 2 and X 3 , the TPS of queue Q is configured as N according to the type of messages in queue Q. Then the estimated sending time of the latest message sent in the queue to be processed can be calculated according to formula (1):
[0101] MaxCost=SUM(X n ) / T (1)
[0102] Where MaxCost represents the estimated sending time of the latest message in the queue to be processed, that is, the maximum sending time of the messages in the queue to be processed; SUM(X n ) indicates that X 1 , X 2 and X 3 A sum operation is performed, where T represents the TPS value of queue Q.
[0103] After obtaining the estimated sending time of the latest message sent in the message queue to be processed, the average sending time of the message queue to be processed can be calculated. The average sending time of the message queue to be processed is MaxCost*1 / 2.
[0104] Exemplarily, after the message queue is split, the flow control configuration information of each message queue after the split can be determined according to the number of messages in each message queue after the split and the preset sending time efficiency requirement. In this way, based on the flow control configuration information of each message queue after the split, it is conducive to making each message queue after the split meet the sending time efficiency requirement, that is, it is conducive to timely obtaining the message queue to be processed that meets the sending time efficiency requirement, thereby improving the sending efficiency of the message queue to be processed.
[0105] In one implementation, a sending time requirement can be preset to determine the maximum acceptable sending time for each type of message. Then, based on the number of messages in each message queue after splitting and the maximum acceptable sending time for each message in each message queue after splitting, the flow control configuration information of each message queue after splitting is obtained. For example, the flow control configuration information of each message queue after splitting is determined with the goal of ensuring that the actual sending time of each message in each message queue after splitting is less than the corresponding maximum acceptable sending time.
[0106] Exemplarily, after the message queue is split, the flow control configuration information of each message queue after the split can be determined according to the type of the message in each message queue after the split. In this way, based on the flow control configuration information of each message queue after the split, it is beneficial to make the sending of each message queue after the split conform to the objective situation of the message type, and it is beneficial to the classified loading and sending of various types of messages.
[0107] It can be seen that the embodiment of the present application can accurately determine the average sending time and the overall sending time of the message queue to be processed based on the flow control configuration information of the message queue to be processed, thereby facilitating accurate judgment of whether the message queue to be processed meets the preset sending time requirement, and further, facilitating accurate message sending in accordance with the sending time requirement.
[0108] In some embodiments, the above-mentioned splitting of the message queue according to a preset queue splitting strategy to obtain each message queue after the split may include: when the number of messages that do not need to be sent in priority in the message queue to be processed is greater than a first preset value, in the message queue to be processed, the messages that do not need to be sent in priority are split to obtain each message queue after the split; when the average sending time of the message queue to be processed is greater than the first preset time or the overall sending time of the message queue to be processed is greater than the second preset time, in the message queue to be processed, the messages with a priority higher than the preset priority are split to obtain each message queue after the split.
[0109] In an embodiment of the present application, if the number of messages that do not need to be sent as priority in the message queue to be processed is greater than a first preset value, it can be considered that there are a large number of time-insensitive messages. At this time, the messages that do not need to be sent as priority need to be split out from the original message queue to obtain a new message queue composed of messages that do not need to be sent as priority.
[0110] For example, the messages of type D in the to-be-processed message queue Q are messages that do not need to be sent in priority. D When it is greater than the first preset value, the message of type D can be split out from the message queue Q to be processed to form a new queue Q 1At this time, since the messages of type D in the pending message queue Q have been split out, the pending message queue Q becomes the new queue Q 2 .
[0111] In one implementation, after the processed message queue Q is split, the new queue Q 2 The minimum TPS that meets the delivery time requirement (i.e. the following T 1 ) can be determined according to formula (2):
[0112] SUM(X n -X D ) / T 1 *1 / 2 <T max (2)
[0113] Among them, SUM(X n -X D ) represents the new queue Q 2 The number of messages, T 1 Represents the new queue Q 2 The minimum TPS that meets the sending time requirement among the messages, T max Indicates the required sending time of queue Q before the processed message queue Q is split.
[0114] In determining the new queue Q 2 After the minimum TPS required for sending time is met in the message, the new queue Q can be determined 1 TPS of the new queue Q 1 The TPS can be recorded as T q , T q The TPS of queue Q before splitting the processed message queue Q minus T 1 The difference.
[0115] Through the above calculation process, the new queue Q to be processed can be determined 2 The minimum TPS that meets the sending time requirement, and the new queue Q split out 1 TPS.
[0116] In an embodiment of the present application, if the average sending time of the message queue to be processed is greater than the first preset time or the overall sending time of the message queue to be processed is greater than the second preset time, it can be considered that there is a risk of delay for high-priority messages. At this time, the high-priority messages need to be split out from the original message queue to obtain a new message queue composed of high-priority messages.
[0117] Exemplarily, the priority of the messages of business scenario A and business scenario B in the message queue Q to be processed is higher than the preset priority. When the average sending time of the message queue Q to be processed is greater than the first preset time, the messages of business scenario A and business scenario B can be split out of the message queue Q to be processed to form a new queue Q. a+b At this time, since the messages of business scenario A and business scenario B in the pending message queue Q have been split out, the pending message queue Q becomes the new queue Q. 3 .
[0118] In one implementation, the new queue Q a+b The minimum TPS that meets the delivery time requirement (i.e. the following T 2 ) can be determined according to formula (3):
[0119] SUM(Q a+b ) / T 2 *1 / 2 <T m (3)
[0120] Among them, SUM(Q a+b ) represents the new queue Q a+b The number of messages, T 2 Represents the new queue Q a+b TPS, T m Indicates the required sending time determined according to business scenario A and business scenario B.
[0121] In determining the new queue Q a+b After the TPS, the new queue Q can be determined 3 TPS of the new queue Q 3 The TPS of queue Q is: the TPS of queue Q before splitting minus T 2 The difference.
[0122] Through the above calculation process, the new queue Q can be determined a+b The minimum TPS that meets the sending time requirement, and the new queue Q to be processed 3 TPS.
[0123] In an embodiment of the present application, when the message queue to be processed does not meet the preset sending time requirement, the step of splitting the message queue to be processed can be repeated until each message queue after splitting meets the preset sending time requirement.
[0124] It can be seen that the embodiment of the present application can specifically process messages that do not need to be sent with priority, and specifically process messages with a priority higher than the pre-priority, thus facilitating the implementation of message sending according to objective actual needs.
[0125] In some embodiments, when the message queue to be processed meets the preset sending timeliness requirement, the implementation method of sending the message in the message queue to be processed may include:
[0126] When the message queue to be processed meets the preset sending timeliness requirement, the type of the message queue to be processed is determined according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set; the old queue set represents the set of message queues currently processed by each application instance, each application instance represents a service for processing message queues, and the new queue set represents the set of each message queue after splitting;
[0127] According to the type of the message queue to be processed, the message in the message queue to be processed is sent.
[0128] In an embodiment of the present application, each application instance can be implemented based on a process or a thread; in some embodiments, multiple application instances can be used to process message queues to achieve high availability of message processing. When multiple application instances are in normal working state, the status of each application instance and the processed message queue should be synchronized, and the message processing process executed by each application instance is the same.
[0129] In some embodiments, it can be determined whether the hash value of the message queue processed by each application instance is consistent with the hash value of the message queue in the new queue set. Here, the hash value of each message queue processed by each application instance and the message loading condition of each message queue processed by the application instance can be calculated as a whole to obtain the hash value of the message queue processed by each application instance; the hash value of each message queue in the new queue set and the message loading condition of each message queue in the new queue set can be calculated as a whole to obtain the hash value of the message queue in the new queue set.
[0130] Exemplarily, the message loading conditions may include at least one of the following: a product list bidList to which the messages in the message queue belong, a business scenario list bizTypeList to which the messages in the message queue belong, a product list exBidList that needs to be excluded from the message queue, and a business scenario list exBizTypeList that needs to be excluded from the message queue; when the message loading conditions include the list exBidList, the message list needs to exclude messages of products in the list exBidList; when the message loading conditions include the list exBizTypeList, the message list needs to exclude messages of business scenarios in the list exBizTypeListt.
[0131] Exemplarily, the flow control configuration information of the message queue can be determined according to the message loading condition; in this way, when the hash value of the message queue processed by each application instance is inconsistent with the hash value of the message queue in the new queue set, it can be considered that the message queue processed by each application instance is inconsistent with the message queue in the new queue set, or, the flow control configuration information of the message queue processed by each application instance is inconsistent with the message queue in the new queue set; at this time, if the message queue to be processed meets the preset sending time requirement, the status synchronization of each application instance can be performed, and one implementation method of the status synchronization of each application instance can be: determine the type of the message queue to be processed according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set; then, after each application instance performs status synchronization, each application instance performs message processing according to the type of the message queue to be processed.
[0132] When the hash value of the message queue processed by each application instance is consistent with the hash value of the message queue in the new queue set, it can be considered that the states of each application instance have been synchronized.
[0133] It can be seen that the embodiment of the present application can accurately determine the type of the message queue to be processed based on the relationship between the message queue to be processed and the old queue set, as well as the relationship between the message queue to be processed and the new queue set. This is beneficial for accurately sending messages in the message queue to be processed according to the type of the message queue to be processed.
[0134] In some embodiments, according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set, the implementation method of determining the type of the message queue to be processed may include:
[0135] When the message queue to be processed is in the old queue set and the message queue to be processed is not in the new queue set, determining that the message queue to be processed is a message queue that needs to stop sending;
[0136] When the message queue to be processed is in the old queue set and the message queue to be processed is in the new queue set, determining that the message queue to be processed is a message queue that needs to update flow control configuration information;
[0137] When the message queue to be processed is not in the old queue set and the message queue to be processed is in the new queue set, it is determined that the message queue to be processed is a newly added queue.
[0138] It can be seen that the embodiment of the present application can accurately determine whether the message queue to be processed is a message queue that needs to stop sending, a message queue that needs to update the flow control configuration information, or a newly added queue based on the relationship between the message queue to be processed and the old queue set, as well as the relationship between the message queue to be processed and the new queue set. This is beneficial for subsequent targeted processing of the message queue according to the type of the message queue to be processed.
[0139] In some embodiments, the implementation of sending the message in the message queue to be processed according to the type of the message queue to be processed may include:
[0140] When the message queue to be processed is a message queue that needs to stop sending, in each application instance, the processing process of the message queue to be processed is stopped.
[0141] When the message queue to be processed is a message queue for which flow control configuration information needs to be updated, in each application instance, the flow control configuration information of the message queue to be processed is updated;
[0142] When the message queue to be processed is a newly added queue, a processing process for the message queue to be processed is started in each application instance.
[0143] In an embodiment of the present application, when the message queue to be processed is a message queue that needs to stop sending, it means that the messages of the message queue to be processed are in the message queue of the new queue set. At this time, in each application instance, the loading of the message queue to be processed can be stopped; exemplarily, after each application instance stops the processing process of the message queue to be processed, the message queue to be processed can be recorded as a loaded message queue by using a temporary thread, and then the temporary thread can be closed.
[0144] In some embodiments, when the message queue to be processed is a newly added queue, a new loading and sending thread of the message queue to be processed can be created in each application instance, thereby starting the processing process of the message queue to be processed.
[0145] In some embodiments, when the message queue to be processed is a message queue that needs to stop sending, the message queue to be processed can be recorded as an old queue; in each application instance, it is necessary to stop the processing process of the old queue first, and then start the processing process of the newly added queue and update the flow control configuration information for the message queue that needs to update the flow control configuration information; here, the order of starting the processing process of the newly added queue and updating the flow control configuration information is not limited.
[0146] In the embodiment of the present application, the data switching principle involved in the application instance is: first stop the data loading of the old queue, then update the data loading of the newly added queue and update the flow control configuration information.
[0147] It can be seen that the embodiment of the present application can perform subsequent targeted processing on the message queue according to the type of the message queue to be processed.
[0148] In some embodiments, in each application instance, updating the flow control configuration information of the message queue to be processed may include: when the states of each application instance are synchronized, in each application instance, updating the flow control configuration information of the message queue to be processed;
[0149] Accordingly, the above-mentioned starting the processing process of the message queue to be processed in each application instance may include: when the states of each application instance are synchronized, starting the processing process of the message queue to be processed in each application instance.
[0150] Exemplarily, an instance status table may be set up to record the heartbeat time of each application instance, the hash value of the message queue processed by each application instance, and the queue information of each application instance, so as to achieve synchronization of each application instance according to the information recorded in the instance status table.
[0151] Exemplarily, when each application instance is started, the heartbeat time of each application instance and the hash value of the message queue processed by each application instance may be updated.
[0152] Exemplarily, when the states of the various application instances are not synchronized, in each application instance, the flow control configuration information of the message queue to be processed may not be updated, and the processing process of the message queue to be processed may not be started.
[0153] It can be seen that the embodiment of the present application can update the flow control configuration information or start the processing process of the message queue to be processed when the status of each application instance is synchronized, so that each application instance can perform message processing synchronously.
[0154] Furthermore, the embodiment of the present application can achieve state synchronization of each application instance by adding an instance state table to record the heartbeat time of the application instance, the hash value of the message queue processed by the application instance, and the queue information of the application instance; if the states of multiple application instances are inconsistent, the message loading conditions of different message queues of different application instances may partially overlap, resulting in repeated loading of some data. The repeatedly loaded data will occupy the message queue space, causing resource waste and affecting the message processing efficiency; in the embodiment of the present application, after determining that the state of each application instance is synchronized, the processing process of the newly added queue is started and the flow control configuration information is updated, which is conducive to making the data switching of the new queue set and the old queue set consistent between each application instance, so that the same message will not be processed repeatedly in the entire message processing process; on the contrary,
[0155] In some embodiments, application instances with abnormal status may be eliminated from various application instances, where the interval between the heartbeat time of the application instances with abnormal status and the current time is greater than a preset time interval.
[0156] Exemplarily, the preset time interval can be set empirically; each application instance can update the heartbeat time regularly according to the preset plan. If the interval between the heartbeat time of the application instance and the current time is greater than the preset time interval, it means that the status of the application instance is abnormal. At this time, the application instance can be eliminated and other application instances can be used to process the message queue.
[0157] It can be seen that the embodiment of the present application can eliminate application instances that have not updated data for a long time by eliminating application instances with abnormal status, which is beneficial to saving resources and improving the accuracy and reliability of message queue processing.
[0158] In some embodiments, when the identifier of the message in the to-be-processed message queue is consistent with the identifier of the sent message, sending of the message in the to-be-processed message queue may be stopped.
[0159] In the embodiment of the present application, the identifier of the message can be the identity document (ID) of the message, and the identifier of the message is unique. For example, the ID of the message is generated when the message is created and is unique in the overall message processing process. In some embodiments, a new record table can be added to record the identifier of each message, so as to realize the bottom-up control of preventing duplicate sending by utilizing the uniqueness of the identifier of the message.
[0160] In actual application scenarios, the following extreme situations may occur: during the heartbeat check, some application instances have low performance or other abnormal freezes, resulting in untimely heartbeat updates. However, the application instance is still running, and the application instance and other application instances may repeatedly load some data. In this case, the message identifier can be relied upon to perform a bottom-up control to prevent duplicate sending.
[0161] It can be seen that the embodiments of the present application can achieve a comprehensive control to prevent duplicate sending through the uniqueness of the message identifier; in addition, if the synchronization of the status of each application instance is not checked, but the message sending is directly controlled based on the uniqueness of the message identifier, data may be loaded repeatedly and then anti-duplicate interception may be triggered, which will generate an anti-duplicate interception alarm.
[0162] In some embodiments, when the time interval from the last message sending exceeds a third preset time length, the message in the to-be-processed message queue may be sent using a preset message sending method.
[0163] In the embodiment of the present application, the third preset duration can be set according to actual needs. The preset message sending method is exemplarily described below. When the time interval from the last message sending exceeds the third preset duration, the messages in the message queue to be processed can be re-determined according to the default mapping relationship between message type and priority to determine the message sending method.
[0164] It can be seen that when the time interval from the last message sending exceeds the third preset time length, it can be considered that the application instance has not processed messages for a long time, which may lead to missed messages. In an embodiment of the present application, the messages in the message queue to be processed are sent through the preset message sending method, which is conducive to preventing missed messages.
[0165] The following is an exemplary description of the message processing method with reference to the accompanying drawings. Figure 2 Another flow chart of the message processing method of the embodiment of the present application is as follows: Figure 2 As shown, the process may include:
[0166] After receiving the message request, the message processing can be performed, so as to update the message counter in the cache; the business parameter configuration information (for example, it may include flow control configuration information, message loading conditions and other information) can be determined based on the message processing result; then the message delay analysis can be performed in combination with the message counter and the business parameter configuration information, and the message delay analysis here includes the above-mentioned process of determining whether the message queue to be processed meets the preset sending time requirement; based on the result of the message delay analysis, the message queue can be split, and after the message queue is split, the message queue and the configuration information of the message queue (for example, it may be flow control configuration information) can be updated, and the updating of the message queue here includes stopping the processing of the old queue and starting the processing of the newly added queue.
[0167] The queue management module can read the configuration information and instance status table of the message queue, and then according to the contents recorded in the aforementioned embodiments, after each application instance is synchronized, start the loading thread and the sending thread; the loading thread is used to read cache data from the cache, and the cache data includes messages that need to be sent. The loading thread can load the messages according to the message queue; the sending thread can take out messages from the message queue in sequence and send them.
[0168] Based on the message processing method proposed in the above embodiment, the embodiment of the present application also proposes a message processing device; Figure 3 This is a schematic diagram of an optional structure of a message processing device according to an embodiment of the present application, such as Figure 3 As shown, the message processing device 300 may include:
[0169] An acquisition module 301 is used to acquire a message queue to be processed;
[0170] The processing module 302 is used to split the message queue according to the preset queue splitting strategy to obtain each message queue after splitting when the message queue to be processed does not meet the preset sending time requirement, and determine each message queue after splitting as the message queue to be processed; when the message queue to be processed meets the preset sending time requirement, send the messages in the message queue to be processed.
[0171] In some embodiments, the processing module 302 is further configured to:
[0172] When the average sending time length of the message queue to be processed is greater than the first preset time length, or the overall sending time length of the message queue to be processed is greater than the second preset time length, or the number of messages in the message queue to be processed that do not need to be sent in priority is greater than the first preset value, it is determined that the message queue to be processed does not meet the preset sending time requirement;
[0173] When the average sending duration of the message queue to be processed is less than or equal to the first preset duration, and the overall sending duration of the message queue to be processed is less than or equal to the second preset duration, and the number of messages that do not need to be sent in priority in the message queue to be processed is less than or equal to the first preset value, it is determined that the message queue to be processed meets the preset sending timeliness requirement.
[0174] In some embodiments, the processing module 302 is further configured to:
[0175] After splitting the message queue, determining flow control configuration information of each message queue after the split;
[0176] According to the flow control configuration information of the message queue to be processed, the average sending duration of the message queue to be processed is determined; according to the average sending duration of the message queue to be processed, the overall sending duration of the message queue to be processed is determined.
[0177] In some embodiments, the processing module 302 is used to determine the flow control configuration information of each message queue after splitting, including:
[0178] The flow control configuration information of each message queue after the splitting is determined according to the number of messages in each message queue after the splitting and the preset sending timeliness requirement.
[0179] In some embodiments, the processing module 302 is used to determine the flow control configuration information of each message queue after splitting, including:
[0180] According to the type of messages in each message queue after the splitting, flow control configuration information of each message queue after the splitting is determined.
[0181] In some embodiments, the processing module 302 is used to split the message queue according to a preset queue splitting strategy to obtain each message queue after splitting, including:
[0182] When the average sending time of the message queue to be processed is greater than the first preset time or the overall sending time of the message queue to be processed is greater than the second preset time, in the message queue to be processed, the messages having a priority higher than the pre-priority are split to obtain each message queue after the split;
[0183] When the number of messages that do not need to be sent with priority in the message queue to be processed is greater than a first preset value, the messages that do not need to be sent with priority in the message queue to be processed are split to obtain each message queue after the splitting.
[0184] In some embodiments, the processing module 302 is used to send the message in the message queue to be processed when the message queue to be processed meets the preset sending time requirement, including:
[0185] When the message queue to be processed meets the preset sending timeliness requirement, the type of the message queue to be processed is determined according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set; the old queue set represents the set of message queues currently processed by each application instance, each application instance represents a service for processing message queues, and the new queue set represents the set of each message queue after splitting;
[0186] According to the type of the message queue to be processed, the messages in the message queue to be processed are sent.
[0187] In some embodiments, the processing module 302 is used to determine the type of the message queue to be processed according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set, including:
[0188] When the message queue to be processed is in the old queue set and the message queue to be processed is not in the new queue set, determining that the message queue to be processed is a message queue that needs to stop sending;
[0189] When the message queue to be processed is in the old queue set and the message queue to be processed is in the new queue set, determining that the message queue to be processed is a message queue that needs to update flow control configuration information;
[0190] When the message queue to be processed is not in the old queue set and the message queue to be processed is in the new queue set, it is determined that the message queue to be processed is a newly added queue.
[0191] In some embodiments, the processing module 302 is used to send the message in the message queue to be processed according to the type of the message queue to be processed, including:
[0192] When the message queue to be processed is a message queue that needs to stop sending, in each application instance, stopping the processing process of the message queue to be processed;
[0193] When the message queue to be processed is a message queue for which flow control configuration information needs to be updated, in each application instance, the flow control configuration information of the message queue to be processed is updated;
[0194] When the message queue to be processed is a newly added queue, in each application instance, a processing process for the message queue to be processed is started.
[0195] In some embodiments, the processing module 302 is used to update the flow control configuration information of the message queue to be processed in each application instance, including:
[0196] When the states of the various application instances are synchronized, in each of the application instances, the flow control configuration information of the message queue to be processed is updated;
[0197] The processing module 302 is used to start the processing process of the message queue to be processed in each application instance, including:
[0198] When the states of the various application instances are synchronized, the processing process of the to-be-processed message queue is started in each of the application instances.
[0199] In some embodiments, the processing module 302 is further configured to:
[0200] In each application instance, an application instance with an abnormal status is eliminated, wherein the interval between the heartbeat time of the application instance with the abnormal status and the current time is greater than the preset time interval.
[0201] In some embodiments, the processing module 302 is further configured to:
[0202] When the identifier of the message in the to-be-processed message queue is consistent with the identifier of the sent message, the sending of the message in the to-be-processed message queue is stopped.
[0203] In some embodiments, the processing module 302 is further configured to:
[0204] When the time interval from the last message sending exceeds the third preset time length, the messages in the to-be-processed message queue are sent using a preset message sending method.
[0205] In practical applications, both the acquisition module 301 and the processing module 302 can be implemented using a processor of an electronic device, and the processor can be at least one of an ASIC, a DSP, a DSPD, a PLD, an FPGA, a CPU, a controller, a microcontroller, and a microprocessor. It can be understood that the electronic device that implements the function of the processor can also be other, and the embodiment of the present application is not limited thereto.
[0206] It should be noted that the description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0207] It should be noted that in the embodiments of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a computer device (which can be a terminal, a server, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0208] Correspondingly, an embodiment of the present application further provides a computer program product, which includes computer executable instructions, and the computer executable instructions are used to implement any message processing method provided in the embodiment of the present application.
[0209] Correspondingly, an embodiment of the present application further provides a computer storage medium, on which computer executable instructions are stored, and the computer executable instructions are used to implement any one of the message processing methods provided in the above embodiments.
[0210] The present application also provides an electronic device, Figure 4 A schematic diagram of an optional structure of an electronic device provided in an embodiment of the present application, such as Figure 4 As shown, the electronic device 40 includes:
[0211] Memory 401, used to store executable instructions;
[0212] The processor 402 is used to implement any one of the above-mentioned message processing methods when executing the executable instructions stored in the memory 401.
[0213] The processor 402 may be at least one of an ASIC, a DSP, a DSPD, a PLD, a FPGA, a CPU, a controller, a microcontroller, and a microprocessor.
[0214] The above-mentioned computer-readable storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and the like; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0215] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0216] It should be understood that the "some embodiments" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiments are included in at least one embodiment of the present application. Therefore, the "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0217] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0218] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0219] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
[0220] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0221] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for the automatic test line of the device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks or optical disks.
[0222] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0223] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0224] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A message processing method, characterized in that: The method comprises: Get the queue of messages to be processed; When the message queue to be processed does not meet the preset sending time requirement, the message queue is split according to the preset queue splitting strategy to obtain each message queue after the split, and each message queue after the split is determined as the message queue to be processed; the queue splitting strategy is related to the sending time requirement, specifically: after the message queue to be processed is split for the first time according to the preset queue splitting strategy, each message queue after the split may not meet the preset time sending requirement, and when any one of the message queues after the split does not meet the preset time sending requirement, any one of the above message queues after the split is split again until each message queue after the split meets the preset time sending requirement; When the message queue to be processed meets the preset sending timeliness requirement, sending the message in the message queue to be processed; Wherein, the method further comprises: When the average sending time length of the message queue to be processed is greater than the first preset time length, or the overall sending time length of the message queue to be processed is greater than the second preset time length, or the number of messages in the message queue to be processed that do not need to be sent in priority is greater than the first preset value, it is determined that the message queue to be processed does not meet the preset sending time requirement; When the average sending duration of the message queue to be processed is less than or equal to the first preset duration, and the overall sending duration of the message queue to be processed is less than or equal to the second preset duration, and the number of messages that do not need to be sent in priority in the message queue to be processed is less than or equal to the first preset value, it is determined that the message queue to be processed meets the preset sending timeliness requirement.
2. The method according to claim 1, characterized in that The method further comprises: After splitting the message queue, determining flow control configuration information of each message queue after the split; According to the flow control configuration information of the message queue to be processed, the average sending duration of the message queue to be processed is determined; according to the average sending duration of the message queue to be processed, the overall sending duration of the message queue to be processed is determined.
3. The method according to claim 2, characterized in that The determining of the flow control configuration information of each message queue after the splitting includes: The flow control configuration information of each message queue after the splitting is determined according to the number of messages in each message queue after the splitting and the preset sending timeliness requirement.
4. The method according to claim 2, characterized in that: The determining of the flow control configuration information of each message queue after the splitting includes: According to the type of messages in each message queue after the splitting, flow control configuration information of each message queue after the splitting is determined.
5. The method according to any one of claims 1 to 4, characterized in that: The message queue is split according to the preset queue splitting strategy to obtain each message queue after splitting, including: When the average sending time of the message queue to be processed is greater than the first preset time or the overall sending time of the message queue to be processed is greater than the second preset time, in the message queue to be processed, the messages having a priority higher than the pre-priority are split to obtain each message queue after the split; When the number of messages that do not need to be sent with priority in the message queue to be processed is greater than a first preset value, the messages that do not need to be sent with priority in the message queue to be processed are split to obtain each message queue after the splitting.
6. The method according to any one of claims 1 to 4, characterized in that: When the message queue to be processed meets the preset sending timeliness requirement, sending the message in the message queue to be processed includes: When the message queue to be processed meets the preset sending timeliness requirement, the type of the message queue to be processed is determined according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set; the old queue set represents the set of message queues currently processed by each application instance, each application instance represents a service for processing message queues, and the new queue set represents the set of each message queue after splitting; According to the type of the message queue to be processed, the messages in the message queue to be processed are sent.
7. The method according to claim 6, characterized in that Determining the type of the message queue to be processed according to the relationship between the message queue to be processed and the old queue set, and the relationship between the message queue to be processed and the new queue set, includes: When the message queue to be processed is in the old queue set and the message queue to be processed is not in the new queue set, determining that the message queue to be processed is a message queue that needs to stop sending; When the message queue to be processed is in the old queue set and the message queue to be processed is in the new queue set, determining that the message queue to be processed is a message queue that needs to update flow control configuration information; When the message queue to be processed is not in the old queue set and the message queue to be processed is in the new queue set, it is determined that the message queue to be processed is a newly added queue.
8. The method according to claim 7, characterized in that The sending of the message in the message queue to be processed according to the type of the message queue to be processed includes: When the message queue to be processed is a message queue that needs to stop sending, in each application instance, stopping the processing process of the message queue to be processed; When the message queue to be processed is a message queue for which flow control configuration information needs to be updated, in each application instance, the flow control configuration information of the message queue to be processed is updated; When the message queue to be processed is a newly added queue, in each application instance, a processing process for the message queue to be processed is started.
9. The method according to claim 8, characterized in that In each of the application instances, updating the flow control configuration information of the message queue to be processed includes: When the states of the various application instances are synchronized, in each of the application instances, the flow control configuration information of the message queue to be processed is updated; In each of the application instances, starting a process for processing the message queue to be processed includes: When the states of the various application instances are synchronized, the processing process of the to-be-processed message queue is started in each of the application instances.
10. The method according to claim 6, characterized in that The method further comprises: In each application instance, an application instance with an abnormal status is eliminated, wherein the interval between the heartbeat time of the application instance with the abnormal status and the current time is greater than the preset time interval.
11. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: When the identifier of the message in the to-be-processed message queue is consistent with the identifier of the sent message, the sending of the message in the to-be-processed message queue is stopped.
12. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: When the time interval from the last message sending exceeds the third preset time length, the messages in the to-be-processed message queue are sent using a preset message sending method.
13. A message processing device, characterized in that: The device comprises: The acquisition module is used to obtain the message queue to be processed; The first processing module is used to split the message queue according to the preset queue splitting strategy when the message queue to be processed does not meet the preset sending time requirement, to obtain each message queue after splitting, and determine each message queue after splitting as the message queue to be processed; the queue splitting strategy is related to the sending time requirement, specifically: after the message queue to be processed is split for the first time according to the preset queue splitting strategy, each message queue after splitting may not meet the preset time sending requirement, when any message queue after splitting does not meet the preset time sending requirement, any of the above message queues after splitting are split again until each message queue after splitting meets the preset time sending requirement; A second processing module, configured to send the message in the message queue to be processed when the message queue to be processed meets a preset sending timeliness requirement; The device is also specifically used for: When the average sending time length of the message queue to be processed is greater than the first preset time length, or the overall sending time length of the message queue to be processed is greater than the second preset time length, or the number of messages in the message queue to be processed that do not need to be sent in priority is greater than the first preset value, it is determined that the message queue to be processed does not meet the preset sending time requirement; When the average sending duration of the message queue to be processed is less than or equal to the first preset duration, and the overall sending duration of the message queue to be processed is less than or equal to the second preset duration, and the number of messages that do not need to be sent in priority in the message queue to be processed is less than or equal to the first preset value, it is determined that the message queue to be processed meets the preset sending timeliness requirement.
14. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable instructions; A processor, configured to implement the method according to any one of claims 1 to 12 when executing the executable instructions stored in the memory.
15. A computer-readable storage medium, characterized in that: Executable instructions are stored, and when executed by a processor, the method described in any one of claims 1 to 12 is implemented.
