A method, apparatus, device and storage medium for processing a packet

By publishing group message events and managing cache identifiers in the high-frequency server, the problem of processing a large number of messages before the group message processing time is solved, realizing real-time group message processing and improving efficiency and reliability.

CN115543610BActive Publication Date: 2026-06-05CHINA CONSTRUCTION BANK +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2022-09-19
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, high-frequency servers need to process a large number of pending messages before the group message processing time, resulting in low processing efficiency and excessive consumption of computing resources.

Method used

By publishing group report events, selecting target processing threads to add message identifiers to the cache, and deleting the identifiers after the timeout period, real-time group report processing is achieved, avoiding duplicate processing and resource waste.

Benefits of technology

It improves message processing efficiency, reduces computing resource consumption, and ensures processing reliability and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115543610B_ABST
    Figure CN115543610B_ABST
Patent Text Reader

Abstract

The application relates to the field of data analysis, in particular to a message processing method and device, equipment and a storage medium, which are used to solve the problem of low message processing efficiency. The method comprises the following steps: performing message registration on obtained first to-be-processed messages, wherein the first to-be-processed messages are received messages or to-be-sent messages; after determining that the first to-be-processed message registration is successful, issuing a group reporting event for the first to-be-processed message, wherein the group reporting event is used to indicate that the first to-be-processed message is subjected to group reporting processing; after determining that each pre-stored alternative processing thread listens to the group reporting event, selecting a target processing thread from the alternative processing threads, and adding a message identifier of the first to-be-processed message in a cache; after determining that the addition is successful, adopting the target processing thread to perform group reporting processing on the first to-be-processed message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data analysis, and more particularly to a method, apparatus, device, and storage medium for processing messages. Background Technology

[0002] With the continuous development of technology, more and more devices can process messages. For example, online servers and high-frequency servers can register and process messages, and high-frequency servers can process messages in groups.

[0003] In related technologies, when processing messages, after registering the messages, the messages are stored in a message queue according to the order of sending and receiving messages. When the high-frequency server reaches the time for group message processing, all messages in the message queue are processed in sequence.

[0004] However, since the message processing time is a pre-specified time, while message sending and receiving are ongoing, a large number of pending messages will be stored in the message queue before the message processing time arrives. This means that when the message processing time arrives, the high-frequency server needs to process a large number of messages. Not only does it consume a lot of unnecessary processing time while waiting for the message processing time to arrive, resulting in low message processing efficiency, but the high-frequency server also suddenly consumes a lot of computing resources due to the large number of messages it needs to process at the same time, which further aggravates the problem of low message processing efficiency.

[0005] It is evident that message processing efficiency is relatively low among related technologies. Summary of the Invention

[0006] This application provides a method, apparatus, computer device, and storage medium for processing messages, which addresses the problem of low message processing efficiency.

[0007] Firstly, a method for processing messages is provided, including:

[0008] The first message to be processed is registered, wherein the first message to be processed is a received message or a message to be sent;

[0009] After confirming that the first message to be processed has been successfully registered, a group message event is issued for the first message to be processed, wherein the group message event is used to indicate that the first message to be processed is to be processed as a group message.

[0010] After confirming that each of the pre-stored candidate processing threads has listened to the group report event, a target processing thread is selected from the candidate processing threads, and the message identifier of the first message to be processed is added to the cache.

[0011] After confirming successful addition, the target processing thread is used to perform group processing on the first message to be processed.

[0012] Optionally, after confirming successful addition, the target processing thread performs group processing on the first message to be processed, including:

[0013] After confirming successful addition, the target processing thread sets a timeout duration for the message identifier association of the first message to be processed in the cache and starts timing. The timeout duration is used to limit the maximum duration for which the message identifier is stored in the cache.

[0014] Select the target processing thread from the pre-stored candidate processing threads to perform group processing on the first message to be processed;

[0015] When the timeout period is reached, the message identifier of the first pending message is deleted from the cache.

[0016] Optionally, after performing group processing on the first message to be processed using the target processing thread, the method further includes:

[0017] The target processing thread is used to generate a group message processing result, wherein the group message processing result indicates whether the group message processing was successful.

[0018] After determining that the group message processing result indicates group message failure, the control designates a server to add the message identifier of the first message to be processed to the cache.

[0019] After confirming successful addition, the specified server is controlled to determine whether the message identifier of the first message to be processed is associated with the set timeout duration in the cache.

[0020] After determining that the message identifier of the first message to be processed has been associated with the timeout period, the designated server is controlled to perform group processing on the first message to be processed.

[0021] Optionally, adding the message identifier of the first message to be processed to the cache includes:

[0022] Determine whether the message identifier of the first message to be processed exists in the cache;

[0023] If the message identifier of the first message to be processed does not exist, then the message identifier of the first message to be processed is added to the cache.

[0024] Optionally, when the first message to be processed is a message to be sent, the step of using the target processing thread to perform group processing on the first message to be processed includes:

[0025] The target processing thread is used to perform format conversion on the first message to be processed based on a preset data format;

[0026] Upon receiving a matching message associated with the first message to be processed, the matching message is registered.

[0027] After confirming that the message to be matched has been successfully registered, the target processing thread performs format conversion on the message to be matched based on the preset data format.

[0028] The target processing thread is used to match the first message to be processed after format conversion and the message to be matched after format conversion, so as to complete the group message processing of the first message to be processed.

[0029] Optionally, a group message processing time is set for the specified server association, which is used to indicate when the specified server performs group message processing;

[0030] Before performing group packet processing on the first message to be processed using the target processing thread, the method further includes:

