Task message processing methods, devices, electronic equipment and media
By storing task messages and their priority parameters in a relational database and filling the blocking queue with priority filtering conditions, the problem of insufficient flexibility in the scheduling mechanism in the existing technology is solved, and more flexible priority scheduling and improved resource utilization are achieved.
Patent Information
- Application Number
- CN202510638176.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2026-11-17
AI Technical Summary
The existing message priority scheduling mechanism is inflexible and difficult to adapt to the needs of different scenarios, resulting in overload of processing threads or idle resources, and is prone to avalanche when task messages suddenly appear.
The system uses a relational database to store task messages and their priority parameters, and retrieves task messages from the database using priority filtering conditions to fill the blocking queue for processing, allowing for flexible adjustment of priority scheduling strategies.
It improves the flexibility of priority scheduling, reduces processing thread overload and resource waste, and ensures stability and resource utilization when task messages are in short supply.
Smart Images

Figure CN123115279A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data communication, and in particular to a task message processing method, apparatus, electronic device, and medium. Background Technology
[0002] Message priority scheduling is a core requirement in distributed systems and data communication. Its goal is to rationally allocate transmission resources based on the priority parameters of task messages, and prioritize the transmission and processing of high-priority task messages.
[0003] Several message priority scheduling mechanisms exist in related technologies. For example, strict priority queues always prioritize high-priority task messages over low-priority task messages. The problem with this is its lack of flexibility; some low-priority task messages remain unprocessed for extended periods. Weighted round-robin assigns quotas to both high-priority and low-priority task messages. Low-priority task messages receive significantly less quota than high-priority task messages. During scheduling, a certain number of high-priority task messages are selected for transmission and processing based on their quotas, and then a certain number of low-priority task messages are selected for transmission and processing based on their quotas, continuously rounding. However, these quotas are relatively fixed and lack flexibility. In reality, different priority scheduling strategies may be used for different scenarios and may need to be adjusted in real time. Existing message priority scheduling mechanisms lack flexibility and are difficult to adapt to these scenarios. Moreover, existing message priority scheduling mechanisms are prone to overloading processing threads and causing a cascading failure when faced with a surge in task messages, while resource idleness is significant when the number of task messages is small. Summary of the Invention
[0004] This disclosure provides a task message processing method, apparatus, electronic device, and medium that can improve the flexibility of priority scheduling, reduce overload when task messages are in burst, and reduce resource waste.
[0005] To solve the above-mentioned technical problems, this application provides the following technical solution:
[0006] According to one aspect of this application, a task message processing method is provided, comprising:
[0007] In response to receiving a task message, obtain multiple priority parameters of the task message;
[0008] The task messages are stored in a relational database in correspondence with the multiple priority parameters;
[0009] Get priority filtering conditions;
[0010] In response to the blocking queue not being full, the task message that satisfies the priority filtering condition among the multiple priority parameters is queried from the relational database;
[0011] The blocked queue is filled with the retrieved task messages until the blocked queue is full.
[0012] The task message is retrieved from the blocking queue and processed.
[0013] In the above scheme, the step of responding to the blocking queue not being full by querying the relational database for task messages whose multiple priority parameters satisfy the priority filtering conditions includes:
[0014] In response to the fact that the blocking queue is not full, the number of task messages that the blocking queue can still hold is determined as a first number;
[0015] The task messages in the relational database are sorted according to the priority parameter usage rules;
[0016] Among the multiple task messages whose priority parameters satisfy the priority filtering conditions, the first number of task messages in the sorted order are selected as the queried task messages.
[0017] In the above scheme, the multiple priority parameters include task message type and task message score;
[0018] The step of sorting the task messages in the relational database according to the priority parameter usage rules includes:
[0019] Sort the task messages in the relational database according to the task message type;
[0020] For task messages of the same task message type, they are sorted according to their task message scores.
[0021] In the above scheme, the task message comes from the task message queue;
[0022] The task message score is determined in the following way:
[0023] Input the multiple preceding task messages before the task message in the task message queue, the task message, and the multiple subsequent task messages after the task message in the task message queue into the attention model to obtain the attention score of the task message;
[0024] From the multiple preceding task messages, identify multiple unprocessed task messages;
[0025] Using the remaining time prediction model, predict the remaining processing time for each of the unprocessed task messages;
[0026] The task message score is determined based on the attention score and the remaining processing time corresponding to each of the unprocessed task messages.
[0027] In the above scheme, determining the task message score based on the attention score and the remaining processing time corresponding to each of the unprocessed task messages includes:
[0028] For each of the unprocessed task messages, a correlation prediction model is used to predict the first correlation between the unprocessed task message and the task message;
[0029] Based on the first correlation, the remaining processing time corresponding to each of the unprocessed task messages is weighted and summed to obtain a time-weighted sum.
[0030] The task message score is determined based on the attention score and the duration-weighted sum.
[0031] In the above scheme, determining the task message score based on the attention score and the duration-weighted sum includes:
[0032] Based on the attention score, a first sub-score is calculated, where the first sub-score is an increasing function of the attention score;
[0033] Based on the duration-weighted sum, a second sub-score is calculated, which is a decreasing function of the duration-weighted sum;
[0034] The task message score is calculated based on the first sub-score and the second sub-score.
[0035] In the above scheme, determining the task message score based on the attention score and the remaining processing time corresponding to each of the unprocessed task messages includes:
[0036] Using a correlation prediction model, predict the second correlation between each subsequent task message and the task message;
[0037] Calculate the average correlation degree based on the second correlation degree between each subsequent task message and the task message;
[0038] The task message score is determined based on the attention score, the remaining processing time corresponding to each of the unprocessed task messages, and the average correlation.
[0039] According to one aspect of this application, a task message processing apparatus is provided, comprising:
[0040] The parameter acquisition module, in response to receiving a task message, is used to acquire multiple priority parameters of the task message;
[0041] A message storage module is used to store the task messages and the plurality of priority parameters in a relational database.
[0042] The condition acquisition module is used to obtain priority filtering conditions;
[0043] The message query module, in response to the blocking queue not being full, is used to query the relational database for task messages whose multiple priority parameters satisfy the priority filtering conditions;
[0044] The queue filling module is used to fill the blocking queue with the retrieved task messages until the blocking queue is full.
[0045] The message processing module is used to retrieve the task message from the blocking queue for processing.
[0046] In the above scheme, the priority filtering condition is based on the total score of the multiple priority parameters satisfying a predetermined condition. The message query module is further used for:
[0047] In response to the blocking queue not being full, for each task message in the relational database, determine the parameter score corresponding to each of the plurality of priority parameters of the task message;
[0048] The total score of the task message is calculated based on the parameter scores corresponding to each of the multiple priority parameters.
[0049] From the relational database, query the task message whose total score meets the predetermined condition.
[0050] In the above scheme, the message query module is further used for:
[0051] In response to the fact that the blocking queue is not full, the number of task messages that the blocking queue can still hold is determined as a first number;
[0052] The task messages in the relational database are sorted according to the priority parameter usage rules;
[0053] Among the multiple task messages whose priority parameters satisfy the priority filtering conditions, the first number of task messages in the sorted order are selected as the queried task messages.
[0054] In the above scheme, the multiple priority parameters include task message type and task message score; the message query module is also used for:
[0055] Sort the task messages in the relational database according to the task message type;
[0056] For task messages of the same task message type, they are sorted according to their task message scores.
[0057] In the above scheme, the task message comes from a task message queue; the task message processing device further includes: a score determination unit, used to determine the score of the task message in the following manner:
[0058] Input the multiple preceding task messages before the task message in the task message queue, the task message, and the multiple subsequent task messages after the task message in the task message queue into the attention model to obtain the attention score of the task message;
[0059] From the multiple preceding task messages, identify multiple unprocessed task messages;
[0060] Using the remaining time prediction model, predict the remaining processing time for each of the unprocessed task messages;
[0061] The task message score is determined based on the attention score and the remaining processing time corresponding to each of the unprocessed task messages.
[0062] In the above scheme, the score determination unit is further configured to:
[0063] For each of the unprocessed task messages, a correlation prediction model is used to predict the first correlation between the unprocessed task message and the task message;
[0064] Based on the first correlation, the remaining processing time corresponding to each of the unprocessed task messages is weighted and summed to obtain a time-weighted sum.
[0065] The task message score is determined based on the attention score and the duration-weighted sum.
[0066] In the above scheme, the score determination unit is further configured to:
[0067] Based on the attention score, a first sub-score is calculated, where the first sub-score is an increasing function of the attention score;
[0068] Based on the duration-weighted sum, a second sub-score is calculated, which is a decreasing function of the duration-weighted sum;
[0069] The task message score is calculated based on the first sub-score and the second sub-score.
[0070] In the above scheme, the score determination unit is further configured to:
[0071] Using a correlation prediction model, predict the second correlation between each subsequent task message and the task message;
[0072] Calculate the average correlation degree based on the second correlation degree between each subsequent task message and the task message;
[0073] The task message score is determined based on the attention score, the remaining processing time corresponding to each of the unprocessed task messages, and the average correlation.
[0074] In the above scheme, the task message type includes user-triggered type and offline-triggered type;
[0075] The task message processing device further includes a type acquisition module, used to acquire the task message type through the following process:
[0076] If the task message is generated by the user in response to a task trigger control, then the task message type is determined to be the user-triggered type.
[0077] If the task message is generated offline by the task message processing platform through the platform program, the task message type is determined to be the offline trigger type.
[0078] In the above scheme, the type acquisition module is further used for:
[0079] In response to triggering the task control, if the triggering of the task control is the first triggering by the user, the task message is generated, and the task message type is determined to be the user trigger type;
[0080] If the triggering of the task control is not the first time the user has triggered it, the task message is not generated.
[0081] In the above scheme, the type acquisition module is further used for:
[0082] Identify the user group to which the user belongs;
[0083] Disable other users in the user group from triggering the task control.
[0084] In the above scheme, the message query module is further used for:
[0085] The task messages are periodically bucketed according to their position in the sorting.
[0086] For each task message, if the task messages are all in the same bucket for a predetermined number of consecutive periods, and the position index of the bucket in the multiple buckets satisfies a predetermined position condition, the task messages are sorted and moved forward.
[0087] In the above scheme, the message query module is further used for:
[0088] The displacement is determined based on the position index of the bucket in the multiple buckets, and the displacement is an increasing function of the position index;
[0089] Based on the displacement, the task messages are sorted and moved forward.
[0090] In the above scheme, the message query module is further used for:
[0091] In response to the blocking queue being less than full again, the number of task messages that the blocking queue can still hold is determined as a second number;
[0092] Among the multiple task messages whose priority parameters satisfy the priority filtering conditions, the second number of task messages following the first number of task messages are selected as the queried task messages.
[0093] In the above scheme, the task message processing device further includes: a status setting module, used to set the status value of the task message in the relational database to a first value.
[0094] In the above scheme, the message query module is further used for:
[0095] In response to the blocking queue not being full, the task message with the status value of the first value is filtered out from the relational database;
[0096] From the filtered task messages, query the task messages whose multiple priority parameters satisfy the priority filtering conditions.
[0097] In the above scheme, the status setting module is further used for:
[0098] In the relational database, the status value of the retrieved task message is modified from the first value to the second value.
[0099] In the above scheme, the status setting module is further used for:
[0100] In the relational database, the status value of the retrieved task message is modified from the second value to the third value.
[0101] According to one aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program adapted for loading by a processor to perform the above-described task message processing method.
[0102] According to one aspect of this application, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described task message processing method.
[0103] According to one aspect of this application, a computer program product is provided, the computer program product comprising a computer program stored in a storage medium. A processor of a computer device reads the computer program from the storage medium, and the processor executes the computer program to implement the above-described task message processing method.
[0104] This disclosure cleverly utilizes a relational database and a blocking queue. Task messages are not directly queued in a cache; instead, they are stored in the relational database along with multiple priority parameters. Different priority filtering conditions can be set for different application scenarios. Thus, regardless of the application scenario, task messages that meet the priority filtering conditions can be retrieved from the relational database and added to the blocking queue. When processing task messages, each processing thread retrieves them from the blocking queue, not directly from the relational database. This allows the process of transferring task messages from the relational database to the blocking queue to implement application-specific priority scheduling requirements, improving the flexibility of priority scheduling. Compared to related technologies that sort messages according to a single fixed priority parameter or poll task messages of several priorities in a fixed manner, priority filtering conditions can be flexibly set according to the application scenario and can be matched with multiple priority parameters, greatly improving scheduling flexibility. In the face of a sudden surge in task messages, the buffer provided by the relational database prevents overload of processing threads. When the number of task messages is small, the processing thread can retrieve previously accumulated task messages from the blocking queue for processing, thereby improving resource utilization.
[0105] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objectives and other advantages of this disclosure may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0106] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.
[0107] Figure 1 This is a schematic diagram of the architecture of the task message processing device provided in the embodiments of this application;
[0108] Figures 2A-2G This is a schematic diagram of a scenario for the task message processing method provided in an embodiment of this application;
[0109] Figures 3A-3C This is another scenario illustration of the task message processing method provided in the embodiments of this application;
[0110] Figure 4 This is a flowchart illustrating a task message processing method provided in an embodiment of this application;
[0111] Figure 5 yes Figure 4 A detailed flowchart of step 440;
[0112] Figure 6 yes Figure 4 Another specific flowchart for step 440;
[0113] Figure 7 yes Figure 6 A detailed flowchart of step 620;
[0114] Figure 8 This is another flowchart illustrating the task message processing method provided in the embodiments of this application;
[0115] Figure 9 yes Figure 8 A detailed flowchart of step 840;
[0116] Figure 10 yes Figure 9 A detailed flowchart of step 930;
[0117] Figure 11 yes Figure 8 Another specific flowchart for step 840;
[0118] Figure 12 This is another flowchart illustrating the task message processing method provided in the embodiments of this application;
[0119] Figure 13 yes Figure 12 A detailed flowchart of step 1210;
[0120] Figure 14 yes Figure 13A detailed flowchart of step 1310;
[0121] Figure 15 This is another flowchart illustrating the task message processing method provided in the embodiments of this application;
[0122] Figure 16 yes Figure 15 A specific flowchart of step 622;
[0123] Figure 17 This is another flowchart illustrating the task message processing method provided in the embodiments of this application;
[0124] Figure 18 This is another flowchart illustrating the task message processing method provided in the embodiments of this application;
[0125] Figure 19 This is another flowchart illustrating the task message processing method provided in the embodiments of this application;
[0126] Figure 20 This is another flowchart illustrating the task message processing method provided in the embodiments of this application;
[0127] Figure 21 This is a schematic diagram of the overall flow of the task message processing method provided in the embodiments of this application;
[0128] Figure 22 This is another schematic diagram illustrating the overall flow of the task message processing method provided in the embodiments of this application;
[0129] Figures 23A-23B A flowchart illustrating a specific implementation of a task message processing method according to an embodiment of the present disclosure is shown.
[0130] Figure 24 This is a schematic diagram of the structure of a task message processing device provided in an embodiment of this application;
[0131] Figure 25 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;
[0132] Figure 26 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0133] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0134] It should be noted that while some processes described in the specification, claims, and accompanying drawings include multiple steps appearing in a specific order, it should be clearly understood that these steps may not be performed in the order they appear herein, or may be performed in parallel. The step numbers are merely used to distinguish different steps and do not themselves represent any execution order. Furthermore, descriptions such as "first," "second," or "objective" in this document are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. "Multiple" in this document refers to at least two.
[0135] It is worth noting that in the specific embodiments of this application, relevant data is involved. When the above embodiments of this application are applied to specific products or technologies, permission or consent from the subject is required, and the collection, use, and processing of relevant data must comply with relevant laws, regulations, and standards. For example, when an embodiment of this application needs to obtain text or video data, separate permission or consent from the subject can be obtained through pop-up windows or redirection to a confirmation page. After obtaining separate permission or consent from the subject, the necessary text or video data for enabling the embodiment of this application to function properly can then be obtained.
[0136] Before providing a further detailed description of the embodiments of this application, the nouns and terms used in the embodiments of this application are explained, and the nouns and terms used in the embodiments of this application shall be interpreted as follows:
[0137] Task messages are the core data carriers for task scheduling and execution in the system. They contain information such as task type, parameters, and execution status. They can be generated by users triggering task controls or generated offline by the task message processing platform through platform programs.
[0138] Priority parameters are numerical or level parameters used to identify the execution priority of tasks, processes, or requests in the system. Their core function is to guide the scheduling system to allocate resources reasonably to tasks, processes, or requests, ensuring that high-priority tasks are processed first, thereby optimizing system efficiency, response speed, or service quality.
[0139] Relational databases are databases that organize data based on the relational model. Data is stored in the form of two-dimensional tables, and logical relationships are established between tables through primary keys and foreign keys. A primary key is a unique identifier for a table, and a foreign key refers to a field that links to another table.
[0140] A blocking queue is a queue data structure that supports safe communication between threads. Its core characteristic is that when the blocking queue's capacity reaches its limit (i.e., it's full), producer threads attempting to insert elements into the queue will be blocked until free space becomes available. Similarly, when the blocking queue is empty, consumer threads attempting to retrieve elements from it will be blocked until a new element is added. Therefore, blocking queues effectively coordinate the data exchange rhythm between multiple threads, avoiding resource contention or data loss. Elements in a blocking queue refer to task messages waiting to be processed. The maximum capacity of a blocking queue refers to the maximum number of task messages it can hold. The number of free elements in a blocking queue refers to the number of task messages that can still be stored.
[0141] Association degree prediction models are algorithmic models used to predict the strength of associations between task messages. Their core idea is to identify the synchronicity patterns between variables in different task messages through mathematical modeling, thereby predicting or optimizing the order in which the system processes task messages. Association degree prediction models can be divided into two categories: grey relational analysis models and association rule mining models. Grey relational analysis models are based on grey system theory and assess the degree of association between factors by quantifying the similarity of the geometric shapes of multiple sequences. For example, in Dön's grey relational model, a higher association degree value indicates that the changing trends of two sequences are more synchronized. Association rule mining models, on the other hand, belong to data mining techniques and are used to discover frequent patterns between itemsets.
[0142] Remaining time prediction model: This is an algorithmic tool used to estimate the time required for a process, task, or event to complete from its current state. Its core objective is to dynamically predict the remaining processing time of task messages by analyzing historical data and real-time status of task messages, thereby assisting in optimizing the order of task message processing.
[0143] Bucketing is a technique for dividing continuous data or large-scale datasets into multiple discrete intervals, where each discrete interval is called a bucket. Its core function is to divide data into different regions or containers according to preset rules, thereby balancing data complexity and computational efficiency. Specific bucketing methods include equal-width bucketing, equal-frequency bucketing, adaptive bucketing, cluster-based bucketing, and supervised bucketing.
[0144] Message priority scheduling is a core requirement in distributed systems and data communication. Existing message priority scheduling mechanisms mainly include two types: strict priority queues and weighted round-robin. Strict priority queues always prioritize high-priority messages over low-priority messages, making their scheduling inflexible and resulting in some low-priority messages remaining unprocessed for extended periods. Weighted round-robin assigns quotas to both high-priority and low-priority messages, with lower-priority messages receiving significantly less. During scheduling, a certain number of high-priority messages are selected for transmission and processing according to their quotas, followed by a certain number of low-priority messages according to their quotas, and this process is repeated continuously. However, since the quotas are relatively fixed, the significantly smaller quotas for low-priority messages also lead to them remaining unprocessed for extended periods, meaning that weighted round-robin also lacks flexibility in message processing.
[0145] In actual task message processing, different priority scheduling strategies are required for different scenarios, and these strategies may need to be adjusted in real time. However, the existing message priority scheduling mechanism is inflexible and difficult to adapt to these scenarios. Moreover, the existing message priority scheduling mechanism is prone to overloading processing threads and causing a cascading failure when faced with a sudden surge in task messages, while resource idleness is quite serious when the volume of task messages is small.
[0146] The embodiments of this application can improve the flexibility of priority scheduling, reduce overload when task messages are in short supply, and reduce resource waste.
[0147] System architecture and scenario description applied in the embodiments of this disclosure
[0148] Please see Figure 1 , Figure 1 This is a schematic diagram of a task message processing device provided in an embodiment of this application. It includes a terminal 140, an Internet 130, a gateway 120, a server 110, etc.
[0149] Terminal 140 is a device that displays a task interface, allowing users to trigger task message processing events through task triggering controls within the task processing interface. It can take various forms, including desktop computers, laptops, PDAs (Personal Digital Assistants), mobile phones, in-vehicle terminals, and dedicated terminals. Furthermore, it can be a single device or a collection of multiple devices. For example, multiple desktop computers connected via a local area network, sharing a single monitor, can work collaboratively to form a single terminal 140. Terminal 140 can communicate with the Internet 130 via wired or wireless means to exchange data.
[0150] Server 110 refers to a computer system capable of providing certain services to terminal 140. Compared to ordinary terminal 140, server 110 has higher requirements in terms of stability, security, and performance. Server 110 can be a single high-performance computer in a network platform, a cluster of multiple high-performance computers, a portion of a single high-performance computer (e.g., a virtual machine), or a combination of portions of multiple high-performance computers (e.g., virtual machines). Server 110 can also communicate with the Internet 130 via wired or wireless means to exchange data.
[0151] Gateway 120, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from terminal 140 to server 110 are forwarded to the corresponding server 110 via gateway 120. Messages sent from server 110 to terminal 140 are also forwarded to the corresponding terminal 140 via gateway 120.
[0152] The embodiments of this application can be applied in various scenarios, such as Figures 2A-2G The document library scene shown Figures 3A-3C The example shown illustrates the conversational application scenario.
[0153] (I) Document Library Scene
[0154] In the document library scenario, server 110 needs to calculate the number of reads for files daily based on read volume statistics messages (i.e., offline triggered task messages). Furthermore, users select desired files through the file selection interface (i.e., the task interface) displayed on terminal 140, generating a file download request (i.e., a user-triggered task message) on terminal 140. Terminal 140 then sends this request to server 110, which downloads the file to terminal 140. If server 110 prioritizes reading volume statistics tasks before processing file download requests from terminal 140, the download time for users will be prolonged. Therefore, there is a need for a flexible priority scheduling method to prioritize file download requests from users via terminal 140, allowing for flexible priority scheduling and processing of different task messages, reducing overload during task message surges, and minimizing resource waste.
[0155] The embodiments of this disclosure enable this scenario. In this scenario, server 110 first responds to receiving a readership statistics message or a file download request by obtaining multiple priority parameters for the readership statistics message or file download request, and stores the readership statistics message or file download request and its respective multiple priority parameters in a relational database. Then, server 110 obtains priority filtering conditions, and responds to the fact that the blocking queue is not full, queries the relational database for task messages whose multiple priority parameters meet the priority filtering conditions. Finally, server 110 fills the blocking queue with the queried task messages until the blocking queue is full, and retrieves task messages from the blocking queue for processing.
[0156] like Figure 2A As shown, terminal 140 displays the file "20XX Company Human Resources Internship Certificate Template" that the user needs to download, along with a preview of the file's content: "Company Human Resources Internship Certificate Template 'This is to certify that * student of ** University, ** College, ** Major, * interned at ** Company from * July _, ** year to * September _, ** year. The student's assigned position was Human Resources Intern'" and "July _, 20XX".'" After the user clicks the "Document Download" button in the upper right corner of the interface, terminal 140 sends a file download request to server 110 and retrieves the file from... Figure 2A Jump to as Figure 2B The interface shown.
[0157] like Figure 2B As shown, the interface of terminal 140 displays "Storing file download request to relational database". At this time, server 110 responds to the file download request, obtains two priority parameters for the file download request: task message type and resource transfer count, and stores the file download request, task message type, and resource transfer count accordingly in the relational database. Each priority parameter has a task message score. The task message type of the file download request is "user-triggered type", the resource transfer count of the file download request is "12", and the task message score of the file download request is "1002000".
[0158] Simultaneously, server 110 responds to the readership statistics message by obtaining two priority parameters: task message type and resource transfer count, and stores the readership statistics message, task message type, and resource transfer count in a relational database accordingly. Specifically, the task message type of the readership statistics message is "offline triggered type," the resource transfer count is "0," and the task message score is "100."
[0159] like Figure 2CAs shown, server 110 obtains the priority filtering conditions and, in response to the blocking queue not being full, queries the relational database for multiple task messages whose priority parameters meet the priority filtering conditions. In this scenario, the priority filtering condition is: query task message messages with a score greater than 100. Therefore, file download requests are queried and added to the blocking queue before read count statistics messages. When server 110 finds a file download request, terminal 140 retrieves the file download request from the database. Figure 2B Jump to as Figure 2D The interface shown.
[0160] like Figure 2D As shown, the interface of terminal 140 displays "Filling file download requests into the blocking queue". After server 110 fills the blocking queue with file download requests, terminal 140... Figure 2D Jump to as Figure 2E The interface shown.
[0161] like Figure 2E As shown, the interface of terminal 140 displays "File download requests have been added to the blocking queue, current sequence number is 1, there are 0 pending tasks ahead, waiting for processing." At this time, server 110 has added file download requests to the blocking queue and is processing file download requests according to the task messages in the blocking queue. Then, while the blocking queue is not full, server 110 adds a read count statistics message to the blocking queue, with the read count statistics message having a sequence number of 2 in the blocking queue. Server 110 needs to wait for the file download request with sequence number 1 to be processed before it can process the read count statistics message. When server 110 processes a file download request, terminal 140... Figure 2E Jump to as Figure 2F The interface shown.
[0162] like Figure 2F As shown, the interface of terminal 140 displays "Downloading document to my library". At this time, server 110 retrieves the file download request from the blocking queue and downloads the file required by the user to "My Library" on terminal 140 according to the file download request. When the file download is complete, terminal 140... Figure 2F Jump to as Figure 2G The interface shown. (As shown) Figure 2G As shown, the interface of terminal 140 displays "The document has been downloaded to my library".
[0163] (II) Session Application Scenarios
[0164] In a session application scenario, server 110 needs to statistically analyze session failures that occur daily based on fault analysis messages (i.e., offline triggered task messages). Furthermore, users can initiate sessions with another terminal 140 by sending session messages (i.e., user-triggered task messages) to server 110 through the session interface (i.e., task interface) displayed on terminal 140. If server 110 prioritizes processing fault analysis tasks based on fault analysis messages before processing session tasks based on session messages sent by terminal 140, it leads to low efficiency in user communication via sessions. Therefore, there is a need for a flexible priority scheduling method to prioritize session messages sent by users to server 110 via terminal 140. This allows for flexible priority scheduling and processing of different task messages, reducing server 110 overload during periods of high session message volume and minimizing resource waste when session messages are few.
[0165] like Figure 3A As shown, server 110 first obtains three priority parameters of the fault analysis message: task message type, task processing time limit, and resource consumption. Then, it stores the fault analysis message, task message type, task processing time limit, and resource consumption into a relational database accordingly. Specifically, the task message type of the fault analysis message is offline triggered, the task processing time limit is "1440 minutes", the resource consumption is "1M", and the task message score is "90".
[0166] like Figure 3B As shown, server 110 responds to receiving a session message by obtaining three priority parameters of the session message: task message type, task processing time limit, and resource consumption. Then, it stores the session message, task message type, task processing time limit, and resource consumption in a relational database accordingly. Specifically, the task message type of the session message is user-triggered, the task processing time limit is "1 minute," the resource consumption is "1K," and the task message score is "2040."
[0167] like Figure 3C As shown, server 110 obtains the priority filtering conditions and checks whether the blocking queue is not full. If the blocking queue is not full, it queries the relational database for task messages whose three priority parameters satisfy the priority filtering conditions. In this scenario, the priority filtering condition could be: the task message score is greater than "1000". Therefore, server 110 only finds session messages that satisfy the priority filtering conditions and will only fill the blocking queue with session messages. Finally, server 110 retrieves session messages from the blocking queue according to their order in the blocking queue for processing.
[0168] It should be noted that the priority filtering conditions can be flexibly changed. For example, the condition change threshold can be determined based on the load of server 110 and a preset threshold, which can be 75%. When the load of server 110 is higher than the condition change threshold, the priority filtering condition is set to "task message score greater than '1000'", and when the load of server 110 is lower than the condition change threshold, the priority filtering condition is set to "task message score greater than '10'". Therefore, during a surge in session messages, server 110 overload can be reduced by processing only session messages and ignoring fault analysis messages, while processing both session messages and fault analysis messages simultaneously when there are fewer session messages, thus reducing resource waste on server 110.
[0169] General Description of Embodiments in this Disclosure
[0170] In this application embodiment, the description will be from the perspective of a task message processing device. Specifically, the task message processing device can be integrated into a computer device that has a storage unit and is equipped with a microprocessor and has computing capabilities. The computer device can be a server or a terminal, and there is no limitation on this.
[0171] Please see Figure 4 , Figure 4 This is a flowchart illustrating the task message processing method provided in the embodiments of this application. The task message processing method can be implemented by a server and / or a terminal. Figure 4 The general description method of the embodiments of this disclosure shown includes:
[0172] Step 410: In response to receiving a task message, obtain multiple priority parameters of the task message;
[0173] Step 420: Store the task messages and their corresponding priority parameters in a relational database;
[0174] Step 430: Obtain priority filtering conditions;
[0175] Step 440: In response to the blocking queue not being full, query the relational database for task messages whose priority parameters meet the priority filtering conditions;
[0176] Step 450: Fill the blocking queue with the retrieved task messages until the blocking queue is full;
[0177] Step 460: Retrieve the task message from the blocking queue and process it.
[0178] First, a brief description of steps 410-460 above will be given.
[0179] The task message in step 410 is the core data carrier for task scheduling and execution, and is the basic unit used to represent and process various business operations. A task message may contain the following task information: task identifier, task type, task content, task execution status, or operation instructions. Task messages can be generated by the user triggering a task control, or they can be generated offline by the task message processing platform through platform programs.
[0180] Taking an order processing platform in the fintech sector as an example, task messages can be generated based on tasks such as order processing and order generation statistics. For order processing tasks, the task message can include: order identifier, basic order information, and business logic instructions. Basic order information is the core content of the task message, including order number, product details, order type, user information, the user information to which the order belongs, and order status. Business logic instructions are used to indicate how to process the order processing task, such as user information verification instructions, product inventory deduction instructions, and order status update instructions.
[0181] Priority parameters are string, numeric, or level parameters used to define the order in which task messages are executed. They ensure that high-priority tasks are processed first, thus reflecting the importance and urgency of the task messages. The priority order can be obtained by sorting the priority parameters from smallest to largest, or from largest to smallest.
[0182] It's important to note that a single task message can have multiple priority parameters to accurately determine the processing priority of multiple task messages, thereby improving execution efficiency and the rationality of resource allocation in task message processing methods. For example, for order processing tasks, priority parameters for order task messages typically include, but are not limited to, the number of products, user level, order type, and order urgency. Task messages with a larger number of products should be processed first, as these tasks contribute more to the order processing platform's revenue. Orders from users with higher levels should also be prioritized to maintain the satisfaction of high-value customers. Order type is also an important priority parameter. If the order type is a limited-time flash sale order, it needs to be processed quickly to avoid losses due to untimely inventory deductions and slow product delivery. Furthermore, the urgency of the order also affects the processing priority of order task information; orders nearing their delivery timeout period have increased urgency and require priority processing.
[0183] After obtaining multiple priority parameters of the task message, in step 420, the task message and the corresponding priority parameters can be stored in a relational database. A relational database is a database system that organizes data in a tabular format. It stores and manages task messages and their priority parameters through tables, fields, and relationships between tables, facilitating the querying and processing of task messages based on the priority parameters. A table is the basic unit for storing data in a relational database; it consists of rows and columns, resembling a two-dimensional table.
[0184] Tables are typically used to store specific types of data. For example, an order processing platform might have a "message priority table" to store all task messages and their priority parameters, and a "task message table" to store basic information about the task messages. Each row in a table represents a data record (also called an instance), and each column represents a data attribute (also called a field). An instance refers to a specific data record stored in a relational database, such as a specific task message.
[0185] A field is a column in a table used to store data of a specific type. Each field has a name and a data type, which determines the kinds of data that the field can store, such as integers (Int), strings (String), dates (Date), etc. The "Message Priority Table" may contain the following fields: task message identifier, priority parameter, or task message status value. The "Task Message Table" may contain the following fields: message body name, message body type, and message body description.
[0186] Inter-table relationships refer to the connections established between tables through fields, used to represent the association between different data. Relationships can be implemented through the values of fields. The most common relationship types include one-to-one, one-to-many, and many-to-many relationships. A one-to-one relationship means that one instance of a record in table A corresponds to one instance of a record in table B. For example, a user may have a unique user configuration information. A one-to-many relationship means that one instance of a record in table A corresponds to multiple instances of a record in table B. For example, a user may have multiple orders. A many-to-many relationship means that multiple instances of a record in table A correspond to multiple instances of a record in table B. For example, a product can appear in multiple orders, and an order can also contain multiple products. Inter-table relationships are usually implemented through an intermediary table containing foreign key fields from both tables.
[0187] Table 1 shows the structure of a message priority table. This table contains the following fields: Task Message Identifier (ID), Task Message Type (Type), Task Message Score (Score), and Task Message Status (Status). The details of Task Message Type, Task Message Score, and Task Message Status will be described in detail below. The Task Message Score and Status are priority parameter attributes for the task message. Figure 21 As shown, the priority parameters corresponding to the task message type can be divided into "user-triggered type" and "offline-triggered type". The value of "user-triggered type" in Table 1 is "1", and the value of "offline-triggered type" in Table 1 is "2". In the examples in Table 1, there are four instances: the first instance is "ID=A, Type=1, Score=1000000, Status=1"; the second instance is "ID=B, Type=1, Score=2000000, Status=1"; the third instance is "ID=C, Type=2, Score=10100, Status=1"; and the fourth instance is "ID=D, Type=2, Score=10200, Status=1".
[0188]
[0189] Table 1
[0190] Table 2 shows a structure of the task message table. This table contains the following fields: Task Message Identifier (ID), Task Message Body, Task Message Type, Task Message Score, and Task Message Status. In the examples in Table 2, there are four instances: The first instance is "ID=A, Body='Task Type: Order Status Detection, Order Number: Order1002, Payment Status: Unpaid, Creation Time: 2024.05.12 12:00:00', Type='User Trigger Type', Score=1000000, Status=1"; the second instance is "ID=B, Body='Task Type: Order Shipment, Order Number: Order1002, Shipment Time: 2024.05.13-2024.06.12, Quantity of Goods: 10', Type='User Trigger Type', Score=2000000, Status=1"; the third instance is "ID=C, Body='Task Type: Order Count Statistics, Order Count Statistics Start Time: 2024.05.12 00:00:00, Order Count Statistics End Time: 2024.05.13'". The first instance is defined as "00:00:00", "Type = 'Offline Trigger Type'", "Score = 10100", and "Status = 1". The second instance is defined as "ID = D, Body = 'Task Type: Product Recommendation Data Update, Data Update Time: 2024.05.13 02:00:00', "Type = 'Offline Trigger Type'", "Score = 10200", and "Status = 1". The message priority table is linked to the task message table via the foreign key "Task Message Identifier".
[0191]
[0192]
[0193] Table 2
[0194] Table 3 shows the structure of the example in Table 2. This table contains the following fields: message body name, message body type, and message body description. In the example in Table 3, the task message identifier is defined as "ID", type "Bigint", and described as "unique message identifier". The task message body is defined as "Body", type "String", and described as "message body content". The task message status value is defined as "Status", type "Int", and described as "message processing status". The task message type is defined as "Type", type "Int", and described as "message type". The task message score is defined as "Score", type "Int", and described as "message score".
[0195] name type describe ID Bigint Message unique identifier Body String Message content Status Int Message processing status Type Int Message Type Score Int Message Score
[0196] Table 3
[0197] The advantage of using Table 1 as the message priority table and Table 2 as the task message table is that when it is necessary to query task messages based on priority parameters and when task messages are filled into the blocking queue, the message priority table stores less information, thereby reducing the amount of data that needs to be processed and improving the efficiency of task message querying and processing.
[0198] In one embodiment, Table 2 can also be directly used as the message priority table. The advantage of using Table 2 directly as the message priority table is that it simplifies the database structure and reduces the number and complexity of tables. By storing the priority parameters directly in the task message table, join queries between multiple tables can be avoided, thereby reducing the complexity and potential performance overhead of querying task messages.
[0199] After storing the task messages and their corresponding priority parameters in a relational database, step 430 retrieves the priority filtering conditions. These priority filtering conditions are used to select messages from a large number of task messages that meet specific priority requirements, and typically consist of a priority filtering threshold and priority parameters.
[0200] A priority filtering threshold is a specific value or range used to define the minimum priority a task message must meet or the specific interval it must fall within. The priority filtering threshold can be a single priority parameter or the threshold for multiple priority parameters. For example, a priority filtering threshold could be "Task Message Type" as "Type=1", or "Task Message Score" as "Score=100000". Based on this, priority filtering conditions can be: priority parameters are greater than, less than, or equal to the priority filtering threshold. For example, a priority filtering condition could be: the task message type is less than or equal to the priority filtering threshold, and the task message score is greater than the priority filtering threshold.
[0201] In one embodiment, priority filtering conditions can be flexibly set based on the importance and urgency of task messages and the resource status of the task message processing device. This allows the task message processing device to flexibly adjust the processing order of task messages to meet different business needs and resource allocation strategies. For example, if the task message processing device is currently under high load, the priority filtering condition will be adjusted so that the resource consumption of task messages is less than a preset resource consumption threshold, and then task messages will be queried according to the message query threshold. If the task message processing device is currently under low load, the priority filtering condition will be adjusted so that the resource consumption of task messages is not limited, and task messages will be queried according to the message query threshold. Therefore, the priority filtering condition can be flexibly set according to the application scenario, greatly improving the scheduling flexibility of task messages. When faced with a sudden surge in task messages, the buffer provided by the relational database prevents overload of processing threads. When the number of task messages is small, processing threads can retrieve previously accumulated task messages from the blocking queue for processing, improving resource utilization.
[0202] After obtaining the priority filtering conditions, in step 440, in response to the blocking queue not being full, multiple task messages whose priority parameters meet the priority filtering conditions can be queried from the relational database. A blocking queue is a queue data structure used in the producer-consumer pattern. The main characteristics of a blocking queue are: when the queue is empty, the consumer thread (i.e., the processing thread) will block and wait; and when the queue is full, the producer thread (i.e., the scheduling service thread) will block and wait. Therefore, by setting the maximum capacity of the blocking queue, the scheduling service thread can query multiple task messages whose priority parameters meet the priority filtering conditions only when the blocking queue is not full, effectively controlling the data flow between the scheduling service thread and the processing thread, preventing the scheduling service thread from overproducing, and thus avoiding excessive resource consumption. Simultaneously, the blocking queue can also limit the number of processing threads, ensuring that the processing thread only retrieves task messages from the blocking queue for processing when the queue is not empty, preventing the processing thread from frequently performing invalid operations due to an empty queue. Therefore, this application can utilize the blocking queue to enable the scheduling service thread and the processing thread to efficiently utilize resources, avoiding unnecessary CPU usage, thereby improving the stability and reliability of the task message processing device.
[0203] After querying multiple task messages that meet the priority filtering conditions, step 450 will fill the blocking queue with the queried task messages until the blocking queue is full, and step 460 will retrieve the task messages from the blocking queue for processing.
[0204] In steps 410-460 above, in response to receiving a task message, multiple priority parameters of the task message are obtained, and the task message and multiple priority parameters are stored in a relational database. This allows the task message and priority parameters to be stored as structured data using a relational database, facilitating management operations such as querying, sorting, and filtering of task messages based on priority parameters, thus improving the efficiency of task message management and processing. Furthermore, by obtaining priority filtering conditions and, in response to an unfilled blocking queue, querying the relational database for task messages whose priority parameters meet the priority filtering conditions, different priority filtering conditions can be flexibly set for different application scenarios. This allows for the implementation of specific priority scheduling requirements based on the application scenario, improving the flexibility of priority scheduling and enabling the task message processing device to adapt to various application scenarios, ultimately enhancing the application flexibility of the task message processing device. Furthermore, by filling the blocking queue with the retrieved task messages until the queue is full, and then retrieving task messages from the blocking queue for processing, the data flow between the scheduling service thread and the processing thread can be effectively controlled. This not only avoids overloading the processing thread when faced with a surge in task messages, but also allows the processing thread to process the accumulated task messages in the blocking queue when the number of task messages is small, thus improving resource utilization.
[0205] Steps 410-460 are described in detail below.
[0206] Detailed description of step 410
[0207] Steps 410-460 above can be executed based on a triggering event. In step 410, the triggering event is that the task message processing device receives a task message. Receiving multiple priority parameters of the task message in response to its receipt has the advantage of reducing the overhead of sending multiple task message retrieval requests to the terminal when the task message has not yet been sent to the task message processing device. Furthermore, compared to storing the task message in a relational database first and then querying it to retrieve its priority parameters later, immediately retrieving multiple priority parameters upon receiving the task message eliminates the need for additional database queries, reducing the number of database accesses and context switching caused by query operations, thereby reducing context switching overhead and improving overall processing efficiency. In addition, the triggering event response method is more real-time, which can improve the real-time processing performance of task messages in scenarios with high real-time requirements.
[0208] The advantage of obtaining multiple priority parameters for task messages is that multiple priority parameters can be used to enrich the basis for filtering and sorting task messages, thereby flexibly selecting task messages that are suitable for different application scenarios for processing, so as to make reasonable use of computing resources.
[0209] Based on this, in response to receiving a task message, multiple priority parameters of the task message can be obtained. The method for obtaining multiple priority parameters of a task message can be as follows: for each type of task information, a priority mapping table is preset, and different fields of the task information are associated with corresponding priority parameters. Then, upon receiving a task message, the priority parameters are obtained by parsing the task information fields contained in the task message and looking up the priority mapping table based on the task information fields.
[0210] For example, for a task message in an order processing task, if the order status field indicates that the order's shipping status is "awaiting shipment," and the priority parameter for "awaiting shipment" in the shipping status priority mapping table is "1," then the shipping status priority parameter for this task message is "order status 1." If the order type field indicates that the order's order category is "normal order," and the priority parameter for "normal order" in the order type priority mapping table is "5," then the order type priority parameter for this task message is "5."
[0211] Detailed description of step 420
[0212] In step 420, task messages can be stored in a relational database along with multiple priority parameters. The advantage of storing task messages with corresponding priority parameters is that subsequent queries can directly retrieve the multiple priority parameters corresponding to the task message, reducing the waste of computing resources caused by repeatedly retrieving these parameters each time. Furthermore, task messages can be easily queried and sorted based on the multiple priority parameters, enabling scheduling and processing of task messages accordingly.
[0213] Specifically, firstly, the instance structure of the task message table is invoked. Using this structure, instances of the task message and multiple priority parameters are constructed to obtain a first instance, which is then stored in the task message table. Next, the necessary fields for the instance in the message priority table are extracted from the first instance, and a second instance of the message priority table is reconstructed and stored in the message priority table. The second instance may only include the task message and multiple priority parameters, or it may include other information that helps determine the task message processing status. Finally, based on the relationship between the message priority table and the task message table, a primary key for the first instance and a foreign key for the second instance are constructed. For example, the relationship between the message priority table and the task message table could be: using the task message identifier as the primary key of the task message table and as a foreign key of the message priority table.
[0214] Detailed description of step 430
[0215] In step 430, priority filtering conditions are obtained. These conditions can be pre-stored in the local storage of the task message processing device, such as memory, hard disk, or other high-speed storage media. Alternatively, they can be pre-stored in a centralized configuration server, a distributed configuration system, a relational database, or cloud storage.
[0216] In one embodiment, priority filtering conditions can be selected based on the actual application scenario, resource usage, or the time period of the platform or device, thereby enabling the task message processing device to allocate resources reasonably and ensure that the processing of critical tasks is not affected.
[0217] Specifically, taking a shopping platform as an example, application scenarios can be divided into promotional activities and daily operations. If the application scenario is a promotional activity, the task message processing device may face a large number of new shopping orders. In this case, it is necessary to prioritize processing new shopping orders generated based on the promotional activity to prevent too many new orders from remaining unprocessed for extended periods, thus avoiding problems such as incorrect product inventory counts or activity interface crashes. To this end, the shopping platform will select parameters based on pre-configured filtering conditions to obtain priority filtering conditions related to the promotional activity. These filtering parameters may include: order type "limited-time offer," and order addition frequency, etc. The order addition frequency must be greater than a preset addition frequency threshold, which is one hundred new orders per second. If the application scenario is daily operations, the task message processing device will handle fewer new shopping orders and can process all orders according to their generation time order. In this case, the filtering parameters may include: order type "unlimited type," and order addition frequency, etc. The order addition frequency must be less than a preset addition frequency threshold.
[0218] Taking session applications as an example, resource usage can be categorized into resource scarcity and resource abundance. When session applications experience resource scarcity, such as a surge in session tasks or high server load, the task message processing device needs to prioritize tasks with lower resource consumption but higher priority to avoid server overload. Therefore, the session application selects parameters based on pre-stored filtering conditions to obtain priority filtering conditions related to resource scarcity. These filtering parameters may include, but are not limited to, at least one of the following: CPU utilization, available memory space, and network bandwidth utilization. Specifically, CPU utilization must be greater than a preset CPU utilization threshold (e.g., 80%), available memory space must be less than a preset available memory threshold (e.g., 1GB), and network bandwidth utilization must be higher than a preset bandwidth utilization threshold (e.g., 90%). When session applications have sufficient resources, such as almost no pending session tasks or low server load, tasks such as fault log backup and fault repair can be prioritized. At this time, the filter selection parameters can also include, but are not limited to, at least one of the following: CPU utilization, available memory space, and network bandwidth utilization, wherein the CPU utilization is lower than the preset CPU utilization threshold, the available memory space is greater than the preset available memory threshold, or the network bandwidth utilization is lower than the preset bandwidth utilization threshold.
[0219] Taking a video streaming platform as an example, the platform's time periods can be divided into high-concurrency periods and low-concurrency periods. High-concurrency periods refer to the playback periods of popular programs or live broadcasts. During these periods, the task message processing device needs to prioritize video stream requests with lower resource consumption, such as short videos with low resolution and few user requests. Therefore, the session application selects parameters based on pre-stored filtering conditions to obtain priority filtering conditions related to high-concurrency periods. These filtering parameters may include, but are not limited to, at least one of the following: video resolution, video duration, and number of user requests. Specifically, the video resolution must be lower than a preset resolution threshold (e.g., 360P), the video duration must be less than a preset duration threshold (e.g., 60 seconds), and the number of user requests must be lower than a preset request volume threshold (e.g., 10 requests). Low-concurrency periods refer to the playback periods of non-popular programs or non-live broadcasts. During these periods, the task message processing device can prioritize video stream requests with higher resource consumption, such as high-resolution videos with fewer user requests. The filtering conditions can also include, but are not limited to, at least one of the following: video resolution, video duration, and user request volume. Among them, the video resolution must be higher than a preset resolution threshold, the video duration must be greater than a preset duration threshold, and the user request volume must be lower than a preset request volume threshold. The request volume threshold can be 10.
[0220] Detailed description of step 440
[0221] In step 440, in response to the triggering event that the blocking queue is not full, a task message query step is performed. The advantage of this is that it reduces the overhead of repeatedly filling the blocking queue with task messages when it is full. Furthermore, during periods of task surges, limiting the scheduling service thread from sending too many task messages to the processing thread through the blocking queue can also prevent the processing thread from crashing due to overload.
[0222] In one embodiment, the step of querying task messages with multiple priority parameters that satisfy priority filtering conditions from a relational database can utilize priority filtering conditions set based on application scenarios to filter out task messages that are difficult to process, have low importance, or low urgency, and prioritize querying and processing task messages with multiple priority parameters that satisfy priority filtering conditions. This improves the flexibility of the task message processing device in processing task messages. Because different priority filtering conditions exist, task messages with multiple priority parameters satisfying priority filtering conditions can be queried in different ways. For example, task messages with a task message type of "Type=1" and a task message score of "Score>100000" can be queried.
[0223] In another embodiment, since the task messages are queried based on priority filtering thresholds, it may be difficult to accurately assess the importance of the task messages by considering the impact of each priority parameter on the priority order of the task messages individually. This may result in low adaptability of the task message processing order to the application scenario.
[0224] The following example illustrates the above problem: Order task message A has a relatively low urgency level (e.g., urgency 2), but it involves a large quantity of goods (e.g., 100 items). Order task message B has the highest urgency level (e.g., urgency 1), but it involves a smaller quantity of goods (e.g., 1 item). If you only query order task messages with a urgency level of 1 and a quantity of 1 or more goods, you will only find order task message B, not order task message A. Similarly, if you only query order task messages with a quantity of more than 50 goods and a urgency level of 1 or 2, you will only find order task message A, not order task message B. If you query order task messages with a urgency level of 1 or 2 and a quantity of 1 or more goods, you will find both order task messages A and B, but the number of retrieved messages will be too large. However, in actual task message processing, although order task message A and order task message B have different delivery urgency levels, and the quantity of goods in order task message A is much higher than that in order task message B, considering both the delivery urgency and the quantity of goods, it is found that the priority of order task message A is similar to that of order task message B. The method described above for querying task messages based on priority filtering thresholds is insufficient to accurately analyze the priority of different order task messages in such cases. Therefore, in this embodiment, the priority filtering condition needs to be set to: based on the total score of multiple priority parameters meeting predetermined conditions, to comprehensively consider all priority parameters of each task message, thereby more accurately evaluating the priority of the task message.
[0225] like Figure 5 As shown, in this embodiment, step 440 includes:
[0226] Step 510: In response to the blocking queue not being full, for each task message in the relational database, determine the parameter score corresponding to each of the multiple priority parameters of the task message;
[0227] Step 520: Calculate the total score of the task message based on the parameter scores corresponding to each of the multiple priority parameters;
[0228] Step 530: Query the task message from the relational database that the total score meets the predetermined conditions.
[0229] The following is a detailed description of steps 510-530 above.
[0230] In step 510, since different priority parameters belong to different data types, for each task message in the relational database, it is first necessary to determine the parameter scores corresponding to each of the multiple priority parameters. For example, for a session task, the data type of its task message type is a string, specifically "send emoji". Therefore, it is necessary to convert the data type from string to numeric to obtain the parameter score corresponding to the data type. Specifically, first, a preset type-to-numeric conversion table is called, and then the parameter score corresponding to the data type is queried in the type-to-numeric conversion table. The parameter score can be regarded as a numerical value obtained by quantifying the priority parameters according to their importance. For example, the parameter score corresponding to the data type "send emoji" in the type-to-numeric conversion table could be "100".
[0231] Furthermore, although some priority parameters belong to numerical data types, their specific values have little impact on the priority of task messages within a certain range. For example, the data size of a session task might be "1B" or "2B". Alternatively, the range of values for priority parameters might be too large, such as the weight of a product being "18.000000001KG". Assigning a separate parameter score to these priority parameters would require excessive storage space and resources for querying task messages based on these priority parameters, leading to low efficiency in task message processing. Therefore, it is also necessary to redetermine the corresponding parameter scores for these priority parameters. For example, the data size of a session task, "1B" and "2B", both correspond to a parameter score of "1" in the data size parameter score conversion table, while the product weight, "18.000000001KG", corresponds to a parameter score of "18" in the product weight parameter score conversion table.
[0232] After determining the parameter scores corresponding to each of the multiple priority parameters, in step 520, the total score of the task message is calculated based on the parameter scores corresponding to each of the multiple priority parameters. The specific method for calculating the total score of the task message can be to simply add the scores of each parameter, or to perform a weighted sum according to a preset weight, or to calculate the average of the scores of each parameter, or to calculate a weighted average with preset weights, or to concatenate the parameter scores.
[0233] For example, for a session task message, the parameter score corresponding to the data volume is "2", the parameter score corresponding to the data type is "8", and the parameter score corresponding to the data transmission time limit is "5". If the parameter scores are weighted and added together, the weight of the data volume can be 10, the weight of the data type can be 10, and the weight of the data transmission time limit can be 20, resulting in a total score of 200 for the session task message. If the parameter scores are weighted and averaged, the total score for the session task message is 5. If the parameter scores are concatenated, the total score for the session task message is 285.
[0234] After calculating the total score of the task messages, in step 530, the task messages and total scores can first be stored in a relational database, and then task messages whose total scores meet predetermined conditions can be queried. These predetermined conditions can be determined based on a total score filtering threshold rule. The total score filtering threshold rule can be: selecting task messages whose total scores are greater than, less than, or equal to a total score filtering threshold.
[0235] The advantage of the embodiment of steps 510-530 is that, for each task message in the relational database, the parameter scores corresponding to the multiple priority parameters of the task message are determined, and the total score of the task message is calculated based on the parameter scores corresponding to the multiple priority parameters. Then, the task messages whose total scores meet the predetermined conditions are queried from the relational database. By quantifying multiple priority parameters into parameter scores and calculating the total score of the task message based on the parameter scores, the processing priority of the task messages can be comprehensively considered based on the total score, thereby more accurately evaluating the priority of the task messages.
[0236] In another embodiment, since the capacity of the blocking queue is fixed, in order to maximize the utilization of the blocking queue's capacity and thus avoid excessive resource consumption, it is necessary to fill the blocking queue with task messages according to the number of task messages that the blocking queue can still hold.
[0237] like Figure 6 As shown, in this embodiment, step 440 further includes:
[0238] Step 610: In response to the blocking queue not being full, determine the number of task messages that the blocking queue can still hold, and use it as the first number;
[0239] Step 620: Sort the task messages in the relational database according to the priority parameter usage rules;
[0240] Step 630: Among the task messages whose priority parameters meet the priority filtering conditions, select the first number of task messages in the sorted order as the queried task messages.
[0241] The following is a detailed description of steps 610-630 above.
[0242] In step 610, since the scheduling service thread continuously fills the blocking queue with task messages, and the processing thread continuously retrieves task messages from the blocking queue, the number of empty elements in the blocking queue will change. Before filling the blocking queue with task messages, it is necessary to determine the number of task messages that the blocking queue can still hold, which is designated as the first number. Specifically, first, the maximum capacity of the blocking queue and the number of task messages already in the blocking queue are determined. Then, the difference between the maximum capacity of the blocking queue and the number of task messages already in the blocking queue is calculated, and the resulting number of empty elements is used as the first number. The first number indicates the number of task messages that can be added to the blocking queue at present, ensuring that the scheduling service thread does not exceed the maximum capacity of the blocking queue when adding task messages, thereby avoiding blocking queue overflow and excessive resource consumption. For example, if the maximum capacity of the blocking queue is 10 and the number of task messages already in the blocking queue is 2, then the first number is 8.
[0243] In step 620, the priority parameter usage rules describe: the order in which parameter fields of different priority parameters are sorted when sorting task messages, and the order in which different priority parameters sort task messages for the same parameter field. Specifically, the priority parameter usage rules are determined as follows: first, the sorting method of the parameter fields is determined; then, the sorting method of the priority parameters corresponding to each parameter field is determined; finally, the sorting of task messages is determined based on the sorting method of the parameter fields and the sorting method of the priority parameters corresponding to each parameter field.
[0244] By prioritizing task messages according to priority parameters, the mechanism ensures that the most important task messages in the current application scenario are processed first. For example, in an order processing system of a shopping platform, in scenarios with long-term inventory backlog, the scheduling service thread of the task message processing device will prioritize order task messages with large quantities of goods and nearing their delivery deadlines, placing them at the top of the message priority table. This ensures that these order task messages are added to the blocking queue first and processed with priority, guaranteeing that the corresponding orders are shipped within the delivery deadline and preventing order loss due to exceeding the deadline. Furthermore, prioritizing order task messages with large quantities of goods reduces inventory backlog caused by order loss.
[0245] Furthermore, similar to priority filtering conditions, priority parameter usage rules can be flexibly selected according to different application scenarios. This allows the task message processing device to adapt to various business needs and resource conditions, ensuring optimal task scheduling and resource utilization under all circumstances, thereby improving the flexibility and efficiency of task message processing. For example, when resources are scarce, the selected priority parameter usage rules will prioritize task messages with low resource consumption and requiring real-time feedback on processing progress to the terminal in the message priority table, thus prioritizing the processing of resource-intensive and urgent task messages. Conversely, when resources are abundant, the selected priority parameter usage rules will prioritize task messages with high resource consumption and not requiring real-time feedback on processing progress to the terminal, thus prioritizing the processing of resource-intensive and non-urgent task messages, thereby achieving full utilization of resources.
[0246] In another embodiment, the priority parameter usage rule can also be: construct a composite index based on multiple priority parameters, and sort the task messages based on the composite index. Taking the priority parameter usage rule under resource constraints as an example, the structure of the composite index can be: "resource consumption + processing progress feedback type", where the processing progress feedback type is used to describe whether it is necessary to provide real-time feedback on processing progress to the terminal.
[0247] After determining the initial number and sorting the task messages in the relational database according to the priority parameter usage rules, in step 630, the top 100 task messages from among the multiple priority parameters that satisfy the priority filtering conditions are selected as the queried task messages. This allows for a more comprehensive, flexible, and efficient evaluation of the priority order of task messages. Furthermore, filtering some task messages through priority filtering conditions and limiting the number of queried task messages by the initial number reduces the resources consumed by the scheduling service thread in querying task messages. Specifically, first, multiple task messages that satisfy the priority filtering conditions are filtered, and then the top 100 task messages from the initial number are selected as the queried task messages.
[0248] For example, if the current load of the task message processing device is high, the priority filtering condition will be adjusted as follows: the resource consumption of the task message is less than the resource consumption threshold, the resource consumption threshold is 1%, and the priority parameter usage rule is the same as the priority parameter usage rule when resources are scarce. The first number is determined to be 5. Then, the task messages with low resource consumption and that need to provide real-time feedback on processing progress to the terminal will be placed at the top of the message priority table. Then, the top 5 task messages with a resource consumption threshold of 1% will be selected as the query results.
[0249] If the current load on the task message processing device is low, the priority filtering conditions will be adjusted to: no limit on the resource consumption of task messages, and the message processing time limit of task messages is lower than the preset processing time limit threshold, which is 1 minute. The priority parameter usage rules are adjusted to the same rules as when resources are sufficient. If the first number is determined to be 8, then task messages with high resource consumption and no need to provide real-time feedback on processing progress to the terminal will be placed at the top of the message priority table. Then, the top 8 task messages with a message processing time limit of less than 1 minute will be selected as the retrieved task messages.
[0250] In steps 610 to 630, in response to the blocking queue not being full, the number of task messages that the blocking queue can still hold is first determined as the first number. Then, the task messages in the relational database are sorted according to the priority parameter usage rules. Next, among the task messages whose priority parameters meet the priority filtering conditions, the first number of task messages in the sorted list are selected as the retrieved task messages. This allows for flexible selection of priority parameter usage rules and priority filtering conditions based on the application scenario, enabling the task message processing device to flexibly adjust the processing order of task messages to meet different business needs and resource allocation strategies. Furthermore, determining the retrieved task messages based on the number of task messages that the blocking queue can still hold avoids the situation where the number of retrieved task messages exceeds the number of free elements in the blocking queue and cannot be filled into the blocking queue in a timely manner, reducing the resources consumed by the scheduling service thread.
[0251] A more detailed description of step 620 is given below.
[0252] like Figure 7 As shown, in this embodiment, multiple priority parameters include task message type and task message score. Taking the task message types including "user-triggered type" and "offline-triggered type" as an example, the rules for using priority parameters are as follows: First, the sorting method of the parameter fields is determined as follows: first, the task messages are sorted according to the task message type; then, for task messages with the same priority parameter, they are sorted according to the task message score. Next, the specific sorting method for each priority parameter corresponding to the task message type is determined as follows: task messages of "user-triggered type" are placed before task messages of "offline-triggered type," and the specific sorting method for each priority parameter corresponding to the task message score is determined as follows: sorted from largest to smallest. Step 620 includes:
[0253] Step 710: Sort the task messages in the relational database according to the task message type;
[0254] Step 720: For task messages of the same type, sort them according to their task message scores.
[0255] The following is a detailed description of steps 710-720 above.
[0256] In step 710, the task messages in the relational database can be sorted according to their task message type. Table 4 shows a message priority table that is not sorted according to the priority parameter rules. Following the priority parameter rules in the example above, the process of sorting the task messages in the relational database is as follows: First, sort the task messages according to their task message type, placing "user-triggered type" task messages before "offline-triggered type" task messages, resulting in the message priority table shown in Table 5.
[0257] ID Type Score Status Task Message 1 User trigger type 20014567 1 Mission Message 2 Offline trigger type 00622 1 Mission Message 3 Offline trigger type 10100 1 Mission Message 4 User trigger type 10001102 1
[0258] Table 4
[0259] ID Type Score Status Task Message 1 User trigger type 20014567 1 Mission Message 4 User trigger type 10001102 1 Mission Message 2 Offline trigger type 00622 1 Mission Message 3 Offline trigger type 10100 1
[0260] Table 5
[0261] In step 720, task messages of the same type are sorted according to their task message scores. Taking the message priority table shown in Table 5 above as an example, for task messages of the same type, the task messages are sorted according to their task message scores, from largest to smallest, to obtain the message priority table shown in Table 6.
[0262] ID Type Score Status Task Message 1 User trigger type 20014567 1 Mission Message 4 User trigger type 10001102 1 Mission Message 2 Offline trigger type 10622 1 Mission Message 3 Offline trigger type 00100 1
[0263] Table 6
[0264] Through steps 710 to 720, the task messages in the relational database are first sorted according to the task message type. Then, for task messages of the same type, they are sorted according to the task message score. This ensures that the task messages are first sorted according to the priority order that best matches the application scenario, and then sorted according to the secondary priority parameters. This allows the most important and urgent task messages in the current application scenario to be processed first, enabling the task message processing device to flexibly adapt to different business scenarios and maintain efficient and stable operation in different application scenarios.
[0265] The following is combined with Figure 8 Description as follows Figure 7 The process of determining the task message.
[0266] like Figure 8 As shown, the task message score can be determined in the following ways:
[0267] Step 810: Input the multiple preceding task messages, the task message, and the multiple subsequent task messages in the task message queue into the attention model to obtain the attention score of the task message.
[0268] Step 820: Identify multiple unprocessed task messages from multiple preceding task messages;
[0269] Step 830: Using the remaining time prediction model, predict the remaining processing time for each unprocessed task message;
[0270] Step 840: Determine the task message score based on the attention score and the remaining processing time for each unprocessed task message.
[0271] The following is a detailed description of steps 810-840 above.
[0272] In step 810, the task message queue is used to store and manage task messages belonging to the same business logic. Specifically, in the actual task message processing, a business requirement may be implemented through multiple tasks, and multiple tasks corresponding to a business requirement may be executed according to specific business logic. For multiple tasks belonging to the same business requirement, the business logic usually indicates the order of task execution or preconditions. Therefore, among multiple tasks belonging to the same business requirement, the task executed earlier will have a certain influence on the task executed later. The more preceding and subsequent tasks a task involves, the higher its importance; otherwise, the lower its importance. Therefore, the importance of a task message containing all the information required to execute the task can be determined based on the importance of the task.
[0273] Therefore, when determining the task message score, it is necessary to consider the influence of preceding task messages on the task message, as well as the influence of the task message on subsequent task messages. The degree of influence between task messages is represented by an attention score. The greater the influence of preceding task messages on the task message, and the greater the influence of the task message on subsequent task messages, the more important the task message is, and the higher its attention score. Conversely, the smaller the influence of preceding task messages on the task message, or the smaller the influence of the task message on subsequent task messages, the less important the task message is, and the lower its attention score.
[0274] Attention scores are obtained by inputting the task message, multiple preceding task messages before the task message, and multiple subsequent task messages after the task message into the attention model.
[0275] An attention model is a deep learning model that automatically learns the influence of preceding task messages on subsequent task messages, as well as the influence of each task message on subsequent task messages, thereby generating an attention score for each task message. Attention models are typically built on deep learning frameworks, such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), or Generative Adversarial Networks (GANs). An attention model consists of an input layer, an attention layer, and an output layer.
[0276] Specifically, the attention model first extracts the context information of each task message from the task message queue through the input layer. This context information includes multiple preceding task messages and multiple following task messages. This context information provides the attention model with rich background information, enabling it to more comprehensively evaluate the impact of preceding task messages on the executability of the task message, as well as the impact of the task message on the executability of subsequent task messages. Then, the task message and its context information are input into the attention layer. The attention layer learns the features of the task message and its context information through the attention mechanism and calculates the attention score for each task message. Finally, the output layer of the attention model outputs the attention score for each task message.
[0277] It should be noted that upon receiving a task message, the task message processing device stores the task message in the task message queue of its respective business logic. Since the task message queue stores multiple task messages and sorts them in a specific order, after retrieving a task message from the queue, multiple preceding task messages and multiple following task messages can be retrieved based on the task message's position within the queue. Preceding task messages refer to the task messages preceding the current task message in the task message queue. Following task messages refer to the task messages following the current task message in the task message queue. It should be noted that in this embodiment, the task message queue sorts the pending task messages according to their generation time.
[0278] Step 810 calculates the attention score for each task message based on an attention model, accurately assessing the degree of interaction between the task message and its preceding and subsequent task messages. This allows for the determination of the importance of task messages based on their mutual influence, thereby precisely evaluating their priority and achieving more efficient task scheduling and resource management. The method of determining task message scores based on attention scores ensures the efficient and stable operation of the task message processing device even when handling a large number of tasks with complex business logic.
[0279] In step 820, for a task, it is necessary to wait for its preceding tasks in the business logic to be processed before the task can be processed according to the task message. That is, the task message score of the task message is also related to the unprocessed preceding task messages in its task message queue. Therefore, multiple unprocessed task messages are identified from multiple preceding task messages. Unprocessed task messages refer to preceding task messages that have not been processed. Unprocessed task messages can be identified based on the status value of the task message, and the specific implementation method is described in detail below.
[0280] In step 830, a remaining time prediction model can be used to predict the remaining processing time for each unprocessed task message. The remaining time model is trained based on sample task messages and their processing times, and is used to predict the remaining processing time for unprocessed tasks. The remaining time prediction model can be constructed using deep learning models such as Multilayer Perceptron (MLP), Convolutional Neural Network (CNN), or Recurrent Neural Network (RNN). The data input to the remaining time model can include, but is not limited to, at least one of the following: task type, task data volume, task creation time, or task message status value. By extracting and analyzing features from the input data, the remaining time model can accurately predict the remaining processing time for unprocessed task messages. The shorter the remaining processing time for each unprocessed task message, the higher the task score for that message; otherwise, the task score is lower.
[0281] After predicting the remaining processing time for each unprocessed task message, step 840 determines the task message score based on two main factors: the attention score and the remaining processing time for each unprocessed task message. The attention score reflects the relative importance of the task message in the queue, while the remaining processing time reflects the shortest waiting time required for a task message to be processed. Therefore, by determining the task message score based on the attention score and the remaining processing time for each unprocessed task message, it is ensured that the priority of task messages is not only based on their inherent importance but also considers the actual processing progress of the task messages, thereby improving the rationality of task scheduling.
[0282] Through steps 810-840, the embodiments of this application first input multiple preceding task messages, the task message itself, and multiple subsequent task messages in the task message queue into an attention model to obtain the attention score of the task message. Then, from the multiple preceding task messages, multiple unprocessed task messages are identified, and a remaining time prediction model is used to predict the remaining processing time corresponding to each unprocessed task message. Finally, based on the attention score and the remaining processing time corresponding to each unprocessed task message, the task message score is determined. This approach ensures that the priority of a task message is not solely based on its inherent importance, and by determining the task message score based on the remaining processing time corresponding to each unprocessed task message, the actual processing progress of the task messages is taken into account, thereby improving the rationality of task scheduling.
[0283] The following is combined with Figure 9 Step 840 will be further explained.
[0284] like Figure 9 As shown, step 840 includes:
[0285] Step 910: For each unprocessed task message, use the correlation prediction model to predict the first correlation between the unprocessed task message and the task message.
[0286] Step 920: Based on the first correlation degree, the remaining processing time corresponding to each unprocessed task message is weighted and summed to obtain the time weighted sum;
[0287] Step 930: Determine the task message score based on the attention score and the time-weighted sum.
[0288] The following is a detailed description of steps 910-930 above.
[0289] In step 910, for task messages, the greater the correlation between an unprocessed task message and a task message, the greater the impact of the remaining processing time of the unprocessed task message on the processing progress of the task message. Conversely, the smaller the correlation between an unprocessed task message and a task message, the smaller the impact of the remaining processing time of the unprocessed task message on the processing progress of the task message. Therefore, for unprocessed task messages and task messages with a higher degree of correlation, the task message processing device may prioritize processing this task message after processing the unprocessed task message. If an unprocessed task message has a low degree of correlation with the current task message, the task message processing device may appropriately lower its priority to ensure that tasks with the same business requirements can enter the processing stage in a concentrated manner, thereby saving the overhead of context switching in the task message processing device and optimizing resource allocation. Based on this, for each unprocessed task message, a correlation prediction model is needed to predict the degree of correlation between the unprocessed task message and the task message to obtain the first correlation degree. The correlation prediction model is a machine learning or deep learning-based model that evaluates the correlation between task messages and unprocessed task messages based on various features such as task type, task content, user ID, and task creation time. The first correlation score is a value between 0 and 1; the closer the first correlation score is to 1, the stronger the correlation between the task message and the unprocessed task message; conversely, the closer it is to 1, the weaker the correlation.
[0290] In step 920, the remaining processing times corresponding to each unprocessed task message can be weighted and summed based on the first correlation degree to obtain a weighted sum of processing times. Specifically, firstly, for each unprocessed task message, the remaining processing time corresponding to the unprocessed task message is multiplied by the first correlation degree to obtain a weighted processing time. Then, the weighted processing times of each unprocessed task message are added together to obtain a weighted sum of processing times. Therefore, by using the weighted sum of processing times, task messages can be processed immediately after the last unprocessed task message is processed, thereby saving the overhead of context switching in the task message processing device. The smaller the weighted sum of processing times, the shorter the time that the task message needs to wait for unprocessed task messages, that is, the higher the processing priority of the task message.
[0291] After calculating the duration-weighted sum of the task messages, in step 930, the task message score can be determined based on the attention score and the duration-weighted sum. Specifically, the task message score can be determined by weighted addition of the attention score and the duration-weighted sum, or by multiplication of the attention score and the duration-weighted sum.
[0292] Steps 910-930 firstly, for each unprocessed task message, a correlation prediction model is used to predict the first correlation between the unprocessed task message and the task message. Based on the first correlation, the remaining processing time corresponding to each unprocessed task message is weighted and summed to obtain a time-weighted sum. This allows for a more accurate assessment of the processing order of task messages by utilizing the correlation between unprocessed task messages and task messages. Therefore, based on the attention score and the time-weighted sum, a task message score is determined. This allows for further determination of task message processing priorities based on the actual processing progress of task messages, thereby improving the rationality of task scheduling.
[0293] In another embodiment, because the attention score and the duration-weighted sum are on different orders of magnitude, directly performing mathematical operations on the attention score and the duration-weighted sum may lead to differences in the degree of influence of these two factors on the task message score, resulting in a low rationality in the priority allocation of task messages. Therefore, it is necessary to first unify the orders of magnitude of the attention score and the duration-weighted sum before calculating the multi-functional task message score.
[0294] like Figure 10 As shown, in this embodiment, step 930 includes:
[0295] Step 1010: Based on the attention score, calculate the first sub-score, which is an increasing function of the attention score;
[0296] Step 1020: Calculate the second sub-fraction based on the duration-weighted sum. The second sub-fraction is a decreasing function of the duration-weighted sum.
[0297] Step 1030: Calculate the task message score based on the first sub-score and the second sub-score.
[0298] The following is a detailed description of steps 1010-1030 above.
[0299] In step 1010, the first sub-score of the attention score is calculated based on an increasing function. An increasing function is a mathematical function whose output value increases as the input value increases. The increasing function can be linear or non-linear. The attention score serves as the input value to the increasing function, and the first sub-score serves as its output value. Therefore, the higher the attention score, the higher the first sub-score. Calculating the first sub-score based on the increasing function ensures that high-importance task messages receive higher first sub-scores, thus occupying a higher position in the final priority ranking.
[0300] For example, if the attention score of task message C is 0.8 and the constant factor is 12, then its first sub-score will be 0.8 multiplied by 12, which is 9.6. If the attention score of task message D is 0.5, then its first sub-score will be 0.5 multiplied by 12, which is 6.
[0301] In step 1020, the second sub-score of the duration-weighted sum is calculated based on a decreasing function. Unlike an increasing function, the output value of a decreasing function decreases as the input value increases. The decreasing function can be linear or non-linear. Using the duration-weighted sum as the input value of the decreasing function and the second sub-score as the output value of the increasing function, the higher the duration-weighted sum, the lower the second sub-score. Calculating the second sub-score based on the duration-weighted sum using a decreasing function ensures that task messages with smaller duration-weighted sums receive higher second sub-scores, thus occupying a higher position in the final priority ranking.
[0302] Taking a linear function as a subtractive function as an example, the second sub-fraction can be calculated as follows: First, calculate the product of the duration-weighted sum and the constant factor. Then, subtract the product from the constant to obtain the second sub-fraction. For example, if the duration-weighted sum of task message C is 10, the constant is 10, and the constant factor is 0.5, then the second sub-fraction will be 10 - 10 * 0.5 = 5. If the duration-weighted sum of task message D is 5, then its second sub-fraction will be 10 - 5 * 0.5 = 7.5.
[0303] It is important to note that the first sub-score, calculated using the increasing function, and the second sub-score, calculated using the decreasing function, should be of the same or similar order of magnitude to balance their impact on the task message score. Taking task messages C and D as examples, the values of both the first and second sub-scores are limited to between 0 and 10 to ensure that their respective impacts on the task message score are not significantly different.
[0304] In another embodiment, the ranges of the first subfraction and the second subfraction do not have to be exactly the same. For example, the range of the first subfraction is limited to 0 to 10, and the range of the second subfraction is limited to 1 to 21.
[0305] In step 1030, the task message score can be calculated based on the first sub-score and the second sub-score. The specific calculation method for the task message score can be either addition or multiplication of the first and second sub-scores. Taking task messages C and D as examples, if the first and second sub-scores are added, the task message score for task message C is 14.6, and the task message score for task message D is 13.5.
[0306] Through steps 1010-1030, a first sub-score (an increasing function of the attention score) is calculated based on the attention score, and a second sub-score (a decreasing function of the duration-weighted sum) is calculated based on the duration-weighted sum. The task message score is then calculated based on both the first and second sub-scores. By converting the attention score and duration-weighted sum to the same order of magnitude using the first and second sub-scores, the impact of these two factors on the task message score is balanced, improving the rationality of task message processing. Furthermore, by converting the attention score (positively correlated with importance) using an increasing function and the duration-weighted sum (negatively correlated with importance) using a decreasing function, both the first and second sub-scores are positively correlated with the importance of the task message, thus ensuring that the task message score effectively reflects the importance of the task message.
[0307] In one embodiment, the importance of a task message also needs to be determined by the correlation between subsequent task messages and the task messages themselves, in order to improve the rationality of task scheduling. For example... Figure 11 As shown, in this embodiment, step 840 further includes:
[0308] Step 1110: Using the correlation prediction model, predict the second correlation between each subsequent task message and the task message;
[0309] Step 1120: Calculate the average correlation degree based on the second correlation degree between each subsequent task message and the task message;
[0310] Step 1130: Determine the task message score based on the attention score, the remaining processing time for each unprocessed task message, and the average relevance.
[0311] The following is a detailed description of steps 1110-1130 above.
[0312] In step 1110, since the importance of a task message is also related to subsequent task messages, a correlation prediction model is needed to predict the second correlation between each subsequent task message and the task message. Similar to the first correlation, the second correlation is also a value between 0 and 1, representing the strength of the correlation between the subsequent task message and the task message. The closer the second correlation is to 1, the stronger the correlation between the subsequent task message and the task message; conversely, the weaker the correlation, the lower the correlation. The correlation prediction model in step 1110 is similar to the correlation prediction model in step 910; refer to the specific implementation of step 910, and it will not be described again in this application.
[0313] In step 1120, after determining the second correlation degree between each subsequent task message and the task message, it is necessary to calculate the average correlation degree based on the second correlation degree between each subsequent task message and the task message. The average correlation degree is used to measure the overall importance of the task message to each subsequent task message. Specifically, the average correlation degree is obtained by averaging the values of each second correlation degree. A higher average correlation degree indicates a higher importance of the task message, and vice versa.
[0314] In step 1130, the task message score can be determined based on the attention score, the remaining processing time for each unprocessed task message, and the average relevance. Specifically, firstly, the remaining processing time for each unprocessed task message is weighted and summed to obtain a time-weighted sum. Then, a third sub-score of the attention score is calculated using an increasing function, a fourth sub-score of the average relevance is calculated using an increasing function, and a fifth sub-score of the time-weighted sum is calculated using a decreasing function. The third, fourth, and fifth sub-scores are of the same order of magnitude. Finally, the third, fourth, and fifth sub-scores are added together to obtain the task message score.
[0315] Through steps 1110-1130, the correlation prediction model can be used to predict the second correlation between each subsequent task message and the task message. Based on the second correlation between each subsequent task message and the task message, the average correlation is calculated to determine the importance of each task message to each subsequent task message. Then, based on the attention score, the remaining processing time for each unprocessed task message, and the average correlation, the task message score is comprehensively determined from three aspects: the importance of the task message itself, the importance of the task message to subsequent task messages, and the processing progress of the task message. Therefore, the task message priority ranking determined based on the task message score can more accurately assess the priority of each task message, thereby achieving more efficient task scheduling and resource management.
[0316] The following is combined with Figure 12 Description as follows Figure 7 The process for determining task message types is shown. Task message types describe whether a task message is triggered by a user or automatically generated by the platform. Task message types include user-triggered types and offline-triggered types. User-triggered types indicate that the task message is triggered by the user through the terminal's task controls, while offline-triggered types indicate that the task message is generated offline by the platform through platform programs.
[0317] like Figure 12 As shown, the task message type is obtained through the following process:
[0318] Step 1210: If the task message is generated by the user in response to a task triggering control, determine that the task message type is user-triggered type;
[0319] Step 1220: If the task message is generated offline by the task message processing platform through the platform program, determine that the task message type is an offline triggered type.
[0320] The following is a detailed description of steps 1210-1220 above.
[0321] In step 1210, a task control typically refers to an interactive element set in the terminal user interface, such as a button, link, or other operable control, through which the user can initiate a specific task. For example, in a shopping platform, a user might generate an order creation task message by clicking the "Submit Order" button, or generate an order goods verification task message by clicking the "Receipt Verification" button.
[0322] Specifically, when a task message is detected to have been generated by a user through a task control, the task message processing device determines that the task message type is user-triggered. User-triggered task messages typically have higher priority because they directly reflect the user's real-time needs and operational intentions, and usually need to be processed as quickly as possible to ensure that the user receives timely response and service. For example, a user may be waiting for the result of a session task or to receive a new session; therefore, task messages related to user operations should be prioritized to improve the user's session experience.
[0323] In step 1220, the platform program refers to the background software component running on the task message processing platform. It typically runs in the background, executing various automated tasks without requiring direct user interaction. The main functions of the platform program include generating offline task messages, as well as scheduling and managing these messages, ensuring that they are processed correctly according to predetermined priority parameters, usage rules, and business logic. Offline task messages are usually generated by the platform program based on preset rules or scheduled tasks, rather than being triggered by the user in real time. Offline task messages can be data backup task messages, batch processing task messages, or periodic maintenance task messages, etc.
[0324] Taking a document library as an example, data backup task messages are typically used to back up all document data in the library, including document content, user information, and document version history. The trigger condition could be: automatically triggered at 2 AM every day. Batch processing task messages can be used for batch updating document metadata, batch converting document formats, and batch updating document recommendation data. The trigger condition could be: automatically triggered at 10 PM every night. Regular maintenance task messages are used to periodically check the system status of the document library and perform maintenance operations, such as cleaning up temporary files and optimizing database performance. The trigger condition could be: automatically triggered on the first day of each month.
[0325] When a task message is detected to be generated offline by a platform program, the task message processing device will classify it as an offline-triggered type. Since offline-triggered task messages are not triggered in real time by the user, but rather generated by the platform program according to preset plans or conditions, their priority is usually low. These types of task messages are typically processed when resources allow, rather than requiring an immediate response. For example, a data backup task does not need to be executed immediately, but can be processed when the load is low.
[0326] Through steps 1210-1220, when a task message is generated by a user-triggered task control, the task message type is determined to be a user-triggered type; when a task message is generated offline by the task message processing platform through a platform program, the task message type is determined to be an offline-triggered type. This allows for accurate determination of the type of each task message based on its source and triggering method. Based on this, task messages are prioritized according to their type. For example, user-triggered task messages are processed first, as they are usually related to the user's immediate needs, while offline-triggered task messages can be processed when resources allow. This ensures reasonable resource allocation for different task messages, prioritizing tasks that have a greater impact on user experience and business processes, thereby improving the overall efficiency and response speed of the task message processing method.
[0327] In one embodiment, factors such as system response latency, user operating habits, or unstable network connections may cause users to repeatedly trigger task controls, resulting in the terminal generating multiple identical or similar task messages. If the task processing device processes multiple identical or similar task messages, it can lead to potential errors such as task conflicts and resource waste. Therefore, it is necessary to prevent the terminal from generating multiple identical or similar task messages when users repeatedly trigger task controls. Figure 13 As shown, in this embodiment, step 1210 includes:
[0328] Step 1310: In response to triggering the task control, if the triggering of the task control is the first time the user has triggered it, generate a task message and determine that the task message type is the user-triggered type;
[0329] Step 1320: If the task control is not triggered for the first time by the user, refuse to generate a task message.
[0330] The following is a detailed description of steps 1310-1320 above.
[0331] In step 1310, in response to the user triggering the task control, an initial trigger determination is performed on the task control. The advantage of this is that immediately performing the initial trigger determination when the user triggers the task control prevents the generation of multiple identical or similar task messages, thereby minimizing the overhead of repeatedly generating and processing the same or similar task messages and avoiding potential errors. If the initial trigger determination result indicates that "the triggering of the task control is the user's first trigger," a task message is generated, and the task message type is determined to be a user-triggered type. Specifically, the initial trigger determination of the task control can be performed using methods such as control status identifiers, control trigger records, or token mechanisms.
[0332] Taking control status indicators as an example, control status indicators are used to identify whether a task control has been triggered. Therefore, when a user triggers a task control, the initial trigger determination can be made by querying the control status indicator of the task control. If the control status indicator indicates that the task control has not been triggered, a task message is generated, the task message type is determined to be a user-triggered type, and the control status indicator is modified to indicate that the task control has been triggered.
[0333] Taking control trigger records as an example, when a user triggers a task control, the system checks the task control's control trigger records to determine if it's the first trigger. If no control trigger record is found, it indicates that the task control is being triggered for the first time. A task message is then generated, the message type is determined to be user-triggered, and the task control's control trigger record is generated.
[0334] Taking the token mechanism as an example, when a user triggers a task control, the system checks the validity of the task control's token to determine the initial trigger. When a user triggers a task control for the first time, the terminal sends a unique token to the user and verifies its validity in subsequent trigger events. If the task control's token is valid, it means the task control has not been triggered before. A task message can be generated, the message type is determined to be user-triggered, and the token's status is changed to invalid.
[0335] In step 1320, if the result of the first trigger determination of the task control indicates that the trigger of the task control is not the first time triggered by the user, then the task message is not generated.
[0336] Taking the above control trigger record as an example, if the control status indicator shows that the task control has been triggered, then the task message will not be generated.
[0337] Taking the above control trigger record as an example, if the control trigger record of the task control is found, it means that the task control is not being triggered for the first time, and the task message will not be generated.
[0338] Taking the token mechanism mentioned above as an example, if the token of the task control becomes invalid, it means that the task control has already been triggered, and the task message will not be generated.
[0339] Through steps 1310-1320, in response to triggering the task control, an initial trigger check is performed on the task control. This allows for the generation of a task message when the task control is first triggered by the user, and the task message type is determined to be a user-triggered type for processing. Furthermore, if the user has already triggered the task control, the generation of a new task message is refused. Therefore, performing an initial trigger check on the task control prevents the repeated generation and processing of multiple identical or similar task messages caused by repeated user triggering of the task control, thus avoiding resource waste and potential errors. For example, if a user has already submitted an order, clicking the "Submit Order" button again will not generate a new order creation task message; instead, it may display a notification that the order has been successfully submitted.
[0340] In one embodiment, task message processing involves a multi-user collaboration scenario where multiple users need to work together to complete a task, but only one user can trigger a specific task control. For example, in an online examination system, candidates are tested in groups, and each group can only trigger the answer submission button once to submit their answers. In this case, since the task control can only be triggered by one user in the user group, it is necessary to identify the user group to which the user triggering the task control belongs and manage the task control triggering permissions for each user in the user group to ensure that the triggering operation of the task control conforms to the business logic. Figure 14 As shown, in step 1310 of this embodiment, the process of obtaining the task message type further includes:
[0341] Step 1410: Identify the user group to which the user belongs;
[0342] Step 1420: Block other users in the user group from triggering the task control.
[0343] The following is a detailed description of steps 1410-1420 above.
[0344] In step 1410, the terminal identifies the user group to which the user who triggered the task control belongs. A user group is a mechanism for classifying users according to specific criteria. These criteria may include, but are not limited to, at least one of the following: user permissions, department affiliation, family members, or projects the user participates in. Specifically, a user group can be identified in the following ways: by pre-storing the user's identity information in the user group's member information to associate the user with the user group, and then, in response to the user's first triggering of the task control, searching for the user's identity information in the member information of each user group to determine the user group. Alternatively, a user group can be identified in the following ways: by pre-storing a user group identifier in the user information, and then, in response to the user's first triggering of the task control, searching for the user group identifier in the user information to determine the user group.
[0345] After identifying the user group to which the user belongs, step 1420 blocks other users in the user group from triggering the task control. Specifically, first, the information of other users in the user group is searched to identify them, and then the permissions of other users to trigger the task control are restricted, thereby blocking other users in the user group from triggering the task control.
[0346] Steps 1410-1420 identify the user group to which the user belongs and block other users in the user group from triggering the task control, ensuring that only one user in the same user group can trigger the task control. This avoids the repeated generation of duplicate task messages, improves the efficiency of task message generation and management, optimizes resource allocation, and enhances the efficiency of task message processing.
[0347] In one embodiment, because the task message processing device continuously receives new task messages, it re-sorts and filters the newly received task messages against the existing ones each time it queries multiple task messages whose priority parameters meet the priority filtering conditions. If task messages are sorted solely based on priority parameters and the query starts from the first row of the message priority table, lower-priority task messages will remain unqueried and unprocessed for a long time as high-priority new task messages are continuously added, ultimately leading to inefficient task message processing. To solve this problem, it is necessary to periodically move the lower-priority task messages to the front of the list. For example... Figure 15 As shown, in this embodiment, after step 620, the task message processing method further includes:
[0348] Step 621: Periodically bucket the task messages according to their position in the sorting;
[0349] Step 622: For each task message, if the task messages are all in the same bucket in a consecutive predetermined number of periods, and the position index of the bucket in the multiple buckets satisfies the predetermined position condition, then sort and move the task messages forward.
[0350] The following is a detailed description of steps 621-622 above.
[0351] In step 621, bucketing refers to the technique of dividing task messages into discrete intervals according to preset bucketing rules, where each discrete interval is called a bucket. Specifically, the bucketing rules can be: first, divide the total number of task messages by the preset number of buckets to obtain the number of task messages in each bucket; then, starting from the first task message in the message priority table, divide each task message into different buckets based on the number of task messages in each bucket. Alternatively, the bucketing rules can be: first, determine the number of task messages in each bucket; then, divide the total number of task messages by the number of task messages in each bucket to obtain the number of buckets; finally, starting from the first task message in the message priority table, divide each task message into different buckets based on the number of task messages in each bucket.
[0352] Based on this, task messages are periodically bucketed according to their position in the sorting algorithm. This allows for the determination of whether a task message has a low priority and cannot be queried or processed for a long time, based on the bucket it occupies in different periods. The bucketing period for task messages can be set to once every minute, once every hour, or other specific values determined by those skilled in the art based on their actual needs.
[0353] In step 622, for each task message, if the task messages are all in the same bucket for a predetermined number of consecutive periods, and the position index of the bucket within the multiple buckets satisfies a predetermined position condition, the sorting of the task messages can be further optimized by prioritizing them to balance the processing efficiency and response speed of task messages with different priorities. Specifically, firstly, for each period, the bucket containing the task message and the position index of the bucket within the multiple buckets are obtained, and the task message, period, and bucket position index are stored in a relational database. Then, for a predetermined number of consecutive periods, the position index of the bucket corresponding to the task message in the predetermined number of periods is called. If the position indices of the corresponding buckets in the predetermined number of periods are the same, it is determined whether the position index satisfies the predetermined position condition. If the position index satisfies the predetermined position condition, the task message is prioritized. The predetermined number of periods can be 3 periods, or it can be set to other specific values according to the needs of those skilled in the art.
[0354] Since task messages are divided into different buckets based on priority, each bucket is also sorted according to priority to reflect the priority order of the task messages. After sorting all buckets, the relative position of each bucket in the sort is the position index of that bucket. The predetermined position condition means that the position index of the bucket is within a preset index range. The index range can be: the preset number of position indices in the sorting of all buckets, where the preset number of position indices can be any integer less than or equal to the number of buckets.
[0355] For example, if there are 6 buckets and the bucket position index starts from 0 and is allocated to the 6 buckets, and task message E is evenly distributed in the 5th bucket with position index 4 in 5 consecutive cycles, the predetermined position condition is "the bucket position index is the 3rd to 5th position index". Therefore, the position index of the 5th bucket meets the predetermined position condition, and task message E needs to be sorted and moved forward.
[0356] Steps 621-622 first involve periodically bucketing task messages based on their position in the priority ranking. Then, after bucketing the task messages for a predetermined number of consecutive periods, for each task message, the bucket it belongs to and its position index within those periods are retrieved, and it is determined whether the bucket's position index within the multiple buckets satisfies a predetermined position condition. If, for a predetermined number of consecutive periods, the task messages are all in the same bucket, and the bucket's position index within the multiple buckets satisfies the predetermined position condition, the task message is moved forward in the priority ranking. Therefore, by analyzing the changes in the task message's position in the priority ranking, it is possible to accurately determine whether low-priority task messages have been unprocessed for a long time, and thus dynamically adjust the ranking of low-priority task messages. This ensures that task messages that consistently exhibit low priority are processed more quickly, thereby improving the rationality of task message processing and optimizing its efficiency and response speed.
[0357] like Figure 16 As shown, step 622 includes:
[0358] Step 1610: Based on the position index of the bucket in the multiple buckets, determine the displacement amount, which is an increasing function of the position index;
[0359] Step 1620: Based on the displacement, sort and move the task messages forward.
[0360] The following is a detailed description of steps 1610-1620 above.
[0361] In step 1610, the displacement refers to the change in sorting of the task message by moving it forward, and is a positive integer less than the task message's sorting position. The displacement can be determined based on the position index and the task message's sorting position, and is an increasing function of the position index. This increasing function can be linear or non-linear. The position index is the input of the increasing function, and the displacement is the output. Therefore, the larger the position index, the larger the displacement. By calculating the displacement using an increasing function, task messages that are later in the sorting can be moved to earlier positions, thus improving the processing efficiency of low-priority task messages. Taking task message E as an example, its sorting position is 49. The increasing function can be the product of the number of cycles the task message is in the same bucket and the bucket's position index. Therefore, the displacement for task message E is 4 * 5 = 20. Taking task message F as an example, its sorting position is 52. Task message F is evenly distributed in the 6th bucket with a position index of 5 for 6 consecutive cycles. Therefore, the displacement for task message E is 5 * 6 = 30.
[0362] After determining the displacement of the task messages, in step 1620, the task messages are sorted and moved forward based on the displacement. Specifically, taking task message E as an example, after sorting and moving task message E forward based on the displacement, the task message sorting position of task message E is 29. Taking task message F as an example, after sorting and moving task message F forward based on the displacement, the task message sorting position of task message F is 22.
[0363] Steps 1610-1620 use the position index of the bucket within the multiple buckets as input to an increasing function to determine the displacement. Based on this displacement, the task messages are sorted and moved forward. This allows task messages with consistently low priority over multiple cycles to receive larger displacements and move further forward in the sorting, thus entering the processing stage faster. Therefore, the sorting of low-priority task messages can be dynamically adjusted, ensuring that those consistently low-priority task messages are processed more quickly and in a timely manner.
[0364] like Figure 17 As shown, after step 630, the task message processing method further includes:
[0365] Step 631: In response to the blocking queue not being full again, determine the number of task messages that the blocking queue can still hold, and use it as the second number;
[0366] Step 632: Among the task messages whose priority parameters meet the priority filtering conditions, select the second number of task messages after the first number of task messages as the queried task messages.
[0367] The following is a detailed description of steps 631-632 above.
[0368] In step 631, determining the second number only in response to the blocking queue not being full again has the advantage of ensuring that all task messages queried in the first round are submitted to the blocking queue, thus guaranteeing that task messages are processed according to priority and improving the task processing efficiency of the task message processing device. Specifically, after all the first number of task messages have been submitted to the blocking queue, the scheduling service thread will query the task messages in the next round in response to the blocking queue not being full again. The specific implementation of determining the number of task messages that the blocking queue can still hold as the second number is similar to the method of determining the first number, the only difference being that the second number and the first number belong to different rounds of task message querying. Referring to step 610, this application will not repeat the details.
[0369] After determining the second number, in step 632, from the task messages whose priority parameters satisfy the priority filtering conditions, the second number of task messages ranked after the first number of task messages can be selected as the queried task messages. The specific implementation method of querying task messages in step 632 is similar to the specific implementation method of step 630, the only difference being the number of queried task messages. Refer to the specific implementation method of step 630 for details.
[0370] In steps 631-632, in response to the blocking queue not being full again, the number of task messages that the blocking queue can still hold is determined as the second number. Furthermore, among the task messages whose priority parameters meet the priority filtering conditions, the second number of task messages after the first number of task messages are selected as the queried task messages. Through multiple rounds of querying and filling the blocking queue, all task messages whose priority parameters meet the priority filtering conditions are processed sequentially according to the priority order determined by the rules of the task message priority parameters, thereby ensuring that the processing of task messages meets the priority scheduling requirements specific to the application scenario.
[0371] Detailed description of step 450
[0372] In step 450, the retrieved task messages are used to fill the blocking queue until it is full. Specifically, task messages are added to the blocking queue one by one, based on the number of free elements. By determining whether the blocking queue is not full and obtaining the number of free elements, the number of task messages corresponding to the number of free elements can be added to the blocking queue. This ensures that the maximum number of task messages are added to the blocking queue at a time, while also preventing excessive resource usage through the blocking mechanism, thereby improving the overall performance and stability of the task message processing device. Furthermore, since task messages are retrieved based on multiple priority parameters that satisfy the priority filtering conditions, the order in which task messages are added to the blocking queue is also determined by these priority parameters, ensuring that task messages are processed according to their priority order.
[0373] In one embodiment, due to changes in priority filtering conditions, specific periods, or the high priority of the task message, the scheduling service thread may re-query the task message that has already been filled into the blocking queue and re-fill it into the blocking queue. This causes the task message processing device to process the same task message repeatedly, resulting in wasted resources and low task processing efficiency and quality. To solve this problem, task messages need to be marked differently before and after being filled into the blocking queue, and the task message should be queried based on the markings before being filled into the blocking queue to ensure that the task message is filled into the blocking queue only once.
[0374] like Figure 18 As shown, in this embodiment, after step 420, the task message processing method further includes:
[0375] Step 421: Set the status value of the task message in the relational database to the first value;
[0376] Step 440 also includes:
[0377] Step 441: In response to the blocking queue not being full, filter out task messages with the first status value from the relational database;
[0378] Step 442: From the filtered task messages, query task messages with multiple priority parameters that meet the priority filtering conditions.
[0379] The following is a detailed description of steps 421 and 441-442 above.
[0380] In step 421, the status value of the task message is a field used to identify the stage or status of the task message during processing. The status value can have multiple possible values, each representing a different state of the task message. The status value can be a string, a number, or other format. For example, if the status value is a string, its specific values could be "Pending," "Processing," "Completed," or "Failed," etc. If the status value is a number, it could be "001," "002," "003," or "004," where "001" corresponds to the "Pending" status, "002" to the "Processing" status, "003" to the "Completed" status, and "004" to the "Failed" status.
[0381] The first value is a specific value for the status value, indicating that the task message and multiple priority parameters have been stored in the relational database, awaiting querying and being added to the blocking queue. In other words, the task message is processable but has not yet been processed. Specifically, the first value can be "1" or "stored in the relational database". Based on this, when the task message processing device needs to filter out processable but unprocessed task messages from the relational database, it will look for task messages with the first value. This prevents task messages with unacquired priority parameters, those currently being processed, or those already processed from being added to the blocking queue, thereby improving the efficiency and accuracy of task message processing.
[0382] It's important to note that setting the status value of a task message to the first value is typically done when storing the task message and multiple priority parameters in a relational database. Alternatively, before querying task messages whose priority parameters meet past priority conditions, the status values of all task messages can be uniformly set to the first value in batches, based on a specific first value setting period. Setting the status value of a task message to the first value usually involves updating the relational database, and the specific update operation is implemented using database update statements.
[0383] If the priority parameter usage rule is: construct a composite index based on multiple priority parameters, and sort the task messages based on the composite index, then the structure of the composite index can be: "task message type + task message score + task message status value".
[0384] In step 441, in response to the blocking queue not being full, task messages with the first status value are filtered from the relational database;
[0385] When the blocking queue is not full, it indicates that the current blocking queue has available processing capacity and can receive more task messages waiting for processing threads to process. At this time, a query operation is triggered to filter task messages based on their status values. Specifically, this query operation will look for task messages whose status value is set to the first value, which are processable and have not yet been processed. This avoids unnecessary processing of task messages that do not meet the processing conditions or have already been processed, thereby improving the efficiency and accuracy of task message processing.
[0386] In step 442, task messages with multiple priority parameters that satisfy the priority filtering conditions can be queried from the filtered task messages. The specific implementation for querying task messages with multiple priority parameters satisfying the priority filtering conditions is similar to the specific implementation of step 440 described above, except that in step 442, the query operation is performed on task messages whose status value is the first value, rather than task messages with unlimited status values. Therefore, the specific implementation of step 442 can be referred to the specific implementation of step 440 described above, and will not be repeated here.
[0387] Through steps 421 and 441-442, after storing the task messages and multiple priority parameters in the relational database, the status value of the task messages in the relational database is set to the first value. Then, in response to the blocking queue not being full, task messages with the first status value are filtered from the relational database, and task messages whose multiple priority parameters meet the priority filtering conditions are queried from the filtered task messages. Therefore, by setting the status value of the task message to the first value, it is convenient to query and process task messages according to their status, ensuring that each task message is filled into the blocking queue only once, thus improving the efficiency of the task message processing method.
[0388] like Figure 19 As shown, in this embodiment, after step 450, the task message processing method further includes:
[0389] Step 451: In the relational database, change the status value of the retrieved task message from the first value to the second value.
[0390] The following is a detailed description of step 451 above.
[0391] In step 451, to prevent the scheduling service thread from repeatedly filling the blocking queue with the same task message, the status value of the task message needs to be changed. Specifically, after filling the blocking queue with the queried task message, the status value of the task message can be changed from a first value to a second value. The second value indicates that the task message is in the following process: the message queue has been filled into the blocking queue and has been retrieved from the blocking queue for processing, that is, the task message is being processed. The value of the second value can be "2" or "processing". Based on this, the task message processing device can distinguish whether the task message has not been processed by the status value of the task message, and find the required task message only based on the status value of the task message, thereby performing task scheduling more accurately and efficiently.
[0392] Modifying state values also involves updating relational databases, specifically through database update statements. This operation needs to ensure data consistency and integrity, so transaction processing is typically used to guarantee the reliability of the update operation.
[0393] Detailed description of step 460
[0394] In step 460, when a processing thread finishes processing a message, it checks the blocking queue. If the blocking queue is not empty, it retrieves the task message at the top of the queue for processing. Therefore, the advantage of step 460 is that by efficiently and orderly retrieving and processing task messages from the blocking queue, it leverages the characteristics of the blocking queue to ensure that processing threads process messages according to the order they were added to the queue. This prioritizes task messages, improving the overall efficiency of the task message processing device and ensuring that the most important tasks are processed first when resources are limited.
[0395] In one embodiment, a processing thread can continuously request and check the status of the blocked queue according to a preset queue status acquisition period. Once a usable task message is found in the blocked queue, the processing thread will immediately retrieve the task message and execute the corresponding processing logic. The queue status acquisition period can be 1 minute or other specific values. The advantage of this approach is that it ensures the processing thread is aware of the latest status of the blocked queue in a timely manner. This method of the processing thread actively checking the blocked queue status ensures that it will not miss any processable task messages, thereby improving the timeliness and efficiency of task processing. For example, when the queue status acquisition period is set to 1 minute, the processing thread will check the blocked queue every minute, and once a usable task message is found in the queue, it will immediately execute the corresponding processing logic. Such a periodic checking mechanism can, to a certain extent, ensure that task messages do not wait in the queue for a long time, thereby speeding up task processing.
[0396] Furthermore, the flexibility of the queue status acquisition period provides better adaptability for task message processing methods. This allows the task message processing device to set different specific values for the queue status acquisition period based on actual business needs and load conditions, thereby enabling a better balance between the timeliness of task processing and resource utilization efficiency. Specifically, in scenarios with a large task volume and high real-time requirements, the period can be set to a smaller value, such as 1 second, for rapid response to task messages; while in scenarios with a lighter task volume and lower real-time requirements, the period can be set to a larger value, such as 30 minutes, to reduce resource consumption.
[0397] In another embodiment, when the blocking queue is not empty, or when new task messages are added to the blocking queue, the blocking queue can proactively push the pending information of task messages to the processing thread, notifying the processing thread to retrieve task messages from the blocking queue. This approach eliminates the need for the processing thread to frequently poll the blocking queue, thereby reducing unnecessary resource consumption and thread switching overhead. When there are new task messages in the blocking queue, the processing thread can be immediately notified and retrieve the task messages from the queue for processing, ensuring that task messages are processed in a timely manner and further improving the overall performance of the task message processing device.
[0398] In another embodiment, the two methods described above can be combined. When the blocking queue is not empty or when new task messages are added to the blocking queue, the blocking queue actively sends task message information to the processing thread for processing. When the processing thread is idle, it periodically polls the blocking queue based on the queue status. Combining these two methods ensures that the processing thread processes task messages in a timely manner while avoiding resource waste caused by frequent polling, further improving task processing efficiency and response speed.
[0399] Upon receiving a task message, the task thread processes it immediately. The processing procedure depends on the message type and business requirements. For example, in an order processing scenario on a shopping platform, the task message retrieved by the consumer thread might contain detailed order information, such as the order number, user ID, and quantity of goods. The processing thread will then perform operations such as verifying order information, checking inventory, and updating order status based on the order message information and business requirements. During task message processing, the consumer thread strictly adheres to the priority order of the task messages.
[0400] Due to issues such as system crashes, network timeouts, database connection failures, or improper retry mechanism configurations, the task message processing device may repeatedly receive previously processed task messages. If the status value is set to a first or second value solely based on whether the task message has been filled into the blocking queue, the device cannot determine whether the task message has been processed completely, potentially leading to duplicate processing of re-received messages. Therefore, once the processing thread finishes processing a task message, the result needs to be recorded, and the task message's status value updated. For example, in an order processing scenario, if the order is successfully processed, the task message processing device updates the order status (i.e., the task message's status value) to "completed" and stores the corresponding task message and updated order status in the relational database. If processing fails, error information is recorded, and retrying or notifying relevant personnel for intervention is initiated as needed. This approach ensures that the processing result of each task message is properly recorded and processed, providing support for subsequent business operations and data analysis.
[0401] like Figure 20 As shown, after step 460, the task message processing method further includes:
[0402] Step 461: In the relational database, change the status value of the retrieved task message from the second value to the third value.
[0403] The step of changing the status value of the task message from the second value to the third value in step 461 is similar to that in step 451, the task message has finished processing, and the status value is changed from the second value to the third value. For specific implementation details, please refer to the embodiment of step 451; this application will not repeat them here. It should be noted that if the status value of the task message is not the third value, the task message is considered an incomplete task message.
[0404] Example of specific usage of the task message processing method in this embodiment of the disclosure
[0405] The following will combine Figure 21 , Figure 22 , Figure 23A as well as Figure 23B This document details an exemplary application of the task message processing method according to embodiments of this application in a real-world application scenario. The process includes, but is not limited to, the following steps:
[0406] Step 2301: In response to the user triggering the task control, if the triggering of the task control is not the first time the user has triggered it, the terminal 140 refuses to generate a task message.
[0407] Step 2302: If the triggering of the task control is the first time the user has triggered it, the terminal 140 generates a task message and identifies the user group to which the user belongs;
[0408] Step 2303: If the triggering of the task control by other users in the user group cannot be blocked, the terminal 140 refuses to generate a task message.
[0409] Step 2304: If other users in the user group have blocked the triggering of the task control, the terminal 140 determines that the task message type is the user trigger type (i.e., Type=1) and sends the task message and the task message type of the task message to the server 110.
[0410] Step 2305: In response to the task message processing platform triggering the platform program according to the preset triggering conditions, if the platform program is not triggered by the task message processing platform for the first time, the server 110 refuses to generate a task message.
[0411] Step 2306: If the platform program is the first time the task message processing platform is triggered, determine whether the task message has been generated by another platform program. If the task message has been generated by another platform program, the server 110 refuses to generate the task message.
[0412] Step 2307: If the task message is not generated by other platform programs, server 110 generates the task message and determines that the task message type is offline trigger type (i.e., Type=2);
[0413] Step 2308: Server 110 responds to receiving the task message by obtaining multiple priority parameters of the task message;
[0414] Step 2309: Server 110 stores the task message and multiple priority parameters in a relational database;
[0415] Step 2310: Server 110 obtains priority filtering conditions;
[0416] Step 2311: In response to the blocking queue not being full, server 110 queries the relational database for task messages with a status value of first value and a task message type of user-triggered or offline-triggered, and sorts the task messages according to the following priority parameters: first sorting by task message type, and then sorting by task message score in descending order.
[0417] Step 2312: Server 110 fills the blocking queue with the retrieved task messages until the blocking queue is full, and modifies the status value of the task messages to the second value.
[0418] Step 2313: Server 110 retrieves the task message from the blocking queue and processes it;
[0419] Step 2314: Server 110 modifies the status value of the task message to the third value and re-executes step 2311 to query the relational database in a loop for task messages with the status value as the first value and the task message type as either user-triggered or offline-triggered, and sorts the task messages according to the priority parameter using the rules.
[0420] Description of apparatus and devices according to embodiments of this disclosure
[0421] To facilitate better implementation of the task message processing method provided in the embodiments of this application, the embodiments of this application also provide an apparatus based on the above-described task message processing method. The meanings of the terms used are the same as in the above-described task message processing method, and specific implementation details can be found in the descriptions in the method embodiments.
[0422] It is understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this embodiment, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0423] It should be noted that in various specific embodiments of this application, when processing data related to the characteristics of the target object, such as target object attribute information or attribute information sets, is required, the permission or consent of the target object will be obtained first. Furthermore, the collection, use, and processing of this data will comply with the relevant laws, regulations, and standards of the relevant countries and regions. In addition, when embodiments of this application need to obtain target object attribute information, separate permission or consent from the target object will be obtained through pop-up windows or redirection to a confirmation page. Only after obtaining the separate permission or consent of the target object will the necessary target object-related data for the normal operation of the embodiments of this application be obtained.
[0424] Please see Figure 24 , Figure 24 This is a schematic diagram of the structure of a task message processing device 2400 provided in an embodiment of this application. The task message processing device 2400 is applied to a computer device, and the task message processing device 2400 can:
[0425] The parameter acquisition module 2410, in response to receiving a task message, is used to acquire multiple priority parameters of the task message;
[0426] The message storage module 2420 is used to store task messages and multiple priority parameters in a relational database;
[0427] Condition acquisition module 2430 is used to acquire priority filtering conditions;
[0428] The message query module 2440, in response to the blocking queue not being full, is used to query task messages from the relational database that meet the priority filtering conditions with multiple priority parameters;
[0429] The queue filling module 2450 is used to fill the blocked queue with the retrieved task messages until the blocked queue is full.
[0430] The message processing module 2460 is used to retrieve task messages from the blocking queue for processing.
[0431] Optionally, the priority filtering condition is based on the total score of multiple priority parameters meeting a predetermined condition. The message query module 2440 is also used for:
[0432] In response to the blocking queue not being full, for each task message in the relational database, determine the parameter score corresponding to each of the multiple priority parameters of the task message;
[0433] The total score of the task message is calculated based on the parameter scores corresponding to each of the multiple priority parameters.
[0434] Retrieve task messages from a relational database whose total score meets predetermined criteria.
[0435] Optionally, the message query module 2440 is also used for:
[0436] In response to the blocking queue not being full, determine the number of task messages that the blocking queue can still hold, and use it as the first number;
[0437] The task messages in the relational database are sorted according to the priority parameter usage rules;
[0438] Among the task messages that meet the priority filtering conditions with multiple priority parameters, the first number of task messages in the sorted order are selected as the queried task messages.
[0439] Optionally, multiple priority parameters include task message type and task message score; the message query module 2440 is also used for:
[0440] Sort the task messages in the relational database according to the task message type;
[0441] For task messages of the same type, sort them according to their task message score.
[0442] Optionally, the task message comes from a task message queue; the task message processing apparatus further includes: a score determination unit (not shown), used to determine the score of the task message in the following manner:
[0443] Input the multiple preceding task messages, the task message itself, and the multiple subsequent task messages in the task message queue into the attention model to obtain the attention score of the task message.
[0444] Identify multiple unprocessed task messages from multiple preceding task messages;
[0445] Using the remaining time prediction model, predict the remaining processing time for each unprocessed task message;
[0446] The task message score is determined based on the attention score and the remaining processing time for each unprocessed task message.
[0447] Optionally, the fraction determination unit is also used for:
[0448] For each unprocessed task message, the correlation prediction model is used to predict the first correlation between the unprocessed task message and the task message.
[0449] Based on the first degree of relevance, the remaining processing time corresponding to each unprocessed task message is weighted and summed to obtain the time-weighted sum.
[0450] The task message score is determined based on the attention score and the duration-weighted sum.
[0451] Optionally, the fraction determination unit is also used for:
[0452] Based on the attention score, the first sub-score is calculated, which is an increasing function of the attention score;
[0453] The second sub-fraction is calculated based on the duration-weighted sum, and the second sub-fraction is a decreasing function of the duration-weighted sum;
[0454] Calculate the task message score based on the first and second sub-scores.
[0455] Optionally, the fraction determination unit is also used for:
[0456] Using a correlation prediction model, predict the second correlation between each subsequent task message and the task message;
[0457] Calculate the average correlation degree based on the second correlation degree between each subsequent task message and the task message;
[0458] The task message score is determined based on the attention score, the remaining processing time for each unprocessed task message, and the average relevance.
[0459] Optionally, the task message type includes user-triggered type and offline-triggered type;
[0460] The task message processing apparatus further includes: a type acquisition module (not shown), used to acquire the task message type through the following process:
[0461] If the task message is generated by the user in response to a task control, determine the task message type as user-triggered type;
[0462] If the task message is generated offline by the task message processing platform through the platform program, the task message type is determined to be an offline triggered type.
[0463] Optionally, the type retrieval module is also used for:
[0464] In response to triggering the task control, if the triggering of the task control is the first time the user has triggered it, a task message is generated, and the task message type is determined to be the user-triggered type.
[0465] If the task control is not triggered for the first time by the user, refuse to generate a task message.
[0466] Optionally, the type retrieval module is also used for:
[0467] Identify the user group to which the user belongs;
[0468] Prevent other users in the user group from triggering the task control.
[0469] Optionally, the message query module 2440 is also used for:
[0470] The task messages are periodically bucketed according to their position in the sorting.
[0471] For each task message, if the task messages are all in the same bucket for a predetermined number of consecutive periods, and the position index of the bucket in the multiple buckets satisfies the predetermined position condition, the task messages are sorted and moved forward.
[0472] Optionally, the message query module 2440 is also used for:
[0473] The displacement is determined based on the position index of the bucket within the multiple buckets, and the displacement is an increasing function of the position index.
[0474] Based on the displacement, the task messages are sorted and moved forward.
[0475] Optionally, the message query module 2440 is also used for:
[0476] In response to the blocking queue not being full again, determine the number of task messages that the blocking queue can still hold, and use it as the second number;
[0477] Among the task messages that meet the priority filtering conditions with multiple priority parameters, the second number of task messages after the first number of task messages are selected as the queried task messages.
[0478] Optionally, the task message processing device further includes: a status setting module, used to set the status value of the task message in the relational database to a first value.
[0479] Optionally, the message query module 2440 is also used for:
[0480] In response to the blocking queue not being full, the task message with the first status value is selected from the relational database;
[0481] From the filtered task messages, query task messages with multiple priority parameters that meet the priority filtering conditions.
[0482] Optionally, the status setting module is also used for:
[0483] In a relational database, the status value of the retrieved task message is changed from the first value to the second value.
[0484] Optionally, the status setting module is also used for:
[0485] In a relational database, the status value of the retrieved task message is modified from the second value to the third value.
[0486] For details on the implementation of each of the above modules, please refer to the previous examples, which will not be repeated here.
[0487] Reference Figure 25 , Figure 25 To implement the structural block diagram of a portion of the terminal 140 in this application embodiment, the terminal 140 includes: a radio frequency (RF) circuit 2510, a memory 2515, an input unit 2530, a display unit 2540, a sensor 2550, an audio circuit 2560, a wireless fidelity (WiFi) module 2570, a processor 2580, and a power supply 2590, among other components. Those skilled in the art will understand that... Figure 25 The terminal 140 structure shown does not constitute a limitation on a mobile phone or computer, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0488] The RF circuit 2510 can be used to receive and transmit signals during information transmission or calls. In particular, it receives downlink information from the base station and processes it with the processor 2580; in addition, it transmits uplink data to the base station.
[0489] The memory 2515 can be used to store software programs and modules. The processor 2580 executes various terminal functions and task message processing by running the software programs and modules stored in the memory 2515.
[0490] The input unit 2530 can be used to receive input numeric or character information, and to generate key signal inputs related to the terminal's settings and function control. Specifically, the input unit 2530 may include a touch panel 2531 and other input devices 2532.
[0491] The display unit 2540 can be used to display input or provided information, as well as various menus of the terminal. The display unit 2540 may include a display panel 2541.
[0492] Audio circuitry 2560, speaker 2561, and microphone 2562 provide an audio interface.
[0493] In this embodiment, the processor 2580 included in the terminal 140 can execute the task message processing method of the previous embodiment.
[0494] The terminal 140 in this application embodiment includes, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, and aircraft. This application embodiment can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0495] Figure 26 This is a partial structural block diagram of a server 110 implementing an embodiment of this application. The server 110 can vary significantly due to different configurations or performance characteristics, and may include one or more central processing units (CPUs) 2622 (e.g., one or more processors) and memory 2632, and one or more storage media 2630 (e.g., one or more mass storage devices) for storing application programs 2642 or data 2644. The memory 2632 and storage media 2630 may be temporary or persistent storage. The program stored in the storage media 2630 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server 110. Furthermore, the CPU 2622 may be configured to communicate with the storage media 2630 and execute the series of instruction operations in the storage media 2630 on the server 110.
[0496] Server 110 may also include one or more power supplies 2626, one or more wired or wireless network interfaces 2650, one or more input / output interfaces 2658, and / or one or more operating systems 2641, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0497] The central processing unit 2622 in server 110 can be used to execute the task message processing method of the embodiments of this application.
[0498] This application also provides a computer-readable storage medium for storing program code for executing the task message processing methods of the foregoing embodiments.
[0499] This application also provides a computer program product, which includes a computer program. A processor of a computer device reads and executes the computer program, causing the computer device to perform the task message processing method described above.
[0500] Furthermore, the terms “comprising” and “including”, and any variations thereof, are intended to cover non-exclusive inclusion, such that a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or apparatus.
[0501] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0502] It should be understood that in the description of the embodiments of this application, "multiple" means two or more, "greater than", "less than", "exceeding" etc. are understood to exclude the number itself, and "above", "below", "within" etc. are understood to include the number itself.
[0503] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0504] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0505] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0506] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0507] It should also be understood that the various implementation methods provided in this application can be combined arbitrarily to achieve different technical effects.
[0508] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0509] The above is a detailed description of the embodiments of this application. However, this application is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. A task message processing method, characterized in that, include: In response to receiving a task message, obtain multiple priority parameters of the task message; The task messages are stored in a relational database in correspondence with the multiple priority parameters; Get priority filtering conditions; In response to the blocking queue not being full, the task message that satisfies the priority filtering condition among the multiple priority parameters is queried from the relational database; The blocked queue is filled with the retrieved task messages until the blocked queue is full. The task message is retrieved from the blocking queue and processed.
2. The task message processing method according to claim 1, characterized in that, The priority filtering condition is based on the total score of the multiple priority parameters satisfying a predetermined condition. The response that the blocking queue is not full involves querying the relational database for task messages whose multiple priority parameters satisfy the priority filtering conditions, including: In response to the blocking queue not being full, for each task message in the relational database, determine the parameter score corresponding to each of the plurality of priority parameters of the task message; The total score of the task message is calculated based on the parameter scores corresponding to each of the multiple priority parameters. From the relational database, query the task message whose total score meets the predetermined condition.
3. The task message processing method according to claim 1, characterized in that, The response that the blocking queue is not full involves querying the relational database for task messages whose multiple priority parameters satisfy the priority filtering conditions, including: In response to the fact that the blocking queue is not full, the number of task messages that the blocking queue can still hold is determined as a first number; The task messages in the relational database are sorted according to the priority parameter usage rules; Among the multiple task messages whose priority parameters satisfy the priority filtering conditions, the first number of task messages in the sorted order are selected as the queried task messages.
4. The task message processing method according to claim 3, characterized in that, The multiple priority parameters include task message type and task message score; The step of sorting the task messages in the relational database according to the priority parameter usage rules includes: Sort the task messages in the relational database according to the task message type; For task messages of the same task message type, they are sorted according to their task message scores.
5. The task message processing method according to claim 4, characterized in that, The task message comes from the task message queue; The task message score is determined in the following way: Input the multiple preceding task messages before the task message in the task message queue, the task message, and the multiple subsequent task messages after the task message in the task message queue into the attention model to obtain the attention score of the task message; From the multiple preceding task messages, identify multiple unprocessed task messages; Using the remaining time prediction model, predict the remaining processing time for each of the unprocessed task messages; The task message score is determined based on the attention score and the remaining processing time corresponding to each of the unprocessed task messages.
6. The task message processing method according to claim 4, characterized in that, The task message types include user-triggered types and offline-triggered types; The task message type is obtained through the following process: If the task message is generated by the user in response to a task trigger control, then the task message type is determined to be the user-triggered type. If the task message is generated offline by the task message processing platform through the platform program, the task message type is determined to be the offline trigger type.
7. The task message processing method according to claim 6, characterized in that, If the task message is generated by the user in response to a task trigger control, determining that the task message type is the user-triggered type includes: In response to triggering the task control, if the triggering of the task control is the first triggering by the user, the task message is generated, and the task message type is determined to be the user trigger type; If the triggering of the task control is not the first time the user has triggered it, the task message is not generated.
8. The task message processing method according to claim 7, characterized in that, In response to triggering the task control, if the triggering of the task control is the first time the user has triggered it, the task message is generated, and the process of obtaining the task message type further includes: Identify the user group to which the user belongs; Disable other users in the user group from triggering the task control.
9. The task message processing method according to claim 3, characterized in that, After sorting the task messages in the relational database according to the priority parameter usage rules, the task message processing method further includes: The task messages are periodically bucketed according to their position in the sorting. For each task message, if the task messages are all in the same bucket for a predetermined number of consecutive periods, and the position index of the bucket in the multiple buckets satisfies a predetermined position condition, the task messages are sorted and moved forward.
10. The task message processing method according to claim 9, characterized in that, The step of sorting and shifting the task messages includes: The displacement is determined based on the position index of the bucket in the multiple buckets, and the displacement is an increasing function of the position index; Based on the displacement, the task messages are sorted and moved forward.
11. The task message processing method according to claim 3, characterized in that, After selecting the first number of task messages in the sorted order from among the multiple task messages whose priority parameters satisfy the priority filtering condition, and using them as the queried task messages, the task message processing method further includes: In response to the blocking queue being less than full again, the number of task messages that the blocking queue can still hold is determined as a second number; Among the multiple task messages whose priority parameters satisfy the priority filtering conditions, the second number of task messages following the first number of task messages are selected as the queried task messages.
12. The task message processing method according to claim 1, characterized in that, After storing the task message and the plurality of priority parameters in a relational database, the task message processing method further includes: setting the status value of the task message in the relational database to a first value; The response that the blocking queue is not full involves querying the relational database for task messages whose multiple priority parameters satisfy the priority filtering conditions, including: In response to the blocking queue not being full, the task message with the status value of the first value is filtered out from the relational database; From the filtered task messages, query the task messages whose multiple priority parameters satisfy the priority filtering conditions.
13. The task message processing method according to claim 12, characterized in that, After filling the blocking queue with the retrieved task messages until the blocking queue is full, the task message processing method further includes: In the relational database, the status value of the retrieved task message is modified from the first value to the second value.
14. The task message processing method according to claim 13, characterized in that, After retrieving the task message from the blocking queue and processing it, the task message processing method further includes: In the relational database, the status value of the retrieved task message is modified from the second value to the third value.
15. A task message processing device, characterized in that, include: The parameter acquisition module, in response to receiving a task message, is used to acquire multiple priority parameters of the task message; A message storage module is used to store the task messages and the plurality of priority parameters in a relational database. The condition acquisition module is used to obtain priority filtering conditions; The message query module, in response to the blocking queue not being full, is used to query the relational database for task messages whose multiple priority parameters satisfy the priority filtering conditions; The queue filling module is used to fill the blocking queue with the retrieved task messages until the blocking queue is full. The message processing module is used to retrieve the task message from the blocking queue for processing.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to execute the task message processing method according to any one of claims 1 to 14.
17. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor performs the task message processing method according to any one of claims 1 to 14.
18. A computer program product, comprising a computer program, characterized in that, The computer program is executed by a processor using the task message processing method according to any one of claims 1 to 14.
