A message processing method, device, system, electronic device and storage medium
By obtaining and sending message processing status and progress information, the problem of low message processing efficiency and missing processing is solved, and effective processing and efficient automatic submission of messages are realized.
Patent Information
- Application Number
- CN202110880955.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-02
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-08-02
AI Technical Summary
The message processing efficiency in the existing technology is low and messages are easily missed, resulting in incomplete message processing.
By obtaining the target processing status information of the pending message and the progress information of the previous pending message to ensure that the message is processed successfully and submitted successfully, the target progress information is automatically sent to obtain the target submission result to ensure that the message is effectively processed.
It improves the efficiency and integrity of message processing, avoids the problem of missed message processing, ensures that progress information is automatically sent after the message is processed at least once by the terminal, and reduces the cost of manual operations.
Smart Images

Figure CN113641515B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a message processing method, device, system, electronic device and storage medium. Background Art
[0002] A message queue is a container that stores messages during their transmission. Message queues can work in a publish-subscribe mode, where a message producer publishes messages, and one or more message consumers subscribe to messages and process the subscribed messages. Message consumers send consumption record information to message queues, so that the message queue identifies the progress of the message consumer. In related technologies, when a message consumer sends consumption record information to a message queue, it may not be consistent with the actual processing progress of the message, which makes it easy to miss messages and the message processing efficiency is low. Summary of the invention
[0003] The present disclosure provides a message processing method, device, system, electronic device and storage medium to at least solve the problem of missing messages and low message processing efficiency in the related art. The technical solution of the present disclosure is as follows:
[0004] According to a first aspect of an embodiment of the present disclosure, a message processing method is provided, the method comprising:
[0005] Processing the message to be processed to obtain target processing status information corresponding to the message to be processed;
[0006] Obtain the last submitted status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed;
[0007] When the target processing status information indicates that the pending message is successfully processed, and the last submission status information indicates that the last pending message is successfully submitted, determine the target progress information of the pending message, and send the target progress information to the server, wherein the target progress information is used to instruct the server to obtain the target submission result of the pending message based on the target progress information;
[0008] Receive the target submission result of the message to be processed sent by the server.
[0009] As an optional embodiment, the processing of the message to be processed to obtain target processing state information corresponding to the message to be processed includes:
[0010] Create a processing result receiving object corresponding to the message to be processed;
[0011] Processing the message to be processed, obtaining a processing result corresponding to the message to be processed, and sending the processing result to the processing result receiving object;
[0012] When the processing result receiving object receives the processing result, target processing status information indicating that the to-be-processed message has been successfully processed is generated.
[0013] As an optional embodiment, the method further includes:
[0014] When sending a progress message of the previous message to be processed to the server, creating a submission result receiving object corresponding to the previous message to be processed;
[0015] Based on the submission result receiving object, receiving the submission result of the previous message to be processed sent by the server;
[0016] When the submission result receiving object receives the submission result, the previous submission status information indicating that the previous message to be processed was submitted successfully is generated.
[0017] As an optional embodiment, before processing the message to be processed and obtaining the target processing state information corresponding to the message to be processed, the method further includes:
[0018] In response to the message processing request, sending the message acquisition request to the server based on a pre-created message acquisition thread;
[0019] Based on the message acquisition thread, receiving a to-be-processed message corresponding to the message acquisition request;
[0020] Based on the message acquisition thread, the to-be-processed message is forwarded to a pre-created message processing thread group.
[0021] As an optional embodiment, the to-be-processed message includes multiple messages, the message processing thread group includes multiple message processing threads corresponding to each of the multiple messages, and the processing of the to-be-processed message to obtain the target processing state information corresponding to the to-be-processed message includes:
[0022] In each message processing thread, the message processing logic is run to process the corresponding message, thereby obtaining the target processing state information corresponding to each message.
[0023] As an optional embodiment, the method further includes:
[0024] In the case that the to-be-processed message has not been processed completely, in response to a next message processing request of the message processing request, a next to-be-processed message of the to-be-processed message is obtained from a server provided with a preset message queue.
[0025] According to a second aspect of an embodiment of the present disclosure, a message processing method is provided, the method comprising:
[0026] The receiving terminal obtains the to-be-processed message from the preset message queue in response to the message acquisition request sent by the message processing request;
[0027] Sending the to-be-processed message to the terminal;
[0028] receiving target progress information of the message to be processed sent by the terminal, the target progress information being obtained by the terminal when the target processing status information indicates that the message to be processed is successfully processed, and the last submitted status information indicates that the last message to be processed of the message to be processed is successfully submitted, the target processing status information is determined based on the processing result of the message to be processed, and the last submitted status information is determined based on the submission result of the last message to be processed;
[0029] Based on the target progress information, obtaining the target submission result of the message to be processed;
[0030] Sending a target submission result of the message to be processed to the terminal.
[0031] As an optional embodiment, the message acquisition request includes a target message partition identifier, and the acquiring of the to-be-processed message from the preset message queue includes:
[0032] Determine the target message partition corresponding to the target message partition identifier from the preset message queue;
[0033] The to-be-processed message is obtained from the target message partition.
[0034] According to a third aspect of an embodiment of the present disclosure, a message processing device is provided, the device comprising:
[0035] A message processing module is configured to process the message to be processed and obtain target processing state information corresponding to the message to be processed;
[0036] A submission status acquisition module is configured to execute acquisition of last submission status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed;
[0037] a submission information sending module, configured to determine the target progress information of the message to be processed and send the target progress information to the server when the target processing status information indicates that the message to be processed is successfully processed and the previous submission status information indicates that the previous message to be processed is successfully submitted, wherein the target progress information is used to indicate that the server obtains the target submission result of the message to be processed based on the target progress information;
[0038] The submission result receiving module is configured to execute and receive the target submission result of the message to be processed sent by the server.
[0039] As an optional embodiment, the message processing module includes:
[0040] A processing result receiving object creating unit, configured to execute creation of a processing result receiving object corresponding to the message to be processed;
[0041] A processing unit, configured to execute processing on the message to be processed, obtain a processing result corresponding to the message to be processed, and send the processing result to the processing result receiving object;
[0042] The target processing status information generating unit is configured to generate target processing status information indicating that the processing of the to-be-processed message is successful when the processing result receiving object receives the processing result.
[0043] As an optional embodiment, the device further includes:
[0044] A submission result receiving object creating unit, configured to create a submission result receiving object corresponding to the previous message to be processed when sending a progress message of the previous message to be processed to the server;
[0045] A submission result receiving unit, configured to receive the submission result of the previous message to be processed sent by the server;
[0046] The last submission status information generating unit is configured to generate the last submission status information indicating that the last message to be processed was successfully submitted when the submission result receiving object receives the submission result.
[0047] As an optional embodiment, the device further includes:
[0048] A message acquisition request sending module, configured to execute, in response to a message processing request, sending the message acquisition request to the server based on a pre-created message acquisition thread;
[0049] A to-be-processed message receiving module, configured to execute based on the message acquisition thread, and receive the to-be-processed message corresponding to the message acquisition request;
[0050] The to-be-processed message forwarding module is configured to execute forwarding the to-be-processed message to a pre-created message processing thread group based on the message acquisition thread.
[0051] As an optional embodiment, the to-be-processed message includes a plurality of messages, the message processing thread group includes a plurality of message processing threads corresponding to each of the plurality of messages, and the message processing module further includes:
[0052] The multi-thread processing unit is configured to execute in each message processing thread, process the corresponding message by running the message processing logic, and obtain the target processing state information corresponding to each message.
[0053] As an optional embodiment, the device further includes:
[0054] The next to-be-processed message acquisition module is configured to execute, when the to-be-processed message has not been processed, in response to the next message processing request of the message processing request, to obtain the next to-be-processed message of the to-be-processed message from a server with a preset message queue.
[0055] According to a fourth aspect of an embodiment of the present disclosure, a message processing device is provided, the device comprising:
[0056] A to-be-processed message acquisition module, configured to execute a message acquisition request sent by a receiving terminal in response to a message processing request, and acquire the to-be-processed message from a preset message queue;
[0057] A to-be-processed message sending module, configured to execute sending of the to-be-processed message to the terminal;
[0058] a target progress information receiving module, configured to receive target progress information of the message to be processed sent by the terminal, wherein the target progress information is obtained by the terminal when the target processing status information indicates that the message to be processed is successfully processed, and the last submission status information indicates that the last message to be processed of the message to be processed is successfully submitted, the target processing status information is determined based on the processing result of the message to be processed, and the last submission status information is determined based on the submission result of the last message to be processed;
[0059] A target submission result acquisition module is configured to obtain the target submission result of the message to be processed based on the target progress information;
[0060] The target submission result sending module is configured to execute the target submission result of sending the message to be processed to the terminal.
[0061] As an optional embodiment, the message acquisition request includes a target message partition identifier, and the to-be-processed message acquisition module includes:
[0062] A message partition determining unit, configured to determine a target message partition corresponding to the target message partition identifier from the preset message queue;
[0063] The partition message acquisition unit is configured to acquire the to-be-processed message from the target message partition.
[0064] According to a fifth aspect of an embodiment of the present disclosure, a message processing system is provided, the system comprising: a terminal and a server, wherein a preset message queue is provided in the server, and the terminal is electrically connected to the server;
[0065] The server is configured to execute a message acquisition request sent by the receiving terminal in response to a message processing request, and acquire a to-be-processed message from the preset message queue;
[0066] The server is configured to send the to-be-processed message to the terminal;
[0067] The terminal is configured to process the message to be processed and obtain target processing state information corresponding to the message to be processed;
[0068] The terminal is configured to execute acquisition of last submission status information corresponding to progress information of a last message to be processed corresponding to the message to be processed;
[0069] The terminal is configured to determine the target progress information of the message to be processed and send the target progress information to the server when the target processing status information indicates that the message to be processed is successfully processed and the last submission status information indicates that the last message to be processed is successfully submitted;
[0070] The server is configured to execute a target submission result of the message to be processed based on the target progress information;
[0071] The server is configured to execute a target submission result of sending the to-be-processed message to the terminal.
[0072] As an optional embodiment, the terminal includes: a message processing module;
[0073] The message processing module comprises: a processing result receiving object creation unit, a processing unit and a target processing state information generation unit, wherein the processing result receiving object creation unit is electrically connected to the processing unit, and the target processing state information generation unit is electrically connected to the processing result receiving object creation unit;
[0074] The processing result receiving object creating unit is configured to execute the creation of the processing result receiving object corresponding to the message to be processed;
[0075] The processing unit is configured to process the message to be processed, obtain a processing result corresponding to the message to be processed, and send the processing result to the processing result receiving object;
[0076] The target processing status information generating unit is configured to generate target processing status information indicating that the to-be-processed message has been successfully processed when the processing result receiving object receives the processing result.
[0077] As an optional embodiment, the terminal includes a submission status acquisition module;
[0078] The submission status acquisition module includes: a submission result receiving object creation unit, a submission result receiving unit and a previous submission status information generation unit, wherein the submission result receiving object creation unit is electrically connected to the submission result receiving unit, and the submission result receiving object creation unit is electrically connected to the previous submission status information generation unit;
[0079] The submission result receiving object creating unit is configured to create a submission result receiving object corresponding to the previous message to be processed when sending a progress message of the previous message to be processed to the server;
[0080] The submission result receiving unit is configured to receive the submission result of the previous message to be processed sent by the server;
[0081] The last submission status information generating unit is configured to generate last submission status information indicating that the last message to be processed was successfully submitted when the submission result receiving object receives the submission result.
[0082] As an optional embodiment, the terminal further includes: a message acquisition request sending module, a pending message receiving module and a pending message forwarding module, wherein the message acquisition request sending module is electrically connected to the pending message receiving module, and the pending message receiving module is electrically connected to the pending message forwarding module;
[0083] The message acquisition request sending module is configured to execute, in response to the message processing request, sending the message acquisition request to the server based on a pre-created message acquisition thread;
[0084] The to-be-processed message receiving module is configured to execute, based on the message acquisition thread, receiving the to-be-processed message corresponding to the message acquisition request;
[0085] The to-be-processed message forwarding module is configured to execute forwarding the to-be-processed message to a pre-created message processing thread group based on the message acquisition thread.
[0086] As an optional embodiment, the to-be-processed message includes a plurality of messages, the message processing thread group includes a plurality of message processing threads corresponding to each of the plurality of messages, and the message processing module further includes:
[0087] The multi-thread processing unit is configured to execute in each message processing thread, process the corresponding message by running the message processing logic, and obtain the target processing state information corresponding to each message.
[0088] As an optional embodiment, the terminal further includes: a next message to be processed acquisition module;
[0089] The next to-be-processed message acquisition module is configured to execute, when the to-be-processed message has not been processed, in response to a next message processing request of the message processing request, to acquire the next to-be-processed message of the to-be-processed message from a server provided with a preset message queue.
[0090] As an optional embodiment, the message acquisition request includes a target message partition identifier, and the server further includes: a to-be-processed message acquisition module;
[0091] The to-be-processed message acquisition module comprises: a message partition determination unit and a partition message acquisition unit, wherein the message partition determination unit and the partition message acquisition unit are electrically connected;
[0092] The message partition determination unit is configured to determine the target message partition corresponding to the target message partition identifier from the preset message queue;
[0093] The partition message acquisition unit is configured to acquire the to-be-processed message from the target message partition.
[0094] According to a sixth aspect of an embodiment of the present disclosure, an electronic device is provided, the electronic device comprising:
[0095] processor;
[0096] a memory for storing instructions executable by the processor;
[0097] The processor is configured to execute the instructions to implement the message processing method executed by the terminal as described above, and / or to implement the message processing method executed by the server as described above.
[0098] According to the seventh aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the instructions to implement the message processing method executed by the terminal as described above, and / or to implement the message processing method executed by the server as described above.
[0099] According to an eighth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the message processing method executed by the terminal as described above, and / or implement the message processing method executed by the server as described above.
[0100] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0101] The terminal processes the message to be processed and obtains the target processing status information corresponding to the message to be processed. The terminal obtains the last submission status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed. When the target processing status information indicates that the message to be processed is successfully processed, and the last submission status information indicates that the last message to be processed is successfully submitted, the terminal sends the target progress information to the server. The server obtains the target submission result of the message to be processed based on the target progress information, and sends the target submission result to the terminal. This method can automatically send the target progress information while ensuring that the terminal has processed the message at least once, so that the message can be effectively processed.
[0102] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0104] Figure 1 The diagram is a schematic diagram of an application scenario of a message processing method according to an exemplary embodiment.
[0105] Figure 2 The present invention is an interactive flow chart of a message processing method according to an exemplary embodiment.
[0106] Figure 3 The present invention is a schematic diagram of a working mode of a message acquisition thread and a message processing thread group in a message processing method according to an exemplary embodiment.
[0107] Figure 4The present invention is a flowchart of obtaining to-be-processed messages based on a message obtaining thread in a message processing method according to an exemplary embodiment.
[0108] Figure 5 The present invention is a flowchart of a server determining a message to be processed in a message processing method according to an exemplary embodiment.
[0109] Figure 6 The present invention is a flowchart of determining target processing state information in a message processing method according to an exemplary embodiment.
[0110] Figure 7 The present invention is a flowchart of determining last submitted status information in a message processing method according to an exemplary embodiment.
[0111] Figure 8 The present invention is a flowchart showing a message processing method applied to a terminal side according to an exemplary embodiment.
[0112] Fig. 9 The present invention is a flowchart showing a message processing method applied to a server side according to an exemplary embodiment.
[0113] Fig.10 It is a block diagram of a message processing device on a terminal side according to an exemplary embodiment.
[0114] Fig.11 The present invention is a block diagram showing a message processing device on a server side according to an exemplary embodiment.
[0115] Fig.12 It is a block diagram of a message processing system according to an exemplary embodiment.
[0116] Fig.13 It is a block diagram of an electronic device on a terminal side according to an exemplary embodiment.
[0117] Fig.14 It is a block diagram of an electronic device on a server side according to an exemplary embodiment. DETAILED DESCRIPTION
[0118] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0119] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0120] Figure 1 is a schematic diagram of an application scenario of a message processing method according to an exemplary embodiment. Figure 1 As shown, the scenario diagram includes a terminal 110 and a server 120. The server 120 is a server provided with a preset message queue. The terminal 110 obtains a pending message from the preset message queue in the server 120. The terminal 110 processes the pending message and obtains target processing status information corresponding to the pending message. The terminal 110 obtains the last submission status information corresponding to the progress information of the last pending message corresponding to the pending message. When the target processing status information indicates that the pending message is processed successfully and the last submission status information indicates that the last pending message is submitted successfully, the terminal 110 determines the target progress information of the pending message. The terminal 110 sends the target progress information to the server 120. After receiving the target progress information, the server 120 obtains the target submission result corresponding to the target progress information. The server 120 sends the target submission result to the terminal 110.
[0121] In the embodiment of the present disclosure, the terminal 110 includes physical devices such as smart phones, desktop computers, tablet computers, laptops, digital assistants, smart wearable devices, etc., and may also include software running in the physical device, such as applications, etc., and may also be a server, middleware, etc. The operating system running on the physical device in the embodiment of the present application may include but is not limited to Android system, IOS system, Linux, Unix, Windows, etc. The terminal 110 will obtain the to-be-processed message from the server 120 based on the API (Application Programming Interface).
[0122] In the disclosed embodiment, the server 120 may include an independently operated server, or a distributed server, or a server cluster composed of multiple servers. The server 120 may include a network communication unit, a processor, a memory, etc. Specifically, the server 120 may store pending messages, and obtain pending messages corresponding to the message acquisition request according to the message acquisition request sent by the terminal 110. The server 120 may also receive the target progress information of the pending messages sent by the terminal 110, and feedback the target submission result of the pending messages to the terminal 110.
[0123] In the disclosed embodiment, a preset message queue is provided in the server, and the preset message queue can be a Kafka message queue (kafka). The Kafka message queue is a distributed message queue system that classifies and stores messages by topic. The cluster of the Kafka message queue is composed of multiple proxy servers (brokers), and each type of message is defined as a topic (topic). The messages within the same topic are partitioned and stored on different brokers according to certain key values and algorithms. Message producers (producers) and message consumers (consumers) can produce or consume messages corresponding to topics on multiple brokers. The Kafka message queue can be used to process data such as massive logs, user behaviors, and website operation statistics, and can meet the requirements of various real-time online and batch offline processing applications for low latency and batch throughput performance.
[0124] Figure 2 is an interactive flow chart of a message processing method according to an exemplary embodiment. Figure 2 As shown, the method includes the following steps.
[0125] S210. The server receives a message acquisition request sent by the terminal in response to the message processing request, and obtains the message to be processed from the preset message queue;
[0126] S220. Send a pending message to the terminal;
[0127] As an optional embodiment, before the terminal sends a message acquisition request to the server, the method further includes:
[0128] The terminal creates a message acquisition thread;
[0129] The terminal creates a message processing thread group.
[0130] As an alternative embodiment, see Figure 3 ,like Figure 3As shown, the message processing logic and the message acquisition logic run in different threads. The terminal creates a message acquisition thread, which can obtain pending messages from the server. The terminal creates a message processing thread group, which represents a thread group that processes multiple pending messages at the same time. The message processing thread group includes multiple message processing threads, and the message processing logic can be run independently on each message processing thread. The message acquisition thread and the message processing thread group can be asynchronous threads.
[0131] The message processing thread group can be a thread pool, which includes core threads, task queues, thread creation logic, and rejection processing logic. Among them, the core thread can run the message processing logic, and the core thread will not be recycled and can always exist. The task queue implements the first-in-first-out principle, and the pending messages are stored in the task queue waiting to be executed. The thread creation logic can create a new thread and run the message processing logic when the core thread is full and the thread pool is not full. The rejection processing logic is used to refuse to process the pending messages when the core thread is full, the task queue is full, and the thread pool is full.
[0132] When the core thread is in an idle state, the pending messages are processed based on the core thread. When the core thread is not idle and the task queue is not full, the pending messages are stored in the task queue and wait for execution. When the task queue is full and the thread pool is not full, the thread creation logic creates a thread to execute the pending messages waiting in the task queue. The thread created by the thread creation logic has a retention time. When the existence time of the thread created by the thread creation logic reaches the retention time, the thread created by the thread creation logic is cleared.
[0133] The message processing logic and the message acquisition logic run in different threads, which can avoid the process of acquiring messages and the process of processing messages from blocking each other. When the message processing thread group is processing a pending message, the message acquisition thread can obtain the next pending message of the pending message, thereby improving the efficiency of message processing.
[0134] As an alternative embodiment, see Figure 4 , the terminal sends a message acquisition request to the server, and obtains the pending messages from the server including:
[0135] S410. The terminal responds to the message processing request and sends a message acquisition request to the server based on the pre-created message acquisition thread;
[0136] S420. The server obtains the pending message corresponding to the message acquisition request from the preset message queue;
[0137] S430. The terminal receives the message to be processed based on the message acquisition thread;
[0138] S440. The terminal forwards the pending message to a pre-created message processing thread group based on the message acquisition thread.
[0139] As an optional embodiment, the terminal can actively pull the pending messages from the server based on the message acquisition thread. Based on the message acquisition thread, the terminal can generate a message acquisition request in response to the message processing request input by the user, and send the message acquisition request to the server. The server can obtain the pending message corresponding to the message acquisition request according to the message acquisition request, and send the pending message to the terminal. Based on the message acquisition thread, the terminal can receive the pending message sent by the server and forward the pending message to the message processing thread group in the terminal.
[0140] As an optional embodiment, the terminal may create a container for receiving the to-be-processed message. The terminal pulls the to-be-processed message from the server, and after obtaining the to-be-processed message, adds the pulled to-be-processed message to the container.
[0141] The terminal can actively obtain messages from the server, thereby improving the accuracy of message acquisition, so that the terminal can obtain the to-be-processed messages in the target.
[0142] As an optional embodiment, after obtaining the pending messages from a server provided with a preset message queue, the method further includes: when the pending messages have not been processed, in response to the next message processing request of the message processing request, obtaining the next pending message of the pending messages from the server provided with a preset message queue.
[0143] As an optional embodiment, the message acquisition thread and the message processing message group are asynchronous threads, and the process of acquiring messages can be performed asynchronously. The message acquisition thread can continue to work without waiting for the message processing thread group to process the pending messages that have been pulled. After obtaining the pending message from the server, the message acquisition thread can continue to obtain the next pending message of the pending message from the server. The order relationship between the pending message and the next pending message is sorted according to the processing order. The next pending message represents a message whose processing order is after the processing order of the pending message. In the server, the pending message and the next pending message may not be two messages or two groups of messages stored in order.
[0144] After the terminal obtains the next message to be processed, it forwards the next message to be processed to the message processing thread group. If there are idle threads in the message processing thread group, the next message to be processed can be processed.
[0145] The message acquisition thread can continuously acquire messages, which can improve the message acquisition efficiency. In addition, the message processing thread group can continuously process messages, thereby improving the resource utilization of the message processing thread group and improving the message processing efficiency.
[0146] As an alternative embodiment, see Figure 5 , the message acquisition request carries the target message partition identifier, and the method further includes:
[0147] S510. The server determines the target message partition corresponding to the target message partition identifier from the preset message queue;
[0148] S520. The server obtains the pending message from the target message partition and sends the pending message to the terminal;
[0149] S530. The terminal receives a message to be processed.
[0150] As an optional embodiment, the server may be a server with a preset message queue. The server may determine the corresponding target message partition according to the target message partition identifier carried in the message acquisition request. The server may obtain the pending message from the target message partition and send it to the terminal. The terminal receives the pending message sent by the server. When the preset message queue in the server is a kafka message queue, the terminal, as a consumer of the kafka message queue, sends a message acquisition request to the server. The target message partition identifier carried in the message acquisition request may be the topic of each partition in the kafka message queue. The server determines the broker corresponding to the topic and then obtains the pending message from the broker.
[0151] The preset message queue in the server stores messages in a distributed storage manner, which can improve the reliability and storage efficiency of message storage.
[0152] S230. The terminal processes the message to be processed and obtains the target processing status information corresponding to the message to be processed;
[0153] As an alternative embodiment, see Figure 6 , process the pending message, and obtain the target processing status information corresponding to the pending message, including
[0154] S610. Create a processing result receiving object corresponding to the message to be processed;
[0155] S620. Process the message to be processed, obtain the processing result corresponding to the message to be processed, and send the processing result to the processing result receiving object;
[0156] S630. When the processing result receiving object receives the processing result, it generates target processing status information indicating that the processing of the message to be processed is successful.
[0157] As an optional embodiment, the terminal can generate a processing result receiving object when processing the corresponding message by running the message processing logic in each message processing thread. The processing result receiving object represents the object of the target processing result after the receiving terminal processes the message to be processed. After the message processing thread in the terminal processes the message to be processed and obtains the target processing result, if the processing result receiving object receives the processing result, target processing status information indicating that the processing of the message to be processed is successful is generated. If the processing result receiving object does not receive the processing result, target processing status information indicating that the processing of the message to be processed fails is generated. The processing result receiving object can be a future object, and the future object can receive the result returned by the asynchronous thread.
[0158] When the terminal processes a message, it can generate corresponding target processing status information by checking whether the processing result receiving object has received the processing result, thereby determining whether the message has been processed successfully, thereby improving the effectiveness of message processing.
[0159] As an optional embodiment, the message to be processed includes multiple messages, the message processing thread group includes multiple message processing threads corresponding to the multiple messages respectively, and the message to be processed is processed based on a preset message processing logic, and the target processing state information corresponding to the message to be processed is obtained, including:
[0160] In each message processing thread, the terminal processes the corresponding message by running the message processing logic to obtain the target processing status information corresponding to each message.
[0161] As an optional embodiment, the corresponding message is processed to obtain the target processing result corresponding to each message, and the processing state indicated by the target processing state information can be determined according to whether the processing result receiving object receives the target processing result. In the case where the message to be processed includes multiple messages, the target processing result corresponding to the message to be processed includes the target processing result corresponding to each message. The message processing thread group includes multiple message processing threads. In the case where the message to be processed includes multiple messages, each message is assigned to the corresponding message processing thread, and the preset message processing logic is run to process the message corresponding to each message processing thread to obtain the target processing result corresponding to each message.
[0162] The message processing thread group can be a message processing thread pool, which includes core threads, task queues, thread creation logic and rejection processing logic. The message processing thread is the core thread in the message processing thread pool. When the number of messages in the pending messages is greater than the number of core threads in the message processing thread pool, the target messages corresponding to the number of core threads are obtained from the pending messages, and the message processing thread runs the message processing logic to process the corresponding target messages. Other messages in the pending messages except the target messages can be stored in the task queue of the message processing thread pool. When threads can be added to the message processing thread pool, the thread creation logic creates a new thread to process other messages. Alternatively, after the core thread has processed the corresponding target message, other unprocessed messages can be obtained from the task queue to process the other messages.
[0163] S240. The terminal obtains the last submission status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed;
[0164] As an alternative embodiment, see Figure 7 , the method further comprises:
[0165] S710. When sending a progress message of the previous message to be processed to the server, create a submission result receiving object corresponding to the previous message to be processed;
[0166] S720. Based on the submission result receiving object, receiving the submission result of the previous message to be processed sent by the server;
[0167] S730. When the submission result receiving object receives the submission result, it generates last submission status information indicating that the last message to be processed was submitted successfully.
[0168] As an optional embodiment, when the terminal sends the progress information of the last message to be processed to the server, a submission result receiving object corresponding to the last message to be processed can be created. After receiving the progress information of the last message to be processed, the server updates the message processing progress of the preset message queue, determines that the last message to be processed was submitted successfully, and sends the submission result to the terminal. When the submission result receiving object corresponding to the last message to be processed receives the submission result of the last message to be processed, it can be determined that the last message to be processed was submitted successfully, and the last submission status information indicating that the last message to be processed was submitted successfully is generated.
[0169] When the terminal sends the target progress information of the pending message to the server, it will also create a submission result receiving object corresponding to the pending message. After receiving the target progress information, the server obtains the target submission result of the pending message based on the target progress information and sends the target submission result to the terminal. When the submission result receiving object corresponding to the pending message receives the target submission result, it can be determined that the pending message has been submitted successfully, and the submission status information indicating that the pending message has been submitted successfully is generated.
[0170] Each time the terminal sends progress information of a pending message to the server, the terminal creates a submission result receiving object corresponding to the pending message, which is used to receive the submission result of the pending message obtained by the server based on the progress information of the pending message.
[0171] If the server does not receive the progress information of a pending message sent by the terminal within a preset waiting time, the server can determine that the submission has failed and send submission failure information to the terminal. When the submission result receiving object of the terminal receives submission failure information of a pending message, it can determine that the submission of the pending message has failed and generate submission status information indicating that the submission of the pending message has failed. The processing result receiving object can be a future object, which can receive the result returned by the asynchronous thread.
[0172] After receiving the progress information of a pending message, the server can return the target submission result. The submission result receiving object can determine that the pending message is submitted successfully according to the target submission result, thereby improving the effectiveness of information submission.
[0173] S250. The terminal determines the target progress information of the pending message and sends the target progress information to the server when the target processing status information indicates that the pending message has been successfully processed and the previous submission status information indicates that the previous pending message has been successfully submitted;
[0174] As an optional embodiment, the terminal can automatically submit the target progress information according to preset conditions. After processing the message to be processed, the terminal can generate target processing status information according to the target processing result of the message to be processed, and the terminal also stores the last submission status information of the previous message to be processed corresponding to the message to be processed. When the target processing status information indicates that the message to be processed is processed successfully, and the last submission status information of the previous message to be processed indicates that the previous message to be processed is submitted successfully, the terminal can automatically submit the target progress information of the message to be processed.
[0175] When the terminal processes the message, it can generate a processing result receiving object. The message processing thread in the terminal completes the processing of the pending message and obtains the target processing result. When the processing result receiving object receives the target processing result, it can be determined that the pending message has been processed successfully.
[0176] When the terminal submits progress information, it can generate a submission result receiving object. The terminal sends the submission progress to the server. After the server receives the submission progress and obtains the submission result, it sends the submission result to the terminal. When the submission result receiving object receives the submission result, it can be determined that the pending message has been submitted successfully.
[0177] The terminal sends the target progress information to the server by automatic submission and limits the sending conditions of the target progress information, so that the target progress information can be automatically sent while ensuring that the terminal has processed the message at least once, reducing the terminal's usage cost and avoiding the problem of low efficiency of manual sending by users, or the problem of missing messages when automatically sending based on a preset submission frequency, so that the messages can be effectively processed.
[0178] As an optional embodiment, the target progress information represents the processing progress of the preset message queue corresponding to the pending message. When there are multiple messages to be processed, the multiple messages can be sorted and numbered in the server from small to large in the order of storage of the preset message queue to obtain the number information corresponding to each message. The number information can be an offset, which is the offset information between the storage address of the message and the partition address of the partition. According to the number information, the terminal can read the pending messages in sequence.
[0179] After the terminal obtains the information to be processed and processes each message in the order corresponding to the number information, the number information corresponding to the last processed message can be used as the target progress information. The target progress information can also be the largest number information among multiple messages to be processed. When the preset message queue is a Kafka message queue, the target progress information can be the offset corresponding to the last message in this message processing process. When the server receives the offset sent by the terminal, it can identify the message corresponding to the offset, thereby identifying the processing progress of the terminal processing the messages in the preset message queue.
[0180] According to the number information corresponding to each message in the preset message queue, the order of message processing can be improved, and the processing progress can be marked, so as to avoid the terminal from repeatedly processing the message and reduce the redundancy of message processing.
[0181] As an optional embodiment, the server may update the message processing progress of the preset message queue based on the target progress information;
[0182] As an optional embodiment, when establishing a communication connection with a terminal, the server can obtain the terminal identification information of the terminal. Based on the terminal identification information and the target progress information, the server can obtain the processing progress of the terminal when processing the messages in the preset message queue. Based on the terminal identification information and the target progress information, the server identifies the message processed by the terminal in the preset message queue, thereby identifying the processing progress of the terminal processing the preset message queue. When the terminal sends a message acquisition request next time, the message after the identified message is sent to the terminal as a to-be-processed message.
[0183] S260. The server obtains the target submission result of the message to be processed based on the target progress information;
[0184] S270. The server sends the target submission result of the message to be processed to the terminal.
[0185] As an optional embodiment, the server can update the message processing progress of the preset message queue based on the target progress information, that is, identify the processing progress of the preset message queue according to the target progress information. The target progress information can be the number information corresponding to the message with the largest number in the messages to be processed. When the server establishes a communication connection with the terminal, it can obtain the terminal identification information of the terminal. According to the terminal identification information and the target progress information, the server can obtain the processing progress of the terminal when processing the messages in the preset message queue. The server identifies the messages processed by the terminal in the preset message queue according to the terminal identification information and the target progress information, thereby identifying the processing progress of the terminal processing the preset message queue. When the terminal sends a message acquisition request next time, the message after the identified message is sent to the terminal as a message to be processed.
[0186] As an optional embodiment, Figure 8 The present invention is a flowchart of a message processing method according to an exemplary embodiment. The method is applied to a terminal side. The steps of the method include:
[0187] S810. Process the message to be processed and obtain the target processing status information corresponding to the message to be processed;
[0188] S820. Obtain the last submission status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed;
[0189] S830. When the target processing status information indicates that the pending message is successfully processed and the previous submission status information indicates that the previous pending message is successfully submitted, determine the target progress information of the pending message and send the target progress information to the server, wherein the target progress information is used to indicate the server to obtain the target submission result of the pending message based on the target progress information;
[0190] S840. Receive the target submission result of the message to be processed sent by the server.
[0191] As an optional embodiment, the terminal can create a message acquisition thread, and the message acquisition thread can obtain pending messages from the server. The terminal can create a message processing thread group, and the message processing thread group represents a thread group that processes multiple pending messages at the same time. The message processing thread group includes multiple message processing threads, and each message processing thread can run message processing logic separately. The message acquisition thread of the terminal responds to the message processing request input by the user, generates a message acquisition request, sends the message acquisition request to a server with a preset message queue, and obtains the pending message corresponding to the message acquisition request from the server.
[0192] When the terminal completes processing the pending messages, it determines the target progress information corresponding to the pending messages. The target progress information may be the number information corresponding to the pending message with the largest number among the pending messages.
[0193] The message acquisition thread of the terminal receives the pending message and forwards the pending message to the message processing thread group. When there are multiple pending messages, each message is assigned to the corresponding message processing thread, and the message processing logic is run in each message processing thread to process the corresponding message to obtain the target processing result. When the message processing thread processes the corresponding message, a processing result receiving object is generated. When the processing result receiving object receives the target processing result, it can be determined that the pending message is processed successfully, and the target processing status information indicating that the pending message is processed successfully is generated.
[0194] The terminal obtains the last submission status information corresponding to the last pending message corresponding to the pending message. When the last submission status information indicates that the last pending message was submitted successfully, it can be determined that the last pending message was submitted successfully.
[0195] When the previous pending message is submitted successfully and the pending message is processed successfully, the target progress information is sent to the server. When the server receives the target progress information, it determines that the pending message is submitted successfully and updates the message processing progress of the preset message queue.
[0196] The terminal's message processing logic and message acquisition logic run in different threads, which can avoid blocking and improve message processing efficiency. The terminal automatically sends target progress information to the server under the conditions for sending target progress information, thereby automatically sending target progress information while ensuring that the terminal has processed the message at least once, reducing the terminal's usage cost.
[0197] As an optional embodiment, Fig. 9The present invention is a flowchart of a message processing method according to an exemplary embodiment. The method is applied to a server side. The steps of the method include:
[0198] S910. The receiving terminal receives a message acquisition request sent in response to the message processing request, and obtains a to-be-processed message from a preset message queue;
[0199] S920. Send a pending message to the terminal;
[0200] S930. Receive the target progress information of the pending message sent by the terminal, the target progress information is obtained when the target processing status information indicates that the pending message is successfully processed, and the last submission status information indicates that the last pending message of the pending message is successfully submitted, the target processing status information is determined based on the processing result of the pending message, and the last submission status information is determined based on the submission result of the last pending message;
[0201] S940. Based on the target progress information, obtain the target submission result of the message to be processed;
[0202] S950. Send the target submission result of the message to be processed to the terminal.
[0203] As an optional embodiment, a preset message queue is set on the server, and messages are stored in partitions in the preset message queue. Each message has number information, and the messages are sorted according to the size of the number information. The number information can be an offset. According to the number information, the terminal can read the messages to be processed in sequence.
[0204] After the server receives the message acquisition request sent by the terminal, it determines the corresponding target message partition according to the target message partition identifier carried in the message acquisition request. The server can obtain the pending message from the target message partition and send the pending message to the terminal. After the terminal completes processing the pending message, the server receives the target progress information sent by the terminal, updates the message processing progress of the preset message queue, determines that the submission is successful, and sends the submission result of the pending message to the terminal. If the server does not receive the target progress information sent by the terminal within a preset waiting time, it can be determined that the submission has failed, and a submission failure message is sent to the terminal.
[0205] After receiving the target progress information, the server determines that the pending message is submitted successfully, thereby improving the validity of the message submission and the order of message reading.
[0206] As an optional embodiment, the terminal can obtain the pending messages from the server, and the terminal runs the preset message processing logic to process the corresponding messages, obtain the target processing results of each message, and determine the target progress information. When the terminal determines that the pending messages obtained are all processed successfully, the target progress information is sent to the server. After sending the target progress information, the terminal obtains the next pending message of the pending message from the server, and repeats the message processing process and the target progress information sending process.
[0207] The terminal and the server wait for the message to be processed successfully before sending the message to the server, which can also ensure that the terminal processes the message at least once, thereby avoiding the problem of missing processed messages. At the same time, it also simplifies the process of message pulling and message processing.
[0208] The disclosed embodiment proposes a message processing method, which includes: the terminal processes the message to be processed and obtains the target processing status information corresponding to the message to be processed. The terminal obtains the last submission status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed. When the target processing status information indicates that the message to be processed is successfully processed, and the last submission status information indicates that the last message to be processed is successfully submitted, the terminal sends the target progress information to the server. The server obtains the target submission result of the message to be processed based on the target progress information, and sends the target submission result to the terminal. The method can automatically send the target progress information while ensuring that the terminal has processed the message at least once, so that the message can be effectively processed. The method can also create a message acquisition thread and a message processing thread group, and run the message processing logic and the message acquisition logic in different threads, so as to avoid blocking each other and improve the efficiency of message processing.
[0209] Fig.10 FIG. 1 is a block diagram of a message processing device according to an exemplary embodiment. Figure 8 , the device comprises:
[0210] The message processing module 1010 is configured to process the message to be processed and obtain target processing state information corresponding to the message to be processed;
[0211] The submission status acquisition module 1020 is configured to execute acquisition of the last submission status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed;
[0212] The submission information sending module 1030 is configured to determine the target progress information of the message to be processed and send the target progress information to the server when the target processing status information indicates that the message to be processed is successfully processed and the previous submission status information indicates that the previous message to be processed is successfully submitted, wherein the target progress information is used to indicate that the server obtains the target submission result of the message to be processed based on the target progress information;
[0213] The submission result receiving module 1040 is configured to execute the target submission result of the message to be processed sent by the receiving server.
[0214] As an optional embodiment, the message processing module 1010 includes:
[0215] A processing result receiving object creating unit is configured to execute creation of a processing result receiving object corresponding to the message to be processed;
[0216] A processing unit is configured to process the message to be processed, obtain a processing result corresponding to the message to be processed, and send the processing result to a processing result receiving object;
[0217] The target processing status information generating unit is configured to generate target processing status information indicating that the to-be-processed message has been processed successfully when the processing result receiving object receives the processing result.
[0218] As an optional embodiment, the device further includes:
[0219] A submission result receiving object creation unit is configured to create a submission result receiving object corresponding to the previous message to be processed when sending a progress message of the previous message to be processed to the server;
[0220] A submission result receiving unit, configured to execute and receive the submission result of the last message to be processed sent by the server;
[0221] The last submission status information generating unit is configured to generate the last submission status information indicating that the last message to be processed was successfully submitted when the submission result receiving object receives the submission result.
[0222] As an optional embodiment, the device further includes:
[0223] A message acquisition request sending module is configured to execute, in response to a message processing request, sending a message acquisition request to a server based on a pre-created message acquisition thread;
[0224] A pending message receiving module is configured to execute based on a message acquisition thread and receive a pending message corresponding to a message acquisition request;
[0225] The pending message forwarding module is configured to execute based on the message acquisition thread and forward the pending message to the pre-created message processing thread group.
[0226] As an optional embodiment, the message to be processed includes multiple messages, the message processing thread group includes multiple message processing threads corresponding to the multiple messages respectively, and the message processing module further includes:
[0227] The multi-thread processing unit is configured to execute in each message processing thread, process the corresponding message by running the message processing logic, and obtain the target processing state information corresponding to each message.
[0228] As an optional embodiment, the device further includes:
[0229] The next to-be-processed message acquisition module is configured to execute, when the to-be-processed message has not been processed, in response to the next message processing request of the message processing request, to acquire the next to-be-processed message of the to-be-processed message from a server provided with a preset message queue.
[0230] Fig.11 FIG. 1 is a block diagram of a message processing device according to an exemplary embodiment. Fig. 9 , the device comprises:
[0231] The to-be-processed message acquisition module 1110 is configured to execute a message acquisition request sent by the receiving terminal in response to a message processing request, and acquire the to-be-processed message from a preset message queue;
[0232] The to-be-processed message sending module 1120 is configured to execute sending of the to-be-processed message to the terminal;
[0233] The target progress information receiving module 1130 is configured to execute the target progress information sent by the receiving terminal, where the target progress information is obtained by the terminal when the target processing status information indicates that the pending message is processed successfully, and the previous submission status information indicates that the previous pending message of the pending message is submitted successfully, the target processing status information is determined based on the processing result of the pending message, and the previous submission status information is determined based on the submission result of the previous pending message;
[0234] The target submission result acquisition module 1140 is configured to obtain the target submission result of the message to be processed based on the target progress information;
[0235] The target submission result sending module 1150 is configured to execute the target submission result of sending the to-be-processed message to the terminal.
[0236] As an optional embodiment, the message acquisition request includes a target message partition identifier, and the to-be-processed message acquisition module 1120 includes:
[0237] A message partition determination unit is configured to determine a target message partition corresponding to a target message partition identifier from a preset message queue;
[0238] The partition message acquisition unit is configured to acquire the to-be-processed message from the target message partition.
[0239] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0240] Fig.12 is a block diagram of a message processing system according to an exemplary embodiment. Fig.12 ,The system comprises: a terminal and a server, the server is provided with a preset message queue, and the terminal and the server are electrically connected;
[0241] The server is configured to execute a message acquisition request sent by the receiving terminal in response to the message processing request, and acquire a to-be-processed message from a preset message queue;
[0242] The server is configured to execute sending of a pending message to a terminal;
[0243] The terminal is configured to process the message to be processed and obtain target processing state information corresponding to the message to be processed;
[0244] The terminal is configured to execute the acquisition of the last submitted status information corresponding to the progress information of the last message to be processed corresponding to the message to be processed;
[0245] The terminal is configured to determine target progress information of the message to be processed and send the target progress information to the server when the target processing status information indicates that the message to be processed is successfully processed and the last submission status information indicates that the last message to be processed is successfully submitted;
[0246] The server is configured to execute a target submission result of a message to be processed based on the target progress information;
[0247] The server is configured to execute a target submission result of sending a message to be processed to a terminal.
[0248] As an optional embodiment, the terminal includes: a message processing module;
[0249] The message processing module includes: a processing result receiving object creation unit, a processing unit and a target processing state information generation unit, the processing result receiving object creation unit and the processing unit are electrically connected, and the target processing state information generation unit and the processing result receiving object creation unit are electrically connected;
[0250] A processing result receiving object creating unit is configured to execute creation of a processing result receiving object corresponding to the message to be processed;
[0251] A processing unit is configured to process the message to be processed, obtain a processing result corresponding to the message to be processed, and send the processing result to a processing result receiving object;
[0252] The target processing status information generating unit is configured to generate target processing status information indicating that the to-be-processed message has been processed successfully when the processing result receiving object receives the processing result.
[0253] As an optional embodiment, the terminal includes a submission status acquisition module;
[0254] The submission status acquisition module includes: a submission result receiving object creation unit, a submission result receiving unit and a previous submission status information generation unit, the submission result receiving object creation unit and the submission result receiving unit are electrically connected, and the submission result receiving object creation unit and the previous submission status information generation unit are electrically connected;
[0255] A submission result receiving object creation unit is configured to create a submission result receiving object corresponding to the previous message to be processed when sending a progress message of the previous message to be processed to the server;
[0256] A submission result receiving unit, configured to execute and receive the submission result of the last message to be processed sent by the server;
[0257] The last submission status information generating unit is configured to generate the last submission status information indicating that the last message to be processed was successfully submitted when the submission result receiving object receives the submission result.
[0258] As an optional embodiment, the terminal further includes: a message acquisition request sending module, a pending message receiving module and a pending message forwarding module, the message acquisition request sending module and the pending message receiving module are electrically connected, and the pending message receiving module and the pending message forwarding module are electrically connected;
[0259] A message acquisition request sending module is configured to execute, in response to a message processing request, sending a message acquisition request to a server based on a pre-created message acquisition thread;
[0260] A pending message receiving module is configured to execute based on a message acquisition thread and receive a pending message corresponding to a message acquisition request;
[0261] The pending message forwarding module is configured to execute based on the message acquisition thread and forward the pending message to the pre-created message processing thread group.
[0262] As an optional embodiment, the message to be processed includes multiple messages, the message processing thread group includes multiple message processing threads corresponding to the multiple messages respectively, and the message processing module further includes:
[0263] The multi-thread processing unit is configured to execute in each message processing thread, process the corresponding message by running the message processing logic, and obtain the target processing state information corresponding to each message.
[0264] As an optional embodiment, the terminal further includes: a next message to be processed acquisition module;
[0265] The next to-be-processed message acquisition module is configured to execute, when the to-be-processed message has not been processed, in response to the next message processing request of the message processing request, to acquire the next to-be-processed message of the to-be-processed message from a server provided with a preset message queue.
[0266] As an optional embodiment, the message acquisition request includes a target message partition identifier, and the server further includes: a to-be-processed message acquisition module;
[0267] The to-be-processed message acquisition module comprises: a message partition determination unit and a partition message acquisition unit, the message partition determination unit and the partition message acquisition unit are electrically connected;
[0268] A message partition determination unit is configured to determine a target message partition corresponding to a target message partition identifier from a preset message queue;
[0269] The partition message acquisition unit is configured to acquire the to-be-processed message from the target message partition.
[0270] Regarding the system in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0271] Fig.13 is a block diagram of an electronic device for message processing according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.13As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a message processing method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.
[0272] Fig.14 is a block diagram of an electronic device for message processing according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Fig.14 As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a message processing method is implemented.
[0273] Those skilled in the art will understand that Fig.13 and Fig.14 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0274] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by a processor of an electronic device on the terminal side or a processor of an electronic device on the server side to complete the message processing method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0275] In an exemplary embodiment, a computer program product is also provided, including computer instructions, which, when executed by a processor, implement the message processing method executed by the terminal and / or the message processing method executed by the server.
[0276] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0277] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A message processing method, characterized in that: The method comprises: Processing the message to be processed to obtain target processing status information corresponding to the message to be processed; Obtaining last submission status information of a previous message to be processed corresponding to the message to be processed, wherein the last submission status information is determined based on a submission result of the previous message to be processed; When the target processing status information indicates that the pending message is successfully processed, and the previous submission status information indicates that the previous pending message is successfully submitted, determine the target progress information of the pending message, and send the target progress information to the server, so that the server obtains the target submission result of the pending message based on the target progress information, and the target progress information is used to indicate the processing progress of the pending message; Receive the target submission result of the message to be processed sent by the server.
2. The message processing method according to claim 1, characterized in that: The processing of the message to be processed to obtain the target processing status information corresponding to the message to be processed includes: Create a processing result receiving object corresponding to the message to be processed; Processing the message to be processed, obtaining a processing result corresponding to the message to be processed, and sending the processing result to the processing result receiving object; When the processing result receiving object receives the processing result, target processing status information indicating that the to-be-processed message has been successfully processed is generated.
3. The message processing method according to claim 1, characterized in that: The method further comprises: When sending a progress message of the previous message to be processed to the server, creating a submission result receiving object corresponding to the previous message to be processed; Based on the submission result receiving object, receiving the submission result of the previous message to be processed sent by the server; When the submission result receiving object receives the submission result, the previous submission status information indicating that the previous message to be processed was submitted successfully is generated.
4. The message processing method according to claim 1, characterized in that: Before the message to be processed is processed and target processing status information corresponding to the message to be processed is obtained, the method further includes: In response to the message processing request, sending the message acquisition request to the server based on a pre-created message acquisition thread; Based on the message acquisition thread, receiving a to-be-processed message corresponding to the message acquisition request; Based on the message acquisition thread, the to-be-processed message is forwarded to a pre-created message processing thread group.
5. The message processing method according to claim 4, characterized in that: The to-be-processed message includes a plurality of messages, the message processing thread group includes a plurality of message processing threads corresponding to the plurality of messages respectively, and the to-be-processed message is processed to obtain target processing state information corresponding to the to-be-processed message including: In each message processing thread, the corresponding message is processed by running the message processing logic to obtain the target processing state information corresponding to each message.
6. The message processing method according to claim 4, characterized in that: The method further comprises: In the case that the to-be-processed message has not been processed completely, in response to a next message processing request of the message processing request, a next to-be-processed message of the to-be-processed message is obtained from a server provided with a preset message queue.
7. A message processing method, characterized in that: The method comprises: The receiving terminal obtains the to-be-processed message from the preset message queue in response to the message acquisition request sent by the message processing request; Sending the to-be-processed message to the terminal; receiving target progress information of the message to be processed sent by the terminal, the target progress information being obtained by the terminal when the target processing status information indicates that the message to be processed is successfully processed, and the last submitted status information indicates that the last message to be processed of the message to be processed is successfully submitted, the target progress information is used to indicate the processing progress of the message to be processed by the terminal, the target processing status information is determined based on the processing result of the message to be processed, and the last submitted status information is determined based on the submission result of the last message to be processed; Based on the target progress information, obtaining the target submission result of the message to be processed; Sending a target submission result of the message to be processed to the terminal.
8. The message processing method according to claim 7, characterized in that: The message acquisition request includes a target message partition identifier, and the acquiring of a to-be-processed message from a preset message queue includes: Determine the target message partition corresponding to the target message partition identifier from the preset message queue; The to-be-processed message is obtained from the target message partition.
9. A message processing device, characterized in that: The device comprises: A message processing module is configured to process the message to be processed and obtain target processing state information corresponding to the message to be processed; A submission status acquisition module, configured to execute acquisition of last submission status information of a last message to be processed corresponding to the message to be processed, wherein the last submission status information is determined based on a submission result of the last message to be processed; a submission information sending module, configured to determine target progress information of the message to be processed, and send the target progress information to the server when the target processing status information indicates that the message to be processed is successfully processed and the previous submission status information indicates that the previous message to be processed is successfully submitted, so that the server obtains the target submission result of the message to be processed based on the target progress information, and the target progress information is used to indicate the processing progress of the message to be processed; The submission result receiving module is configured to execute and receive the target submission result of the message to be processed sent by the server.
10. The message processing device according to claim 9, characterized in that: The message processing module includes: A processing result receiving object creating unit, configured to execute creation of a processing result receiving object corresponding to the message to be processed; A processing unit, configured to process the message to be processed, obtain a processing result corresponding to the message to be processed, and send the processing result to the processing result receiving object; The target processing status information generating unit is configured to generate target processing status information indicating that the processing of the to-be-processed message is successful when the processing result receiving object receives the processing result.
11. The message processing device according to claim 9, characterized in that: The device also includes: A submission result receiving object creating unit, configured to create a submission result receiving object corresponding to the previous message to be processed when sending a progress message of the previous message to be processed to the server; a submission result receiving unit, configured to receive the submission result of the previous message to be processed sent by the server; The last submission status information generating unit is configured to generate the last submission status information indicating that the last message to be processed was successfully submitted when the submission result receiving object receives the submission result.
12. The message processing device according to claim 9, characterized in that: The device also includes: A message acquisition request sending module, configured to execute, in response to a message processing request, sending the message acquisition request to the server based on a pre-created message acquisition thread; A to-be-processed message receiving module, configured to execute based on the message acquisition thread, and receive the to-be-processed message corresponding to the message acquisition request; The to-be-processed message forwarding module is configured to execute forwarding the to-be-processed message to a pre-created message processing thread group based on the message acquisition thread.
13. The message processing device according to claim 12, characterized in that: The to-be-processed messages include a plurality of messages, the message processing thread group includes a plurality of message processing threads corresponding to the plurality of messages respectively, and the message processing module further includes: The multi-thread processing unit is configured to execute in each message processing thread, process the corresponding message by running the message processing logic, and obtain the target processing state information corresponding to each message.
14. The message processing device according to claim 12, characterized in that: The device also includes: The next to-be-processed message acquisition module is configured to execute, when the to-be-processed message has not been processed, in response to the next message processing request of the message processing request, to obtain the next to-be-processed message of the to-be-processed message from a server with a preset message queue.
15. A message processing device, characterized in that: The device comprises: A to-be-processed message acquisition module, configured to execute a message acquisition request sent by a receiving terminal in response to a message processing request, and acquire the to-be-processed message from a preset message queue; A to-be-processed message sending module, configured to execute sending of the to-be-processed message to the terminal; a target progress information receiving module, configured to receive target progress information of the message to be processed sent by the terminal, the target progress information being obtained by the terminal when the target processing status information indicates that the message to be processed is successfully processed, and the last submission status information indicates that the last message to be processed of the message to be processed is successfully submitted, the target progress information is used to indicate the processing progress of the message to be processed, the target processing status information is determined based on the processing result of the message to be processed, and the last submission status information is determined based on the submission result of the last message to be processed; A target submission result acquisition module is configured to obtain the target submission result of the message to be processed based on the target progress information; The target submission result sending module is configured to execute the target submission result of sending the message to be processed to the terminal.
16. The message processing device according to claim 15, characterized in that: The message acquisition request includes a target message partition identifier, and the to-be-processed message acquisition module includes: A message partition determining unit, configured to determine a target message partition corresponding to the target message partition identifier from the preset message queue; The partition message acquisition unit is configured to acquire the to-be-processed message from the target message partition.
17. A message processing system, characterized in that: The system comprises: a terminal and a server, wherein a preset message queue is provided in the server, and the terminal is electrically connected to the server; The server is configured to execute a message acquisition request sent by the receiving terminal in response to a message processing request, and acquire a to-be-processed message from the preset message queue; The server is configured to send the to-be-processed message to the terminal; The terminal is configured to process the message to be processed and obtain target processing state information corresponding to the message to be processed; The terminal is configured to execute acquisition of last submission status information of a last message to be processed corresponding to the message to be processed, wherein the last submission status information is determined based on a submission result of the last message to be processed; The terminal is configured to determine target progress information of the message to be processed and send the target progress information to the server when the target processing status information indicates that the message to be processed is successfully processed and the last submission status information indicates that the last message to be processed is successfully submitted, wherein the target progress information is used to indicate the processing progress of the message to be processed; The server is configured to execute a target submission result of the message to be processed based on the target progress information; The server is configured to execute a target submission result of sending the to-be-processed message to the terminal.
18. The message processing system according to claim 17, characterized in that: The terminal comprises: a message processing module; The message processing module comprises: a processing result receiving object creation unit, a processing unit and a target processing state information generation unit, wherein the processing result receiving object creation unit is electrically connected to the processing unit, and the target processing state information generation unit is electrically connected to the processing result receiving object creation unit; The processing result receiving object creating unit is configured to execute the creation of the processing result receiving object corresponding to the message to be processed; The processing unit is configured to process the message to be processed, obtain a processing result corresponding to the message to be processed, and send the processing result to the processing result receiving object; The target processing status information generating unit is configured to generate target processing status information indicating that the to-be-processed message has been successfully processed when the processing result receiving object receives the processing result.
19. The message processing system according to claim 17, characterized in that: The terminal further comprises: a submission result receiving object creation unit, a submission result receiving unit and a previous submission status information generation unit, wherein the submission result receiving object creation unit is electrically connected to the submission result receiving unit, and the submission result receiving object creation unit is electrically connected to the previous submission status information generation unit; The submission result receiving object creating unit is configured to create a submission result receiving object corresponding to the previous message to be processed when sending a progress message of the previous message to be processed to the server; The submission result receiving unit is configured to receive the submission result of the previous message to be processed sent by the server; The last submission status information generating unit is configured to generate last submission status information indicating that the last message to be processed was successfully submitted when the submission result receiving object receives the submission result.
20. The message processing system according to claim 17, characterized in that: The terminal further comprises: a message acquisition request sending module, a to-be-processed message receiving module and a to-be-processed message forwarding module, wherein the message acquisition request sending module is electrically connected to the to-be-processed message receiving module, and the to-be-processed message receiving module is electrically connected to the to-be-processed message forwarding module; The message acquisition request sending module is configured to execute, in response to the message processing request, sending the message acquisition request to the server based on a pre-created message acquisition thread; The to-be-processed message receiving module is configured to execute, based on the message acquisition thread, receiving the to-be-processed message corresponding to the message acquisition request; The to-be-processed message forwarding module is configured to execute forwarding the to-be-processed message to a pre-created message processing thread group based on the message acquisition thread.
21. The message processing system according to claim 20, characterized in that: The to-be-processed messages include a plurality of messages, the message processing thread group includes a plurality of message processing threads corresponding to the plurality of messages respectively, and the message processing module further includes: The multi-thread processing unit is configured to execute in each message processing thread, process the corresponding message by running the message processing logic, and obtain the target processing state information corresponding to each message.
22. The message processing system according to claim 17, characterized in that: The terminal further includes: a next to-be-processed message acquisition module; The next to-be-processed message acquisition module is configured to execute, when the to-be-processed message has not been processed, in response to a next message processing request of the message processing request, to acquire the next to-be-processed message of the to-be-processed message from a server provided with a preset message queue.
23. The message processing system according to claim 17, characterized in that: The message acquisition request includes a target message partition identifier, and the server further includes: a to-be-processed message acquisition module; The to-be-processed message acquisition module comprises: a message partition determination unit and a partition message acquisition unit, wherein the message partition determination unit and the partition message acquisition unit are electrically connected; The message partition determination unit is configured to determine the target message partition corresponding to the target message partition identifier from the preset message queue; The partition message acquisition unit is configured to acquire the to-be-processed message from the target message partition.
24. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the message processing method according to any one of claims 1 to 6, and / or to implement the message processing method according to claims 7 to 8.
25. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the instructions to implement the message processing method as described in any one of claims 1 to 6, and / or to implement the message processing method as described in claims 7 to 8.
26. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by the processor, the message processing method according to any one of claims 1 to 6 is implemented, and / or the message processing method according to any one of claims 7 to 8 is implemented.
Citation Information
Patent Citations
Exception handling method and device
CN105511975A
Message subscription processing device, system and method
CN106657349A
Message processing unit and method
CN107133111A
Message-oriented middleware message obtaining method, device and system
CN109391646A
Task management method, device and system
CN112035240A