[0031] Upon receiving the second message to be processed, the second message to be processed is registered.

[0032] After confirming that the second message to be processed has been successfully registered, and when the time interval between the current time and the group message processing time associated with the designated server is within a preset time range, the designated server is controlled to add the message identifier of the second message to be processed to the cache when the group message processing time arrives.

[0033] After confirming successful addition, control the designated server to perform group processing on the second message to be processed.

[0034] Secondly, an apparatus for processing messages is provided, comprising:

[0035] Acquisition module: used to register the first message to be processed, wherein the first message to be processed is a received message or a message to be sent;

[0036] Processing module: After determining that the first message to be processed has been successfully registered, it publishes a group report event for the first message to be processed, wherein the group report event is used to indicate that the first message to be processed is to be processed as a group report;

[0037] The processing module is further configured to: after determining that each of the pre-stored candidate processing threads has listened to the group report event, select a target processing thread from the candidate processing threads and add the message identifier of the first message to be processed to the cache;

[0038] The processing module is further configured to: after confirming successful addition, use the target processing thread to perform group processing on the first message to be processed.

[0039] Optionally, the processing module is specifically used for:

[0040] After confirming successful addition, the target processing thread sets a timeout duration for the message identifier association of the first message to be processed in the cache and starts timing. The timeout duration is used to limit the maximum duration for which the message identifier is stored in the cache.

[0041] Select the target processing thread from the pre-stored candidate processing threads to perform group processing on the first message to be processed;

[0042] When the timeout period is reached, the message identifier of the first pending message is deleted from the cache.

[0043] Optionally, the processing module is further configured to:

[0044] After performing group packet processing on the first packet to be processed using the target processing thread, the target processing thread generates a group packet processing result, wherein the group packet processing result indicates whether the group packet processing was successful.

[0045] After determining that the group message processing result indicates group message failure, the control designates a server to add the message identifier of the first message to be processed to the cache.

[0046] After confirming successful addition, the specified server is controlled to determine whether the message identifier of the first message to be processed is associated with the set timeout duration in the cache.

[0047] After determining that the message identifier of the first message to be processed has been associated with the timeout period, the designated server is controlled to perform group processing on the first message to be processed.

[0048] Optionally, the processing module is specifically used for:

[0049] Determine whether the message identifier of the first message to be processed exists in the cache;

[0050] If the message identifier of the first message to be processed does not exist, then the message identifier of the first message to be processed is added to the cache.

[0051] Optionally, when the first message to be processed is a message to be sent, the processing module is specifically used for:

[0052] The target processing thread is used to perform format conversion on the first message to be processed based on a preset data format;

[0053] Upon receiving a matching message associated with the first message to be processed, the matching message is registered.

[0054] After confirming that the message to be matched has been successfully registered, the target processing thread performs format conversion on the message to be matched based on the preset data format.

[0055] The target processing thread is used to match the first message to be processed after format conversion and the message to be matched after format conversion, so as to complete the group message processing of the first message to be processed.

[0056] Optionally, a group message processing time is configured for the designated server, wherein the group message processing time is used to indicate when the designated server performs group message processing; the processing module is further configured to:

[0057] Before performing group processing on the first message to be processed using the target processing thread, the second message to be processed is registered when the second message to be processed is obtained.

[0058] After confirming that the second message to be processed has been successfully registered, and when the time interval between the current time and the group message processing time associated with the designated server is within a preset time range, the designated server is controlled to add the message identifier of the second message to be processed to the cache when the group message processing time arrives.

[0059] After confirming successful addition, control the designated server to perform group processing on the second message to be processed.

[0060] Thirdly, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0061] Fourthly, a computer device is provided, comprising:

[0062] Memory, used to store program instructions;

[0063] A processor is configured to invoke program instructions stored in the memory and execute the method described in the first aspect according to the obtained program instructions.

[0064] Fifthly, a computer-readable storage medium is provided, the computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method as described in the first aspect.

[0065] In this embodiment, after successfully registering the first pending message, the device can publish a grouping event. This event instructs the device to perform grouping processing on the first pending message. By publishing the grouping event, the device can use pre-stored alternative processing threads to listen for the event. Once it is confirmed that each alternative processing thread has detected the grouping event, it indicates that the device can perform grouping processing on the first pending message. This allows the device to select a target processing thread from the alternative threads to perform grouping processing on the first pending message. This eliminates the need to wait for the high-frequency server to reach the grouping processing time and perform unified grouping processing on all pending messages obtained before that time, thus achieving real-time grouping processing and improving message processing efficiency. Simultaneously, it avoids the situation where processing a large number of pending messages simultaneously leads to excessive device computing resource consumption and reduced message processing efficiency.

[0066] Furthermore, when using the target processing thread to perform group processing on the first processing message, the target processing thread can first add the message identifier of the first processing message to the cache to indicate that the first processing message is currently being processed in a group. This avoids repeated group processing of the first processing message due to device or thread abnormalities, or when the group processing time of the high-frequency server is reached, thus ensuring the reliability of the processed message. Attached Figure Description

[0067] Figure 1A An application domain interaction diagram illustrating the message processing method provided in this application embodiment;

[0068] Figure 1B This is one application scenario of the message processing method provided in the embodiments of this application;

[0069] Figure 2 A flowchart illustrating a method for processing messages provided in an embodiment of this application;

[0070] Figure 3 A schematic diagram illustrating the principle of a message processing method provided in this application embodiment;

[0071] Figure 4 A schematic diagram of the message processing method provided in the embodiments of this application. Figure 2 ;

