A message processing method and device
By pulling messages from the message queue and storing them in storage devices, building message storage tables, and processing them according to customized solutions, the low efficiency and backlog problems caused by the logical coupling of message processing in the existing technology are solved, and efficient and customized messages are realized. Message processing.
Patent Information
- Application Number
- CN202010312442.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-20
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-04-20
AI Technical Summary
In the existing technology, message receiving logic and processing logic are highly coupled, which results in heavy equipment load, low efficiency, high message backlog and failure rate during large-scale message processing, and the inability to implement customized processing.
By pulling messages from the message queue and storing them in the storage device, a message storage table is constructed, processed according to the customized plan and message information, and the receiving and processing logic is decoupled to achieve customized processing.
It improves message processing efficiency, reduces device load and message backlog, reduces failure rate, and enables customized processing of messages.
Smart Images

Figure CN113535420B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a message processing method and device. Background Art
[0002] With the rapid development of computer business, more and more business messages need to be consumed and processed. In the prior art, messages are mainly obtained by push (receiving) or pull (pulling), and then directly consumed.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] Regardless of the push or pull method, the message receiving / pulling logic and consumption logic are highly coupled. When the message volume is large, the processing equipment load is large, the message processing efficiency is low, the message backlog in the message queue is large, the failure rate and duplication rate of message processing are high, and customized consumption processing of messages cannot be achieved. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a message processing method and device, which can decouple the message receiving logic and processing logic, improve the message processing efficiency, reduce the load rate of the processing equipment, reduce the message backlog in the message queue, and realize customized processing of the message.
[0006] To achieve the above object, according to a first aspect of an embodiment of the present invention, a message processing method is provided, including:
[0007] Pull messages from the message queue;
[0008] The message is stored in a storage device, and a message storage table is constructed to record the message information of the message;
[0009] Pull corresponding messages from the storage device for processing based on the customized scheme and message information.
[0010] Furthermore, the message information includes one or more of the following: message number, message status, message priority, message type and message date.
[0011] Furthermore, before the step of storing the message in the storage device, the message processing method further includes: setting the message status of the message to unprocessed.
[0012] Furthermore, the customized solution includes: processing according to message priority, message type or message date.
[0013] Further, the step of pulling corresponding messages from the storage device for processing according to the customized scheme and the message information includes: pulling corresponding messages from the storage device for processing according to the customized scheme, the number of processing each time and the message information.
[0014] Furthermore, after the step of pulling the corresponding message from the storage device for processing according to the customized scheme and the message information, the message processing method further comprises: updating the message status of the corresponding message according to the processing result.
[0015] Furthermore, the processing results include processing completion and processing failure. Before the step of updating the status of the corresponding message according to the processing results, the message processing method also includes: when the number of failed processing of any message reaches a failure threshold, determining that the processing result corresponding to the message is processing failure.
[0016] Furthermore, in the case where the processing result is a processing failure, the message processing method further includes: generating warning information, the warning information being used to record the message that the processing result is a processing failure.
[0017] Furthermore, the message processing method further includes: deleting messages in the storage device whose message status is "processing completed" according to a time threshold.
[0018] According to a second aspect of an embodiment of the present invention, a message processing device is provided, including:
[0019] Message pulling module, used to pull messages from the message queue;
[0020] The storage module is used to store the message in the storage device and build a message storage table to record the message information;
[0021] The processing module is used to pull corresponding messages from the storage device for processing according to the customized scheme and message information.
[0022] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0023] one or more processors;
[0024] a storage device for storing one or more programs,
[0025] When one or more programs are executed by one or more processors, the one or more processors implement any of the message processing methods described above.
[0026] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any one of the message processing methods described above is implemented.
[0027] An embodiment of the above invention has the following advantages or beneficial effects: because it adopts the technical means of pulling messages from a message queue; storing messages in a storage device, and constructing a message storage table to record the message information of the message; and pulling corresponding messages from the storage device for processing according to a customized plan and message information, it overcomes the technical problems of the high coupling between the message receiving logic and the processing logic in the existing message processing method, resulting in a large load on the processing device, low message processing efficiency, a large backlog of messages in the message queue, a large failure rate and repetition rate of message processing, and an inability to achieve customized processing of messages, thereby decoupling the message receiving logic and the processing logic, improving the message processing efficiency, reducing the load rate of the processing device, reducing the message backlog in the message queue, and achieving the technical effect of customized processing of messages.
[0028] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0030] Figure 1 is a schematic diagram of the main process of the message processing method provided according to the first embodiment of the present invention;
[0031] Figure 2a is a schematic diagram of the main process of the message processing method provided according to the second embodiment of the present invention;
[0032] Figure 2b yes Figure 2a The customized solution in the method shown is a schematic diagram of the main process of consumption processing according to the message priority;
[0033] Figure 2c yes Figure 2a The customized solution in the method shown is a schematic diagram of the main flow of consumption processing according to the message type;
[0034] Figure 2d yes Figure 2a The customized solution in the method shown is a schematic diagram of the main flow of consumption processing based on the message date;
[0035] Figure 3 is a schematic diagram of main modules of a message processing device provided according to an embodiment of the present invention;
[0036] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0037] Figure 5It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0038] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0039] Figure 1 Schematic diagram of the main flow of the message processing method provided according to the first embodiment of the present invention; Figure 1 As shown, the message processing method provided by the embodiment of the present invention mainly includes:
[0040] Step S101, pulling messages from a message queue.
[0041] Specifically, according to an embodiment of the present invention, messages may be pulled from a message queue according to the number of pulls each time and the pull cycle, thereby reducing the message backlog in the message queue.
[0042] Step S102: store the message in a storage device and construct a message storage table to record the message information.
[0043] The pulled messages are directly stored in the storage device instead of being processed directly, so as to decouple the pulling logic and the processing logic, and then the messages are customized through the customized solution.
[0044] Specifically, according to an embodiment of the present invention, the above-mentioned message information includes one or more of the following: message number, message status, message priority, message type and message date.
[0045] According to a specific implementation of an embodiment of the present invention, a message storage table can be constructed in a storage device to record message information corresponding to messages stored in the storage device, so as to facilitate subsequent pulling of messages corresponding to customized solutions in the storage device according to the message information recorded in the message storage table.
[0046] Further, according to an embodiment of the present invention, before the step of storing the message in a storage device, the message processing method further includes: setting the message status of the message to unprocessed.
[0047] In order to facilitate subsequent customized processing of messages pulled from the storage device according to the message information, the message states corresponding to the messages pulled from the message queue are all set to unprocessed.
[0048] Step S103: Pull corresponding messages from the storage device for processing according to the customized solution and message information.
[0049] Specifically, according to an embodiment of the present invention, the above customization scheme includes: processing according to message priority, message type or message date.
[0050] Further, according to an embodiment of the present invention, the step of pulling corresponding messages from the storage device for processing according to the customized scheme and message information includes: pulling corresponding messages from the storage device for processing according to the customized scheme, the number of processing each time and the message information.
[0051] Through the above settings, different customized solutions can be configured for different application scenarios, thereby improving processing efficiency and achieving customized processing of messages.
[0052] According to an embodiment of the present invention, after the above step of pulling the corresponding message from the storage device for processing according to the customized scheme and the message information, the message processing method further includes: updating the message status of the corresponding message according to the processing result.
[0053] Since the processed message will be returned to the storage device, the corresponding message status is updated according to the processing result, avoiding the occurrence of repeated processing.
[0054] Specifically, according to an embodiment of the present invention, the above-mentioned processing results include processing completion and processing failure. Before the step of updating the status of the corresponding message according to the processing result, the message processing method also includes: when the number of failed processing of any message reaches a failure threshold, determining that the processing result corresponding to the message is processing failure.
[0055] Through the above settings, when processing any message, only when the number of failures reaches the failure threshold, the processing result corresponding to the message is confirmed as a processing failure. The above settings improve the success rate of message processing. It should be noted that the value of the failure threshold can be set according to actual conditions.
[0056] According to an embodiment of the present invention, when the processing result is a processing failure, the message processing method further includes: generating warning information, where the warning information is used to record the message that the processing result is a processing failure.
[0057] Specifically, according to an embodiment of the present invention, for a message that fails to be processed, a warning email may be generated and sent, in which the message that the processing result is a failed processing may be recorded. Specifically, according to actual conditions, the reason for the failed processing may also be recorded in the warning email.
[0058] Furthermore, according to an embodiment of the present invention, the message processing method further includes: deleting messages in the storage device whose message status is "processing completed" according to a time threshold.
[0059] Since the processed messages will be returned to the storage device, the storage device and the above-mentioned message storage table will simultaneously contain unprocessed messages, processed messages, and failed messages. In order to improve the operation efficiency of the message storage table and reduce the storage pressure of the storage device, the messages in the storage device with the message status of processed are regularly deleted according to the time threshold. Specifically, according to a specific implementation of an embodiment of the present invention, messages that have been successfully processed N days ago (the specific value of N can be set according to actual conditions) can be deleted.
[0060] According to the technical solution of the embodiment of the present invention, the technical means of pulling messages from the message queue; storing the messages in a storage device, and constructing a message storage table to record the message information of the messages; and pulling the corresponding messages from the storage device for processing according to the customized scheme and the message information are overcome. Therefore, the technical problems that the receiving logic and the processing logic of the messages in the existing message processing methods are highly coupled, resulting in a large load on the processing device, low message processing efficiency, a large backlog of messages in the message queue, a large failure rate and repetition rate of message processing, and an inability to achieve customized processing of the messages are overcome. The receiving logic and the processing logic of the messages are decoupled, the message processing efficiency is improved, the load rate of the processing device is reduced, the backlog of messages in the message queue is reduced, and the technical effect of customized processing of the messages is achieved.
[0061] Figure 2a is a schematic diagram of the main process of the message processing method provided according to the second embodiment of the present invention; an application scenario of the embodiment of the present invention is message consumption, that is, in the subscription message processing of the message queue, a consumer is used as the message receiver to perform corresponding business message processing (i.e., consumption) on the received message, such as Figure 2a As shown, the message processing method provided by the embodiment of the present invention mainly includes:
[0062] Step S201, pulling messages from the message queue.
[0063] Specifically, according to an embodiment of the present invention, messages may be pulled from a message queue according to the number of pulls each time and the pull cycle, thereby reducing the message backlog in the message queue.
[0064] Step S202: setting the message status of the message to unprocessed.
[0065] In order to facilitate the subsequent pulling of messages from the storage device for customized consumption according to the message information, the message statuses corresponding to the messages pulled from the message queue are all set to unprocessed.
[0066] Step S203: store the message in a storage device and construct a message storage table to record the message information.
[0067] The pulled messages are directly stored in the storage device instead of being consumed directly, so as to realize the decoupling of the pulling logic and the consumption logic, and to customize the consumption of the messages through the subsequent customized solution. Specifically, according to an embodiment of the present invention, the messages pulled from the message queue can be stored in a MySQL (a relational database management system) database, and a message storage table is constructed in the database to record the message information corresponding to the message.
[0068] Specifically, according to an embodiment of the present invention, the above-mentioned message information includes one or more of the following: message number, message status, message priority, message type and message date.
[0069] According to a specific implementation of an embodiment of the present invention, a message storage table can be constructed in a storage device to record message information corresponding to messages stored in the storage device, so as to facilitate subsequent pulling of messages corresponding to customized solutions in the storage device according to the message information recorded in the message storage table.
[0070] According to an embodiment of the present invention, the message storage table is shown in the following table:
[0071]
[0072] Among them, id represents the message number, and id is the primary key of the above message storage table. The unique feature of id can be used to avoid repeated consumption; status represents the message status, including unprocessed, processing, processing completed and processing failed; text represents the message content, and the message content includes at least one parameter (param). The parameter represents the parameter or attribute of the message, and the priority of the message can be set for parameter param1; topic represents the message type; crate time and update time represent the message date.
[0073] Step S204: Pull corresponding messages from the storage device for consumption according to the customized plan, the quantity consumed each time, and the message information.
[0074] Through the above settings, different customized solutions can be configured for different application scenarios, thereby improving consumption efficiency and realizing customized processing of messages.
[0075] Different consumption plans can be customized according to actual conditions. The consumption logic pulls the corresponding unprocessed messages from the storage device for customized consumption processing according to the instructions of the customized plan.
[0076] Specifically, according to an embodiment of the present invention, the above customization scheme includes: consuming according to message priority, message type or message date.
[0077] According to an embodiment of the present invention, when the customized solution is to consume according to the message priority, such as Figure 2b As shown, the above-mentioned pulling corresponding messages from the storage device for consumption according to the customized plan, the quantity of each consumption and the message information includes:
[0078] First, a task set is created, and then according to the message priority, messages with parameter param1=1 are obtained from the messages in the storage device whose message status is unprocessed and placed in the task set, wherein the number of messages with parameter param1=1 is n in total.
[0079] The message priority is determined by the value of the parameter param1 in the message. The value of param1 ranges from 1 to x. The smaller the value of param1, the higher the priority.
[0080] Then, it is determined whether the number of messages n of param1=1 is greater than or equal to m, where m is the number of messages consumed each time. If so, the number of messages in the current task set has reached or exceeded the number of messages consumed each time, and the messages in the task set are directly consumed.
[0081] If not, that is, the number of messages in the task set does not meet the number of messages consumed each time, then the message with parameter param1=2 is obtained from the unprocessed messages in the storage device and placed in the task set, where the number of messages with parameter param1=2 is l. Determine whether l is greater than or equal to nm. If so, directly consume the messages in the task set according to the message priority; if not, continue to pull messages of the next priority level into the task set until the number of messages in the task set is greater than or equal to the number of messages consumed each time.
[0082] Finally, after the consumption is completed, the message status in the task set is updated according to the consumption result, and the messages in the task set are returned to the storage device.
[0083] According to an embodiment of the present invention, when the customized solution is to consume according to the message type, such as Figure 2c As shown, the above-mentioned pulling corresponding messages from the storage device for consumption according to the customized plan, the quantity of each consumption and the message information includes:
[0084] First, m messages with unprocessed status are obtained from the storage device. At this time, the message status of the m messages can also be updated to being processed, where m is the number of consumptions per time.
[0085] Then, the message type of each message is determined in turn. If it is the type indicated by the customized solution, it is directly consumed and processed, and the message status is updated according to the consumption result; if it is not the message type indicated by the customized solution, the message status of the message is directly updated to processed and returned to the storage device.
[0086] Finally, after the consumption is completed, the message status in the task set is updated according to the consumption result, and the messages in the task set are returned to the storage device.
[0087] Through the above settings, it is possible to effectively avoid the message indicating the message type in the non-customized solution from interfering with subsequent consumption, thereby improving the message processing efficiency.
[0088] According to an embodiment of the present invention, when the customized solution is to consume according to the message date, such as Figure 2d As shown, the above-mentioned pulling corresponding messages from the storage device for consumption according to the customized plan, the quantity of each consumption and the message information includes:
[0089] First, according to the message date corresponding to each message whose message status is unprocessed in the storage setting, m messages with dates indicated by the customized scheme are obtained.
[0090] Then, the message status corresponding to the above acquired message is updated to being processed, and the m messages are consumed.
[0091] After the final consumption is completed, the message status in the task set is updated according to the consumption result, and the messages in the task set are returned to the storage device.
[0092] Step S205: When the number of times that any message processing fails reaches a failure threshold, it is determined that the consumption result corresponding to the message is a processing failure.
[0093] Through the above settings, when any message is consumed, only when the number of failures reaches the failure threshold, the consumption result corresponding to the message is confirmed as a processing failure. The above settings improve the success rate of message processing. It should be noted that the value of the failure threshold can be set according to actual conditions.
[0094] Step S206, generating warning information, the warning information is used to record the message that the consumption result is a processing failure.
[0095] Specifically, according to an embodiment of the present invention, for a message that fails to be processed, a warning email may be generated and sent, in which the message that the consumption result is a message that fails to be processed is recorded. Specifically, according to actual conditions, the reason for the failure to be processed may also be recorded in the warning email.
[0096] Step S207: Update the message status of the corresponding message according to the consumption result.
[0097] Since the messages after consumption processing will be returned to the storage device, the corresponding message status is updated according to the consumption results to avoid repeated consumption.
[0098] Step S208: deleting messages in the storage device whose message status is "processing completed" according to the time threshold.
[0099] Since the messages after consumption processing are returned to the storage device, there are unprocessed messages, processed messages and failed messages in the storage device and the above-mentioned message storage table. In order to improve the operation efficiency of the message storage table and reduce the storage pressure of the storage device, the messages in the storage device with the message status of processed are regularly deleted according to the time threshold. Specifically, according to a specific implementation of an embodiment of the present invention, messages that have been successfully consumed and processed N days ago (the specific value of N can be set according to actual conditions) can be deleted.
[0100] According to the technical solution of the embodiment of the present invention, the technical means of pulling messages from a message queue, storing the messages in a storage device, and constructing a message storage table to record the message information of the messages, and pulling corresponding messages from the storage device for consumption according to a customized solution and message information are adopted. Therefore, the technical problems that the receiving logic and the consumption logic of messages in the existing message processing methods are highly coupled, resulting in a large load on the processing device, low message processing efficiency, a large backlog of messages in the message queue, a large failure rate and repetition rate of message processing, and an inability to implement customized processing of messages are overcome. Thus, the receiving logic and the consumption logic of the messages are decoupled, the message processing efficiency is improved, the load rate of the processing device is reduced, the backlog of messages in the message queue is reduced, and the technical effect of customized processing of messages is achieved.
[0101] Figure 3 is a schematic diagram of main modules of a message processing device provided according to an embodiment of the present invention; Figure 3 As shown, the message processing device 300 provided in this embodiment of the present invention mainly includes:
[0102] The message pulling module 301 is used to pull messages from the message queue.
[0103] Specifically, according to an embodiment of the present invention, messages may be pulled from a message queue according to the number of pulls each time and the pull cycle, thereby reducing the message backlog in the message queue.
[0104] The storage module 302 is used to store the message in a storage device and construct a message storage table to record the message information.
[0105] The pulled messages are directly stored in the storage device instead of being processed directly, so as to decouple the pulling logic and the processing logic, and then the messages are customized through the customized solution.
[0106] Specifically, according to an embodiment of the present invention, the above-mentioned message information includes one or more of the following: message number, message status, message priority, message type and message date.
[0107] According to a specific implementation of an embodiment of the present invention, a message storage table can be constructed in a storage device to record message information corresponding to messages stored in the storage device, so as to facilitate subsequent pulling of messages corresponding to customized solutions in the storage device according to the message information recorded in the message storage table.
[0108] Further, according to an embodiment of the present invention, the message processing apparatus 300 further includes a message status setting module. Before the step of storing the message in the storage device, the message status setting module is used to: set the message status of the message to unprocessed.
[0109] In order to facilitate subsequent customized processing of messages pulled from the storage device according to the message information, the message states corresponding to the messages pulled from the message queue are all set to unprocessed.
[0110] The processing module 303 is used to pull the corresponding message from the storage device for processing according to the customized solution and the message information.
[0111] Specifically, according to an embodiment of the present invention, the above customization scheme includes: processing according to message priority, message type or message date.
[0112] Further, according to an embodiment of the present invention, the processing module 303 is used to pull corresponding messages from the storage device for processing according to the customized scheme, the processing quantity each time and the message information.
[0113] Through the above settings, different customized solutions can be configured for different application scenarios, thereby improving processing efficiency and achieving customized processing of messages.
[0114] According to an embodiment of the present invention, the above-mentioned message processing device 300 also includes a status update module. After the step of pulling the corresponding message from the storage device for processing according to the customized scheme and message information, the status update module is used to: update the message status of the corresponding message according to the processing result.
[0115] Since the processed message will be returned to the storage device, the corresponding message status is updated according to the processing result, avoiding the occurrence of repeated processing.
[0116] Specifically, according to an embodiment of the present invention, the above-mentioned processing results include processing completion and processing failure. The above-mentioned message processing device 300 also includes a processing failure determination module. Before the step of updating the status of the corresponding message according to the processing result, the processing failure determination module is used to: when the number of failed processing of any message reaches a failure threshold, determine that the processing result corresponding to the message is processing failure.
[0117] Through the above settings, when processing any message, only when the number of failures reaches the failure threshold, the processing result corresponding to the message is confirmed as a processing failure. The above settings improve the success rate of message processing. It should be noted that the value of the failure threshold can be set according to actual conditions.
[0118] According to an embodiment of the present invention, the message processing device 300 further includes a warning information generation module. When the processing result is a processing failure, the warning information generation module is used to: generate warning information, and the warning information is used to record the message that the processing result is a processing failure.
[0119] Specifically, according to an embodiment of the present invention, for a message that fails to be processed, a warning email may be generated and sent, in which the message that the processing result is a failed processing may be recorded. Specifically, according to actual conditions, the reason for the failed processing may also be recorded in the warning email.
[0120] Furthermore, according to an embodiment of the present invention, the message processing apparatus 300 further includes a deletion module, which is used to delete messages in the storage device whose message status is "processing completed" according to a time threshold.
[0121] Since the processed messages will be returned to the storage device, the storage device and the above-mentioned message storage table will simultaneously contain unprocessed messages, processed messages, and failed messages. In order to improve the operation efficiency of the message storage table and reduce the storage pressure of the storage device, the messages in the storage device with the message status of processed are regularly deleted according to the time threshold. Specifically, according to a specific implementation of an embodiment of the present invention, messages that have been successfully processed N days ago (the specific value of N can be set according to actual conditions) can be deleted.
[0122] According to the technical solution of the embodiment of the present invention, the technical means of pulling messages from the message queue; storing the messages in a storage device, and constructing a message storage table to record the message information of the messages; and pulling the corresponding messages from the storage device for processing according to the customized scheme and the message information are overcome. Therefore, the technical problems that the receiving logic and the processing logic of the messages in the existing message processing methods are highly coupled, resulting in a large load on the processing device, low message processing efficiency, a large backlog of messages in the message queue, a large failure rate and repetition rate of message processing, and an inability to achieve customized processing of the messages are overcome. The receiving logic and the processing logic of the messages are decoupled, the message processing efficiency is improved, the load rate of the processing device is reduced, the backlog of messages in the message queue is reduced, and the technical effect of customized processing of the messages is achieved.
[0123] Figure 4 An exemplary system architecture 400 is shown to which the message processing method or message processing apparatus according to the embodiment of the present invention can be applied.
[0124] like Figure 4 As shown, the system architecture 400 may include terminal devices 401, 402, 403, a network 404 and a server 405 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 404 is used to provide a medium for a communication link between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0125] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0126] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0127] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received messages, customized solutions, and other data, and feed back the processing results (such as the corresponding messages pulled - only an example) to the terminal device.
[0128] It should be noted that the message processing method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the message processing device is generally arranged in the server 405 .
[0129] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0130] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0131] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0132] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0133] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0134] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0135] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0136] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a message pulling module, a storage module, and a processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the message pulling module may also be described as a "module for pulling messages from a message queue."
[0137] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: pulling messages from a message queue; storing messages to a storage device, and constructing a message storage table to record message information of the messages; pulling corresponding messages from the storage device for processing according to the customized scheme and message information.
[0138] According to the technical solution of the embodiment of the present invention, the technical means of pulling messages from the message queue; storing the messages in a storage device, and constructing a message storage table to record the message information of the messages; and pulling the corresponding messages from the storage device for processing according to the customized scheme and the message information are overcome. Therefore, the technical problems that the receiving logic and the processing logic of the messages in the existing message processing methods are highly coupled, resulting in a large load on the processing device, low message processing efficiency, a large backlog of messages in the message queue, a large failure rate and repetition rate of message processing, and an inability to achieve customized processing of the messages are overcome. The receiving logic and the processing logic of the messages are decoupled, the message processing efficiency is improved, the load rate of the processing device is reduced, the backlog of messages in the message queue is reduced, and the technical effect of customized processing of the messages is achieved.
[0139] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A message processing method, characterized in that: include: Pull messages from the message queue; The message is stored in a storage device, and a message storage table is constructed to record the message information of the message; Pulling corresponding messages from the storage device for processing according to the customized solution and the message information; The customized solution includes: processing according to message priority; The step of pulling corresponding messages from the storage device for processing according to the customized scheme and the message information includes: pulling corresponding messages from the storage device for processing according to the customized scheme, the processing quantity each time and the message information, specifically including: Create a task set, and then according to the message priority, obtain the messages corresponding to the message priority from the messages with unprocessed message status in the storage device and place them in the task set; determine whether the corresponding message quantity is greater than or equal to the processing quantity each time; if so, directly process the messages in the task set; if not, continue to pull messages of the next priority level into the task set until the message quantity in the task set is greater than or equal to the processing quantity each time.
2. The message processing method according to claim 1, characterized in that: The message information includes one or more of the following: message number, message status, message priority, message type and message date.
3. The message processing method according to claim 1, characterized in that: Before the step of storing the message in a storage device, the message processing method further includes: setting the message status of the message to unprocessed.
4. The message processing method according to claim 1, characterized in that: The customized solution includes: processing according to message type or message date.
5. The message processing method according to claim 1, characterized in that: After the step of pulling the corresponding message from the storage device for processing according to the customized solution and the message information, the message processing method further includes: updating the message status of the corresponding message according to the processing result.
6. The message processing method according to claim 5, characterized in that: The processing results include processing completion and processing failure. Before the step of updating the status of the corresponding message according to the processing results, the message processing method also includes: when the number of failed processing of any message reaches a failure threshold, determining that the processing result corresponding to the message is processing failure.
7. The message processing method according to claim 6, characterized in that: In the case where the processing result is a processing failure, the message processing method further includes: generating warning information, wherein the warning information is used to record the message that the processing result is a processing failure.
8. The message processing method according to claim 6, characterized in that: The message processing method further includes: deleting messages in the storage device whose message status is "processing completed" according to a time threshold.
9. A message processing device, characterized in that: include: Message pulling module, used to pull messages from the message queue; A storage module, used to store the message in a storage device and construct a message storage table to record the message information of the message; A processing module, used to pull corresponding messages from the storage device for processing according to the customized solution and the message information; The customized solution includes: processing according to message priority; It is also used to pull corresponding messages from the storage device for processing according to the customized plan, the number of messages processed each time and the message information: it is also used to create a task set, and then according to the message priority, obtain messages corresponding to the message priority from the messages with unprocessed message status in the storage device and place them in the task set; determine whether the corresponding number of messages is greater than or equal to the number of messages processed each time; if so, directly process the messages in the task set; if not, continue to pull messages of the next priority level into the task set until the number of messages in the task set is greater than or equal to the number of messages processed each time.
10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Request message management method and device, and storage medium
CN108200134A
Message storage method and apparatus
CN109257320A