[0072] Figure 5 A schematic diagram of the message processing method provided in the embodiments of this application. Figure 3 ;

[0073] Figure 6 A schematic diagram of the message processing method provided in the embodiments of this application. Figure 4 ;

[0074] Figure 7A A flowchart illustrating a method for processing messages provided in an embodiment of this application. Figure 2 ;

[0075] Figure 7B A flowchart illustrating a method for processing messages provided in an embodiment of this application. Figure 3 ;

[0076] Figure 8 A schematic diagram of a message processing apparatus provided in an embodiment of this application;

[0077] Figure 9 A schematic diagram of the structure of the message processing apparatus provided in the embodiments of this application. Figure 2 . Detailed Implementation

[0078] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0079] It should be noted that the embodiments of this application involve data related to sending and receiving messages. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0080] The application fields of the message processing method provided in the embodiments of this application will be briefly introduced below.

[0081] With the continuous development of technology, more and more devices can process messages. For example, online servers and high-frequency servers can register and process messages, and high-frequency servers can process messages in groups.

[0082] For example, in the financial sector, please refer to... Figure 1A S101, the bond purchaser and bond seller can complete the bond transaction on the bond trading platform through their respective terminal devices. S102, after the bond transaction is completed, the trading platform can send the bond transaction information in the form of messages to the respective terminal devices of the bond purchaser and bond seller. S103, simultaneously, the trading platform can also send the bond transaction information in the form of messages to the bond custody platform.

[0083] S104. After receiving bond transaction information from the trading platform, the bond custody platform can provide bond purchasers and bond sellers with a service to query bond transaction information, so that the bond purchasers and bond sellers can obtain the bond transaction information in the form of messages through their respective terminal devices. At the same time, after obtaining the bond transaction information, the bond custody platform can also directly send the bond transaction information in the form of messages to the respective terminal devices of the bond purchasers and bond sellers.

[0084] S105 After receiving the bond transaction information sent by the bond custody platform, the terminal devices of both the bond purchaser and the bond seller can match it with the bond transaction information sent by the trading platform. By matching the bond transaction information, the correctness and authenticity of the bond transaction information can be determined.

[0085] S106 After verifying the correctness and authenticity of the bond transaction information through their respective terminal devices, the bond purchaser and the bond seller can send a confirmation instruction to the bond custody platform in the form of a message.

[0086] S107 After receiving confirmation instructions from the bond purchaser and the bond seller through their respective terminal devices in the form of messages, the bond custody platform can generate a bond transaction contract, and then process fund transfers or bond transfers in accordance with the bond transaction contract.

[0087] S108, the bond custody platform can also send bond trading contracts in the form of messages to the respective terminal devices of the bond purchaser and the bond seller.

[0088] For example, please refer to the terminal equipment of the bond purchaser and the bond seller. Figure 1B The terminal equipment includes an online server cluster, a high-frequency server cluster, and a database. The online server cluster contains n online servers, each capable of interacting with the front end to obtain messages requiring registration. After obtaining a message, each online server can create a message registration task, which extracts information from the message and stores it in the database. The high-frequency server cluster contains m high-frequency servers, each capable of interacting with the online servers. After an online server creates a message registration task, the high-frequency server executes that task, extracts information from the message, and stores it in the database.

[0089] In related technologies, when processing messages, after registering the messages, the messages are stored in a message queue according to the order of sending and receiving messages. When the high-frequency server reaches the time for group message processing, all messages in the message queue are processed in sequence.

[0090] However, since the message processing time is a pre-specified time, while message sending and receiving are ongoing, a large number of messages awaiting processing will be stored in the message queue before the message processing time arrives. This means that when the message processing time arrives, the high-frequency server needs to process a large number of messages. Not only does it consume a lot of unnecessary processing time while waiting for the message processing time to arrive, resulting in low message processing efficiency, but the high-frequency server also suddenly consumes a lot of computing resources due to the large number of messages it needs to process at the same time, which further aggravates the problem of low message processing efficiency.

[0091] It is evident that message processing efficiency is relatively low among related technologies.

[0092] To address the issue of low message processing efficiency, this application proposes a message processing method. In this method, a first message to be processed is registered, which can be a received message or a message to be sent. After successful registration of the first message to be processed, a group message event is published for the first message to be processed, indicating that group message processing should be performed on the first message to be processed. After confirming that each of the pre-stored candidate processing threads has detected the group message event, a target processing thread is selected from the candidate processing threads, and the message identifier of the first message to be processed is added to the cache. After successful addition, the target processing thread performs group message processing on the first message to be processed.

[0093] In this embodiment, after successfully registering the first pending message, the device can publish a grouping event. This event instructs the device to perform grouping processing on the first pending message. By publishing the grouping event, the device can use pre-stored alternative processing threads to listen for the event. Once it is confirmed that each alternative processing thread has detected the grouping event, it indicates that the device can perform grouping processing on the first pending message. This allows the device to select a target processing thread from the alternative threads to perform grouping processing on the first pending message. This eliminates the need to wait for the high-frequency server to reach the grouping processing time and perform unified grouping processing on all pending messages obtained before that time, thus achieving real-time grouping processing and improving message processing efficiency. Simultaneously, it avoids the situation where processing a large number of pending messages simultaneously leads to excessive device computing resource consumption and reduced message processing efficiency.

[0094] Furthermore, when using the target processing thread to perform group processing on the first processing message, the target processing thread can first add the message identifier of the first processing message to the cache to indicate that the first processing message is currently being processed in a group. This avoids repeated group processing of the first processing message due to device or thread abnormalities, or when the group processing time of the high-frequency server is reached, thus ensuring the reliability of the processed message.

[0095] The following describes the application scenarios of the message processing method provided in this application.

[0096] Please refer to Figure 1B This is a schematic diagram illustrating an application scenario of the message processing method provided in this application. The application scenario includes a client 101 and a server 102. The client 101 and the server 102 can communicate with each other. The communication method can be wired, such as through a network cable or serial cable; or wireless, such as through Bluetooth or Wi-Fi. No specific limitation is imposed.

[0097] Client 101 generally refers to any device capable of sending messages to or receiving messages from server 102, such as terminal devices, third-party applications accessible by the terminal devices, or web pages accessible by the terminal devices. Terminal devices include, but are not limited to, mobile phones, computers, smart financial devices, smart home appliances, vehicle terminals, or aircraft. Server 102 generally refers to any device capable of processing messages, such as terminal devices or servers. Servers include, but are not limited to, cloud servers, local servers, or associated third-party servers. Both client 101 and server 102 can utilize cloud computing to reduce the consumption of local computing resources; similarly, they can also utilize cloud storage to reduce the consumption of local storage resources.

[0098] As one embodiment, the client 101 and the server 102 can be the same device, and there is no specific limitation. In this embodiment, the client 101 and the server 102 are described as different devices.

[0099] The following is based on Figure 1B Using server 102 as the main component, this paper provides a detailed description of the message processing method provided in the embodiments of this application. Please refer to [link / reference]. Figure 2 This is a flowchart illustrating a method for processing messages provided in an embodiment of this application.

[0100] S201, Register the first message to be processed.

[0101] The first message to be processed is either a received message or a message to be sent. The server can receive messages from other devices, such as bond transaction information sent by a trading platform or bond custody platform in the form of a message. The server can also send messages to other devices, such as sending confirmation instructions to bond custody vouchers in the form of a message.

[0102] After receiving the first message to be processed, the server can register the message, for example, extract key information from the message and store the key information in the database.

[0103] Please refer to Figure 3 The server can be a high-frequency server in a high-frequency server cluster or an online server in an online server cluster. After the high-frequency server or online server obtains the first message to be processed, it can register the message. If the registration is successful, for example, if the first message to be processed is successfully stored in the database, then S202 continues; if the registration fails, for example, if the first message to be processed is not successfully stored in the database, then the high-frequency server or online server can obtain the registration result, which indicates that the registration of the first message to be processed has failed. Therefore, the high-frequency server or online server can re-register the first message to be processed, avoiding situations such as directly discarding the first message to be processed, which could cause message processing abnormalities.

[0104] S202, after confirming that the first pending message has been successfully registered, issue a group report event for the first pending message.

[0105] After confirming that the first pending message has been successfully registered, the server can publish a group message event for it. This event instructs the server to perform group message processing on the first pending message. By publishing a group message event, the backup processing threads on the server can begin processing the first pending message upon receiving the event, without needing to cache it and wait for the designated server to reach the group message processing time before processing it, thus improving message processing efficiency.

[0106] S203, after confirming that each of the pre-stored candidate processing threads has listened to the group report event, select the target processing thread from each candidate processing thread and add the message identifier of the first message to be processed to the cache.

[0107] The server can pre-store various candidate processing threads. These threads can be used to process messages or handle other tasks on the server, without specific restrictions. Upon detecting a group message event, each candidate thread can select a target processing thread from among its options to process the first message to be processed. The number of candidate processing threads pre-stored in the server can be greater than the number of candidate processing threads detecting group message events, thus allowing the target processing thread to be selected only from among the candidate processing threads that have detected group message events.

[0108] The target processing thread can be selected based on the current computing resource usage of each candidate processing thread; it can also be selected based on the number of tasks currently pending processing for each candidate processing thread; or it can be selected based on the priority of each candidate processing thread, with the highest priority among them. There are no specific restrictions.

[0109] When processing the first pending message, the target processing thread can first add a message identifier of the first pending message to the cache to indicate that the first pending message is currently being processed, thus preventing other threads or other devices from processing the first pending message repeatedly. The cache can be a Redis database, etc., and there are no specific restrictions.

[0110] As one implementation, when adding the message identifier of the first pending message to the cache, it can be first determined whether the message identifier of the first pending message exists in the cache. If the message identifier of the first pending message exists, it means that the first pending message is already being processed and does not need to be processed again, so the addition of the message identifier of the first pending message fails. If the message identifier of the first pending message does not exist, it means that the first pending message has not yet been processed and can be processed at present, so the message identifier of the first pending message is added to the cache, and the addition of the message identifier of the first pending message is successful.

[0111] After successful addition, S204 can be executed to use the target processing thread to perform group processing on the first pending message. Otherwise, the target processing thread is terminated, and the group processing process for the first pending message is stopped.

[0112] Please refer to Figure 4 After successful registration, the server can simultaneously publish a group message event and control the designated server to process the first pending message. If each alternative processing thread first listens to the group message event, selects the target processing thread from among them, and adds the message identifier of the first pending message to its cache, then the target processing thread will process the first pending message. Alternatively, if the designated server reaches its group message processing time and has already added the message identifier of the first pending message to its cache, then the designated server will process the first pending message. These two message processing methods occur simultaneously, ensuring that the first pending message is processed immediately, improving processing efficiency. Furthermore, adding the message identifier to the cache effectively implements a mutex lock, preventing duplicate processing even if the first pending message is processed in multiple ways, thus improving the reliability of message processing.

[0113] S204 After confirming successful addition, the target processing thread is used to perform group processing on the first pending message.

[0114] After confirming that the message identifier of the first pending message has been successfully added to the cache, the target processing thread can then be used to perform group processing on the first pending message.

[0115] As one example, the message identifier stored in the cache can be set with a timeout period. The timeout period is used to limit the maximum time that the message identifier is stored in the cache. After a period of time, the message identifier will be automatically deleted from the cache, so that it will not occupy the cache storage resources indefinitely, and the message corresponding to the message identifier will not be unable to be processed again due to the message identifier being stored in the cache indefinitely.

[0116] Once the server confirms successful addition, the target processing thread can be used to set a timeout duration for the packet identifier of the first pending packet in the cache and start timing. The target processing thread is selected from the pre-stored candidate processing threads to perform group processing on the first pending packet. When the timeout duration is reached, the packet identifier of the first pending packet is deleted from the cache.

[0117] As one embodiment, when the first message to be processed is a message to be sent, a target processing thread is used to perform group processing on the first message to be processed. This can be done by first using the target processing thread to perform format conversion on the first message to be processed based on a preset data format; then, when a matching message associated with the first message to be processed is received, the matching message is registered, and after confirming that the matching message is successfully registered, the target processing thread performs format conversion on the matching message based on the preset data format; then, the target processing thread matches the format-converted first message to be processed and the format-converted matching message to complete the group processing of the first message to be processed.

[0118] Please refer to Figure 5 The server can query other devices for matching messages associated with the first pending message, or wait to receive matching messages associated with the first pending message from other devices; there are no specific restrictions. After obtaining the matching messages, the server can register them. After successful registration, the target processing thread can perform format conversion on the matching messages based on a preset data format to obtain the matching records. Simultaneously, the target processing thread can also perform format conversion on the first pending message based on a preset data format to obtain the first pending record.

[0119] The server matches the first pending record with the record to be matched. The matching result can be used as the processing result for the first pending message to be grouped. If the matching result indicates a successful match, the server can send confirmation instructions to other devices, etc., without any restrictions. If the matching result indicates a failed match, the server can re-acquire the record to be matched associated with the first pending message and re-process the first pending message to be grouped.

[0120] As one embodiment, after performing grouping processing on the first pending message, a target processing thread can be used to generate a grouping processing result, where the grouping processing result indicates whether the grouping processing was successful. If the grouping processing result indicates failure, the server can control a designated server to add the message identifier of the first pending message to its cache, thereby allowing the designated server to perform grouping processing on the first pending message. This avoids situations where the target processing thread cannot perform grouping processing on the first pending message, resulting in missed processing.

[0121] After confirming successful addition, you can control the specified server to check whether the message identifier of the first pending message is associated with a timeout setting in the cache. Once it is confirmed that the message identifier of the first pending message is associated with a timeout setting, you can control the specified server to perform group processing on the first pending message.

[0122] As one embodiment, if the designated server is associated with a group message processing time setting, which indicates when the designated server should perform group message processing, then when the target processing thread is processing the first pending message, if the server receives the second pending message, it can continue to select a candidate processing thread from among the candidate processing threads to process the second pending message. If there is no candidate processing thread among the candidate processing threads that can be used to process the second pending message, or if the time interval between the current time and the group message processing time associated with the designated server is within a preset time range, then the designated server can also be controlled to process the second pending message.

[0123] Taking controlling a designated server to process the second pending message as an example, upon receiving the second pending message, it is registered. After confirming successful registration, and if the time interval between the current time and the group message processing time associated with the designated server is within a preset time range, the designated server adds the message identifier of the second pending message to its cache when the group message processing time arrives. After confirming successful addition, the designated server performs group message processing on the second pending message.

[0124] The following example illustrates the message processing method provided in this application embodiment, using the message received by the server as an incoming message and the message to be sent by the server as a outgoing message.

[0125] Please refer to Figure 6 This is a schematic diagram illustrating the principle of a designated server. The designated server can be a server cluster used to handle various tasks, including group report processing tasks. For example, the server cluster may contain a first server, a second server, and a third server. These three servers share a common database. For each task, routing can be selected from these three servers through cluster scheduling. For instance, during a group report processing session, all group report processing tasks would be routed to one of these servers. This single server would then bear a heavy processing load in a short period, leading to low processing efficiency and increasing the risk of missed or incorrect processing, resulting in low reliability.

[0126] There can be multiple group report processing times. For example, a group report processing time is reached at a specified interval. The specified interval can be ten minutes, two hours, five days, or one year, etc.

[0127] Therefore, to improve message processing efficiency, a combination of group message events and designated servers can be used for group message processing. Please refer to [reference needed]. Figure 7A .

[0128] In the S701, when a high-frequency server or online server needs to send a message to other devices, it can first obtain past data. After obtaining the past data, the high-frequency server or online server can create a message registration task, so that the next node can rely on the message registration task to register the past data. Each step can be equivalent to a node, and each node can independently process the task and generate a processing result. At the same time, each node can rely on the processing result of the previous node to process the current processing task.

[0129] S702 After receiving the past report, the high-frequency server or online server can register the past report. For example, from a received bond transaction information, key elements can be extracted and stored, and a group report task can be created. This group report task can be used to confirm the correctness of the bond transaction information.

[0130] If registration is successful, then S703 can be executed; if registration fails, then S702 can be executed again.

[0131] S703: After successful registration, the high-frequency server or online server can publish a grouping event, enabling the target processing thread to perform grouping processing on past reports based on the grouping event. Thus, the server used to register past reports can directly perform grouping processing on those past reports. Simultaneously, the high-frequency server or online server can control a designated server to perform grouping processing on past reports. For example, it can store past reports in a message middleware associated with the designated server, so that when the grouping processing time arrives, the designated server can sequentially perform grouping processing on each message stored in the message middleware.

[0132] S704: Before the target processing thread performs group processing on the past report, or before the specified server performs group processing on the past report at the time of group processing, the message identifier of the past report is added to the cache. If the message identifier of the past report does not exist in the cache, the message identifier of the past report can be added to the cache, indicating that the addition is successful; if the message identifier of the past report exists in the cache, the message identifier of the past report cannot be added to the cache, indicating that the addition fails.

[0133] Upon successful addition, either the target processing thread or the specified server can perform group reporting on the past reports. If the target processing thread successfully adds the reports, then the target processing thread will perform group reporting on the past reports; if the specified server successfully adds the reports, then the specified server will perform group reporting on the past reports.

[0134] S705 When using the target processing thread to process past reports in groups, the past reports can be format converted first. For example, if the past report is bond transaction information, the field names of the key information in the bond transaction information can be converted into the field names corresponding to the preset matching elements to achieve format conversion and obtain the past report matching records.

[0135] Simultaneously, incoming reports are retrieved from the bond custody platform and registered. The reports are then format-converted; for example, the field names of key information in the reports are converted into the field names corresponding to the matching elements mentioned above. This data format conversion yields the matching records for the incoming reports.

[0136] When controlling a designated server to process past reports in groups, past report matching records and incoming report matching records can be obtained directly.

[0137] S706 matches the past and incoming report matching records. For example, it retrieves the values ​​corresponding to the field names of the matching elements from the past and incoming report matching records according to the matching rules and performs the matching to generate a group report result. If the match is successful, the group report result is used to indicate that the match was successful, and S707 continues to be executed; if the match fails, the group report result is used to indicate that the match failed, and S704 to S706 are re-executed to re-process the past reports into group reports.

[0138] S707 If the group report result indicates a successful match, then a confirmation instruction is returned, for example, a message is sent to the bond custody platform indicating that the bond transaction information is correct, so that the bond custody platform can generate a bond transaction contract based on the bond transaction information.

[0139] S708 After a bond trading contract is generated on the bond custody platform, the status of the generated bond trading contract can be queried.

[0140] In this embodiment, upon successful outbound packet registration and the publication of a group packet event, group packet processing is initiated after the event is detected. This allows the server that registered the packet to immediately process the outbound packet into a group packet without waiting for a designated server, such as a high-frequency group packet server, to perform group packet processing at the designated time. By publishing a group packet event, both the packet processing time and the number of packets that a designated server needs to process at the designated time can be shortened.

[0141] Furthermore, simultaneously triggering group report events and designating a server for group report processing may lead to duplicate group reports. Therefore, in this embodiment, caching is used, for example, the SETNX operation in a Redis database performs idempotency verification. If the addition is successful, the opportunity to execute group report processing is obtained; otherwise, group report processing cannot be executed.

[0142] When adding a message identifier to the cache, you can set a timeout duration for its association; additionally, in the event of a group message failure, you can configure a compensatory handling method to ensure the reliability of message processing. Please refer to [link / reference]. Figure 7B .

[0143] S71 uses a target processing thread to add the message identifier of the report to the cache, and controls the specified server to add the message identifier of the report to the cache at the time of group report processing.

[0144] S72, if the target processing thread successfully adds the packet identifier to the cache, then set a timeout duration for that packet identifier. If the timeout duration is set successfully, then start timing; if the timeout duration is set unsuccessfully, then start timing, and the target processing thread will no longer set a timeout duration for that packet identifier. Regardless of whether the timeout duration is set successfully or not, continue executing S703.

[0145] If the target processing thread fails to add the message identifier to the cache, then the target processing thread is terminated and no longer used; instead, group processing is performed on the previous messages.

[0146] If the specified server successfully adds the packet identifier to the cache during packet processing, then set a timeout duration associated with that packet identifier. The specified server then starts timing.

[0147] If the designated server fails to add the packet identifier to the cache during packet processing, it determines whether the packet identifier in the cache is associated with a timeout period. If no timeout period is associated with the packet identifier, a timeout period is set for it to avoid the packet identifier being unable to be deleted from the cache if the target processing thread fails to set a timeout period for it, thus avoiding unnecessary storage resource consumption. If a timeout period has been set for the packet identifier, control over the designated server ends.

[0148] S73, if the target processing thread successfully adds the message identifier to the cache, then the target processing thread performs group processing on past messages; if the specified server successfully adds the message identifier to the cache at the time of group processing, then the specified server performs group processing on past messages.

[0149] S74, after successful group report processing, terminates the target processing thread or terminates control over the specified server.

[0150] When using a target processing thread for group reporting, if the group reporting process fails or an error occurs, the message identifier of the previous report can be deleted from the cache, and the specified server can be controlled to re-process the group report at the time of group reporting. When controlling a specified server to process group reports, if the group reporting process fails or an error occurs, the message identifier of the previous report can be deleted from the cache, and the target processing thread can be used to re-process the group report, or the abnormal situation can be recorded for anomaly analysis.

[0151] In this embodiment of the application, if the forward and backward information is registered on the online server, the group report can be completed on the current online server; if the forward and backward information is registered on the high-frequency server, the group report can be completed on the current high-frequency server.

[0152] Furthermore, after registration, there's no need to wait for the high-frequency group reporting server to process the group reports during the processing time. Each group reporting task can be completed before the processing time arrives, shortening the overall message processing time. Simultaneously, multiple servers can work together to complete group reporting tasks, improving server utilization and reducing task processing time.

[0153] Furthermore, it effectively solves the idempotency verification problem when deploying multiple instances, supports high concurrency and large data volume business operations, and provides remedial solutions for group reporting failure data.

[0154] Based on the same inventive concept, embodiments of this application provide an apparatus for processing messages, capable of implementing the functions corresponding to the aforementioned message processing method. Please refer to... Figure 8 The device includes an acquisition module 801 and a processing module 802, wherein:

[0155] Acquisition module 801: used to register the first message to be processed, wherein the first message to be processed is a received message or a message to be sent;

[0156] Processing module 802: After determining that the first message to be processed has been successfully registered, it publishes a group report event for the first message to be processed, wherein the group report event is used to indicate that the first message to be processed is to be processed as a group report.

[0157] The processing module 802 is also used to: after determining that each of the pre-stored candidate processing threads has listened to the group report event, select the target processing thread from each candidate processing thread and add the message identifier of the first message to be processed to the cache.

[0158] The processing module 802 is also used to: after confirming that the addition is successful, use the target processing thread to perform group processing on the first message to be processed.

[0159] In one possible embodiment, the processing module 802 is specifically used for:

[0160] After confirming successful addition, the target processing thread sets a timeout duration for the message identifier association of the first message to be processed in the cache and starts timing. The timeout duration is used to limit the maximum duration for which the message identifier is stored in the cache.

[0161] Select the target processing thread from the pre-stored candidate processing threads to perform group processing on the first message to be processed;

[0162] When the timeout period is reached, the message identifier of the first pending message is deleted from the cache.

[0163] In one possible embodiment, the processing module 802 is further configured to:

[0164] After performing group processing on the first message to be processed using the target processing thread, the target processing thread generates the group processing result, which indicates whether the group processing was successful.

[0165] After determining that the group message processing result indicates a group message failure, the control designated server adds the message identifier of the first message to be processed to the cache;

[0166] After confirming successful addition, control the specified server in the cache to determine whether the message identifier of the first pending message is associated with the set timeout duration;

[0167] After confirming that the message identifier of the first message to be processed has been associated with the set timeout period, control the designated server to perform group processing on the first message to be processed.

[0168] In one possible embodiment, the processing module 802 is specifically used for:

[0169] Determine if the message identifier of the first pending message exists in the cache;

[0170] If the message identifier of the first message to be processed does not exist, then add the message identifier of the first message to be processed to the cache.

[0171] In one possible embodiment, when the first message to be processed is a message to be sent, the processing module 802 is specifically used for:

[0172] The target processing thread performs format conversion on the first message to be processed based on a preset data format.

[0173] Upon receiving the matching message associated with the first message to be processed, the message to be matched is registered.

[0174] After confirming that the message to be matched has been successfully registered, the target processing thread performs format conversion on the message to be matched based on the preset data format.

[0175] The target processing thread is used to match the first message to be processed after format conversion and the message to be matched after format conversion, so as to complete the group message processing of the first message to be processed.

[0176] In one possible embodiment, the designated server is associated with a group message processing time setting, which indicates the time when the designated server performs group message processing; the processing module 802 is further configured to:

[0177] Before performing group processing on the first message to be processed using the target processing thread, the second message to be processed is registered when the second message to be processed is obtained.

[0178] After confirming that the second pending message has been successfully registered, and when the time interval between the current time and the group message processing time associated with the designated server is within a preset time range, the designated server is controlled to add the message identifier of the second pending message to the cache when the group message processing time arrives.

[0179] After confirming successful addition, control the designated server to perform group processing on the second pending message.

[0180] Please refer to Figure 9 The aforementioned message processing apparatus can run on a computer device 900. The current and historical versions of the data storage program, as well as the application software corresponding to the data storage program, can be installed on the computer device 900, which includes a processor 980 and a memory 920. In some embodiments, the computer device 900 may include a display unit 940, which includes a display panel 941 for displaying a user-interactive interface, etc.

[0181] In one possible embodiment, the display panel 941 may be configured in the form of a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

[0182] The processor 980 is used to read a computer program and then execute the methods defined by the computer program. For example, the processor 980 reads a data storage program or file, thereby running the data storage program on the computer device 900 and displaying the corresponding interface on the display unit 940. The processor 980 may include one or more general-purpose processors, and may also include one or more DSPs (Digital Signal Processors) for performing related operations to implement the technical solutions provided in the embodiments of this application.

[0183] The memory 920 generally includes main memory and secondary storage. Main memory can be random access memory (RAM), read-only memory (ROM), and cache, etc. Secondary storage can be a hard disk, optical disk, USB flash drive, floppy disk, or magnetic tape drive, etc. The memory 920 is used to store computer programs and other data. The computer programs include applications corresponding to each client, and other data may include data generated after the operating system or applications are run, including system data (e.g., operating system configuration parameters) and user data. In this embodiment, program instructions are stored in the memory 920, and the processor 980 executes the program instructions in the memory 920 to implement any of the methods described in the preceding figures.

[0184] The aforementioned display unit 940 is used to receive input digital information, character information, or contact touch operations / non-contact gestures, and to generate signal inputs related to user settings and function control of the computer device 900. Specifically, in this embodiment, the display unit 940 may include a display panel 941. The display panel 941, for example, is a touch screen, which can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or on the display panel 941), and drive corresponding connection devices according to a pre-set program.

[0185] In one possible embodiment, the display panel 941 may include two parts: a touch detection device and a touch controller. The touch detection device detects the player's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 980. It can also receive and execute commands from the processor 980.

[0186] The display panel 941 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the display unit 940, in some embodiments, the computer device 900 may also include an input unit 930. The input unit 930 may include an image input device 931 and other input devices 932, wherein the other input devices may include, but are not limited to, one or more of the following: a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick.

[0187] In addition to the above, the computer device 900 may also include a power supply 990 for powering other modules, an audio circuit 960, a near-field communication module 970, and an RF circuit 910. The computer device 900 may also include one or more sensors 950, such as an accelerometer, a light sensor, and a pressure sensor. The audio circuit 960 specifically includes a speaker 961 and a microphone 962, for example, the computer device 900 can use the microphone 962 to collect the user's voice and perform corresponding operations.

[0188] As one embodiment, the number of processors 980 can be one or more, and the processors 980 and the memory 920 can be coupled together or relatively independent.

[0189] As one example, Figure 9 The processor 980 in the middle can be used to implement, for example Figure 8 The functions of the acquisition module 801 and the processing module 802 in the process.

[0190] As one example, Figure 9 The processor 980 in the text can be used to implement the functions of the server or terminal devices discussed above.

[0191] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0192] Alternatively, if the integrated units of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to the prior art, can be embodied in the form of software products, for example, through a computer program product. This computer program product is stored in a storage medium and includes several instructions to cause a computer device to execute all or part of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

[0193] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for processing messages, characterized in that, include: The first message to be processed is registered, wherein the first message to be processed is a received message or a message to be sent; After confirming that the first message to be processed has been successfully registered, a group message event is issued for the first message to be processed, wherein the group message event is used to indicate that the first message to be processed is to be processed as a group message. After confirming that each of the pre-stored candidate processing threads has listened to the group report event, a target processing thread is selected from the candidate processing threads, and the message identifier of the first message to be processed is added to the cache. After confirming successful addition, the target processing thread is used to perform group packet processing on the first message to be processed; The target processing thread is used to generate a group message processing result, wherein the group message processing result indicates whether the group message processing was successful. After determining that the group message processing result indicates group message failure, the control designates a server to add the message identifier of the first message to be processed to the cache. After confirming successful addition, the specified server is controlled to determine whether the message identifier of the first message to be processed is associated with the set timeout duration in the cache. After determining that the message identifier of the first message to be processed has been associated with the timeout period, the designated server is controlled to perform group processing on the first message to be processed.

2. The method according to claim 1, characterized in that, After confirming successful addition, the target processing thread performs group processing on the first message to be processed, including: After confirming successful addition, the target processing thread sets a timeout duration for the message identifier association of the first message to be processed in the cache and starts timing. The timeout duration is used to limit the maximum duration for which the message identifier is stored in the cache. Select the target processing thread from the pre-stored candidate processing threads to perform group processing on the first message to be processed; When the timeout period is reached, the message identifier of the first pending message is deleted from the cache.

3. The method according to claim 1 or 2, characterized in that, Adding the message identifier of the first message to be processed to the cache includes: Determine whether the message identifier of the first message to be processed exists in the cache; If the message identifier of the first message to be processed does not exist, then the message identifier of the first message to be processed is added to the cache.

4. The method according to claim 1 or 2, characterized in that, When the first message to be processed is a message to be sent, the step of using the target processing thread to perform group processing on the first message to be processed includes: The target processing thread is used to perform format conversion on the first message to be processed based on a preset data format; Upon receiving a matching message associated with the first message to be processed, the matching message is registered. After confirming that the message to be matched has been successfully registered, the target processing thread performs format conversion on the message to be matched based on the preset data format. The target processing thread is used to match the first message to be processed after format conversion and the message to be matched after format conversion, so as to complete the group message processing of the first message to be processed.

5. The method according to claim 1 or 2, characterized in that, The specified server is associated with a group message processing time setting, which is used to indicate the time when the specified server performs group message processing. Before performing group packet processing on the first message to be processed using the target processing thread, the method further includes: Upon receiving the second message to be processed, the second message to be processed is registered. After confirming that the second message to be processed has been successfully registered, and when the time interval between the current time and the group message processing time associated with the designated server is within a preset time range, the designated server is controlled to add the message identifier of the second message to be processed to the cache when the group message processing time arrives. After confirming successful addition, control the designated server to perform group processing on the second message to be processed.

6. An apparatus for processing messages, characterized in that, include: Acquisition module: used to register the first message to be processed, wherein the first message to be processed is a received message or a message to be sent; Processing module: After determining that the first message to be processed has been successfully registered, it publishes a group report event for the first message to be processed, wherein the group report event is used to indicate that the first message to be processed is to be processed as a group report; The processing module is further configured to: after determining that each of the pre-stored candidate processing threads has listened to the group report event, select a target processing thread from the candidate processing threads and add the message identifier of the first message to be processed to the cache; The processing module is further configured to: after determining that the addition is successful, use the target processing thread to perform group packet processing on the first message to be processed; use the target processing thread to generate a group packet processing result, wherein the group packet processing result indicates whether the group packet processing is successful; after determining that the group packet processing result indicates that the group packet processing is unsuccessful, control the designated server to add the message identifier of the first message to be processed to the cache; after determining that the addition is successful, control the designated server to determine in the cache whether the message identifier of the first message to be processed is associated with a timeout setting; after determining that the message identifier of the first message to be processed is associated with the timeout setting, control the designated server to perform group packet processing on the first message to be processed.

7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method as described in any one of claims 1 to 5.

8. A computer device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the method as described in any one of claims 1 to 5 according to the obtained program instructions.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method as described in any one of claims 1 to 5.