A double-packet matching method, device, equipment, medium and product

CN123020541APending Publication Date: 2026-10-30成方金融科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611155549.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-10-30

AI Technical Summary

Benefits of technology

[0010]本发明实施例的技术方案,通过接收目标报文,并提取所述目标报文的业务标识和报文类型;根据所述业务标识和所述报文类型从报文热池的待匹配报文中查找是否存在所述目标报文对应的关联报文;其中,所述报文热池位于内存中高速存储区域,用于暂存先接收的报文;若存在,则将所述目标报文和所述关联报文进行合并,并删除报文冷池中所述目标报文和所述关联报文;其中,所述报文冷池为持久化存储区域,用于备份所有待匹配报文;若不存在,则将所述目标报文以所述业务标识为键、以所述目标报文的报文内容为值,写入所述报文热池,并异步将所述目标报文写入所述报文冷池。上述技术方案,通过报文热池进行报文实时匹配,以及报文冷池进行报文备份,通过两级存储模式进行报文处理的方式,在确保报文匹配精度的同时还能够保证数据不丢失。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020541A_ABST
    Figure CN123020541A_ABST
Patent Text Reader

Abstract

The application discloses a double-message matching method, device, equipment, medium and product, and relates to the technical field of electric communication. The method comprises the following steps: receiving a target message, and extracting the service identifier and the message type of the target message; searching whether there is an associated message corresponding to the target message in the to-be-matched messages of a message hot pool according to the service identifier and the message type; the message hot pool is located in a high-speed storage area in the memory, and is used for temporarily storing the first received message; if there is, the target message and the associated message are merged, and the target message and the associated message in a message cold pool are deleted; the message cold pool is a persistent storage area, and is used for backing up all to-be-matched messages; if there is not, the target message is written into the message hot pool with the service identifier as the key and the message content of the target message as the value, and the target message is written into the message cold pool asynchronously. The above technical scheme improves the real-time and accurate matching of the message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of telecommunications technology, and in particular to a dual-message matching method, apparatus, device, medium, and product. Background Technology

[0002] In distributed business systems, a complete transaction often consists of two related messages, such as a payment request message and a payment confirmation message, or an uplink command and a downlink response from an IoT device. Due to factors such as network latency, queue scheduling, and differences in transmission paths, these two messages may arrive out of order. Failure to efficiently and accurately correlate these messages will lead to business processing delays, inconsistent states, or even transaction failures.

[0003] Currently, there are some technical solutions in the industry for handling out-of-order packets, but they all have their own limitations and cannot effectively solve the problem of accurately associating two different types of packets when they arrive out of order at the business level. Summary of the Invention

[0004] This invention provides a dual-message matching method, apparatus, device, medium, and product to improve the real-time and accurate matching of messages.

[0005] According to one aspect of the present invention, a dual-message matching method is provided, the method comprising: Receive the target message and extract the service identifier and message type of the target message; search for the existence of an associated message corresponding to the target message in the message hot pool of unmatched messages based on the service identifier and message type; wherein, the message hot pool is located in a high-speed storage area in memory and is used to temporarily store previously received messages; If they exist, the target message and the associated message are merged, and the target message and the associated message are deleted from the message cold pool; wherein, the message cold pool is a persistent storage area used to back up all messages to be matched; If it does not exist, the target message is written to the message hot pool with the service identifier as the key and the message content of the target message as the value, and the target message is asynchronously written to the message cold pool.

[0006] According to another aspect of the present invention, a dual-message matching device is provided, the device comprising: The target message acquisition module is used to receive target messages and extract the service identifier and message type of the target messages; The message matching module is used to search for whether there is an associated message corresponding to the target message in the message hot pool from the messages to be matched according to the service identifier and the message type; wherein, the message hot pool is located in the high-speed storage area in memory and is used to temporarily store previously received messages; The message processing module is used to merge the target message and the associated message if they exist, and delete the target message and the associated message from the message cold pool; wherein, the message cold pool is a persistent storage area used to back up all messages to be matched; The message processing module is further configured to, if the target message does not exist, write the target message into the message hot pool with the service identifier as the key and the message content of the target message as the value, and asynchronously write the target message into the message cold pool.

[0007] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the dual-message matching method according to any embodiment of the present invention.

[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the dual-message matching method according to any embodiment of the present invention.

[0009] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the dual-message matching method according to any embodiment of the present invention.

[0010] The technical solution of this invention involves receiving a target message and extracting its service identifier and message type. Based on the service identifier and message type, it searches the message pool for a corresponding associated message in the pending match messages. The message pool is located in a high-speed storage area in memory and is used to temporarily store previously received messages. If an associated message exists, the target message and the associated message are merged, and both are deleted from the message cold pool. The message cold pool is a persistent storage area used to back up all pending match messages. If no associated message exists, the target message is written to the message hot pool using the service identifier as the key and its message content as the value, and is asynchronously written to the message cold pool. This technical solution, through real-time message matching in the message hot pool and message backup in the message cold pool, employs a two-level storage mode for message processing, ensuring both message matching accuracy and data integrity.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart of a dual-message matching method provided according to an embodiment of the present invention; Figure 2 This is a flowchart of a dual-message matching method provided according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a dual-message matching device according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the dual-message matching method of this invention. Detailed Implementation

[0014] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0015] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0016] Furthermore, it should be noted that the collection, storage, use, processing, transmission, provision, and disclosure of messages and related data involved in the technical solution of this invention all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0017] Currently, there are existing message matching solutions, including message ordering solutions based on the network session layer. These solutions primarily maintain message order by preserving the session state at the network transport layer. For example, when sending a message, the timestamp of the current message is compared with the timestamp of the previous message in the same message stream to determine the difference in link latency, thereby selecting an appropriate path for transmission and avoiding out-of-order messages. However, this solution operates at the network transport layer and only addresses message ordering within the same transmission session. For scenarios involving dual-message association at the service layer (such as request and acknowledgment messages that may be transmitted through different connections), this solution cannot establish cross-session associations. Furthermore, it relies on transport layer identifiers (such as 5-tuples), which may be modified when messages pass through gateways or proxies, causing the association to fail.

[0018] Another approach is a multi-channel data ordering scheme based on the Data Processing Unit (DPU). This scheme utilizes the hardware capabilities of the DPU to associate each data request message with a sequence number. Data packets are stored in a first memory, and corresponding data parameters (including indicator bits) are stored in a second memory. The transmission of a data packet is determined based on the indicator bit. When the indicator bit is 0, the system waits until it becomes 1 before transmitting, thus ensuring order. However, this scheme relies on dedicated hardware (DPU), resulting in high costs and primarily suitability for data channel scenarios within data centers. For general business systems, it cannot rely on specific hardware deployments. Furthermore, the ordering mechanism of this scheme is based on a preset sequence number order rather than dynamic message pairing, lacking flexibility when handling the association of two different types of messages.

[0019] Another approach is to handle out-of-order file transfer messages based on their request start positions. This solution, used in network security devices, records file transfer request messages passing through the device using a linked list. The order of messages is identified based on their request start positions. A target start position is also set. Each time a request message is received, its request start position is compared to the target start position to identify out-of-order messages, and the linked list is used to resolve this issue. However, this solution addresses the reordering of similar request messages in file transfer scenarios, rather than the cross-correlation of two different types of business messages. Its core is queue reordering based on sequence numbers, which cannot handle business scenarios where two types of messages are interdependent and require precise pairing. Furthermore, the linked list structure has low search efficiency, becoming a performance bottleneck in high-concurrency scenarios. Additionally, this solution lacks an automatic mechanism for handling abnormal messages that cannot be matched for extended periods.

[0020] Figure 1 This is a flowchart of a dual-message matching method according to an embodiment of the present invention. This embodiment is applicable to different types of dual-message matching. The method can be executed by a dual-message matching device, which can be implemented in hardware and / or software. This device can be configured in an electronic device carrying dual-message matching functionality, such as a server. Figure 1 As shown, the method includes: S110. Receive the target message and extract the service identifier and message type of the target message.

[0021] The target message refers to the message received in real time that needs to be matched. The service identifier is used to uniquely identify the message corresponding to the service; for example, it can be a transaction serial number or a global sequence number. The message type refers to the type of the target message.

[0022] Specifically, the system receives target messages in real time, parses the target messages, and extracts the service identifier and message type of the target messages.

[0023] S120. Based on the service identifier and message type, search the message pool for the matching messages to be matched to see if there is a related message corresponding to the target message.

[0024] The message hot pool is located in a high-speed in-memory storage area and is used to temporarily store previously received messages. Optionally, the message hot pool can use a high-performance distributed cache or a local concurrent hash table to store messages. Messages are stored in key-value pairs, where the key is the business identifier and the value is the message content and status markers, such as the message type, arrival timestamp, and current message priority. Associated messages refer to messages that match the target message. For example, in a transaction scenario, if the target message is a payment request message, then the associated message is a payment confirmation message.

[0025] Specifically, if it exists, execute S130; if it does not exist, execute S140.

[0026] Optionally, the message hot pool can be divided into multiple priority areas according to message priority, such as different ordered sets in Redis or multiple queues in local memory; each priority area stores the messages to be matched according to the corresponding message priority.

[0027] Accordingly, based on the service identifier and message type, the system searches for the existence of a related message corresponding to the target message in the message hot pool of messages to be matched. This includes: based on the service identifier and message type, and according to message priority, searching for the existence of a related message corresponding to the target message in the message hot pool of messages in the higher priority area.

[0028] Specifically, priority is given to matching packets from the highest priority regions in the packet hot pool based on the target service identifier and packet type. An atomic operation is then used to check if a corresponding associated packet exists among the packets to be matched in the corresponding region. It should be noted that this atomic "retrieval" operation avoids contention caused by multiple threads processing the same pair of packets simultaneously.

[0029] Understandably, when a new message, i.e. the target message, arrives and attempts to match it, the system prioritizes retrieving complementary messages from high-priority regions. This means that the longer the waiting time, the more likely the message is to be matched by subsequent complementary messages and thus be processed first.

[0030] S130. Merge the target message and associated message, and delete the target message and associated message from the message cold pool.

[0031] The message cold pool is a persistent storage area used to back up all messages to be matched. Optionally, the message cold pool uses a relational database or persistent key-value storage to record persistent copies of all messages to be matched, preventing data loss due to system crashes.

[0032] Specifically, if a match is successful—that is, if the associated message corresponding to the target message is found in the message hot pool—the target message and the associated message are merged and sent to the subsequent business processing queue to trigger real-time business logic. At the same time, the corresponding message records of the target message and the associated message are asynchronously deleted from the message cold pool, or the status of the two messages is marked as completed.

[0033] Furthermore, if the match is successful but subsequent business processing fails, a decision can be made on whether to roll back or retry based on business needs. In this case, the target message can be put back into the message hot pool or into the dead letter queue.

[0034] S140. Write the target message into the message hot pool with the service identifier as the key and the message content of the target message as the value, and asynchronously write the target message into the message cold pool.

[0035] Specifically, if a match fails—that is, if no associated message corresponding to the target message is found in the message hot pool—the target message is written to the message hot pool with the service identifier as the key and the message content as the value. The timestamp of the target message arriving in the message hot pool is recorded, the initial priority of the target message is set to the lowest level, such as level 0, and a reasonable expiration time is set for the target message to prevent memory overflow. Simultaneously, the target message is asynchronously written to the message cold pool for persistence.

[0036] It should be noted that when writing messages to the message hot pool, it is necessary to prevent messages of the same type with the same association key from being written repeatedly. This can be achieved, for example, through the putIfAbsent class operation.

[0037] It should be noted that the messages to be matched in the hot pool are set with reasonable expiration times to prevent memory from growing indefinitely; the cold pool maintains a stable amount of data through regular cleanup.

[0038] The technical solution of this invention involves receiving a target message and extracting its service identifier and message type. Based on the service identifier and message type, it searches the message pool for a corresponding associated message in the pending match messages. The message pool is located in a high-speed storage area in memory and is used to temporarily store previously received messages. If an associated message exists, the target message and the associated message are merged, and both are deleted from the message cold pool. The message cold pool is a persistent storage area used to back up all pending match messages. If no associated message exists, the target message is written to the message hot pool using the service identifier as the key and its message content as the value, and is asynchronously written to the message cold pool. This technical solution, through real-time message matching in the message hot pool and message backup in the message cold pool, employs a two-level storage mode for message processing, ensuring both message matching accuracy and data integrity.

[0039] Figure 2 This is a flowchart of a dual-message matching method according to an embodiment of the present invention; this embodiment, based on the above embodiments, specifically elaborates on the maintenance of the messages to be matched in the message hot pool. Figure 2 As shown, the method includes: S210. Receive the target message and extract the service identifier and message type of the target message.

[0040] S220. Based on the service identifier and message type, search the message pool for the matching messages to be matched to see if there is a related message corresponding to the target message.

[0041] The message hot pool is located in a high-speed storage area in memory and is used to temporarily store previously received messages.

[0042] Specifically, if it exists, execute S230; if it does not exist, execute S240.

[0043] S230. Merge the target message and associated message, and delete the target message and associated message from the message cold pool.

[0044] The message cold pool is a persistent storage area used to back up all messages to be matched. S240. Write the target message into the message hot pool with the service identifier as the key and the message content of the target message as the value, and asynchronously write the target message into the message cold pool.

[0045] Optionally, the method further comprises: periodically scanning all to-be-matched messages in the message hot pool; calculating the waiting time of the to-be-matched messages; adjusting the message priority of the to-be-matched messages according to the waiting time, and adjusting the priority storage area of the to-be-matched messages.

[0046] Specifically, all to-be-matched messages in the message hot pool are scanned periodically, the time difference between the current time and the arrival time of a to-be-matched message is taken as the waiting time of the to-be-matched message, then the message priority of the to-be-matched message is adjusted according to the waiting time and the priority waiting time range corresponding to the message priority, and the to-be-matched message is stored in the corresponding priority storage area.

[0047] Exemplarily, adjusting the message priority of the to-be-matched messages according to the waiting time and adjusting the priority storage area of the to-be-matched messages comprises: if the waiting time is within a priority waiting time range, promoting the message priority of the to-be-matched message to the message priority corresponding to the priority waiting time range, and promoting the to-be-matched message to the priority storage area corresponding to the priority waiting time range; if the waiting time is greater than or equal to the maximum waiting time, removing the to-be-matched message from the message hot pool, and updating the corresponding message state of the to-be-matched message in the message cold pool; wherein the maximum waiting time is within the priority waiting time range.

[0048] Specifically, if the waiting time is within the priority waiting time range, the message priority of the to-be-matched message is promoted to the message priority corresponding to the priority waiting time range, and the to-be-matched message is promoted to the priority storage area corresponding to the priority waiting time range. For example, when the waiting time < T1, the priority remains at level 0; when T1 ≤ waiting time < T2, the priority is promoted to level 1; when T2 ≤ waiting time < T3, the priority is promoted to level 2; and so on until the highest priority level N is reached. The thresholds T1, T2 and the like can be dynamically configured according to service requirements (for example, T1=1s, T2=3s, T3=5s...). Then, if the waiting time is greater than or equal to the maximum waiting time, the to-be-matched message is removed from the message hot pool, and the corresponding message state of the to-be-matched message in the message cold pool is updated.

[0049] It should be noted that different message types correspond to different maximum waiting times, and the maximum waiting time corresponding to different message types can also be determined according to service importance, for example, 30 seconds for ordinary transactions and 10 seconds for high-priority transactions.

[0050] Understandably, through dynamic priority scheduling based on waiting time—an aging mechanism—first-arriving packets gradually gain higher priority as their waiting time increases, thus obtaining a higher priority for matching. This fundamentally avoids the problem of first-arriving packets being "cut in line" by later-arriving packets or being shelved for a long time, ensuring fair processing of all services. The overall system latency distribution is smoother, avoiding long-tail latency phenomena and improving user experience and business stability.

[0051] For example, while adjusting the message priority of the message to be matched according to the waiting time and adjusting the priority storage area of ​​the message to be matched, the method also includes: taking the message to be matched that has timed out and has not been matched in the message cold pool and the message to be matched that has been removed from the message hot pool as the message to be detected; performing anomaly detection on the message to be detected to obtain the anomaly detection result.

[0052] Specifically, if a message in the message cold pool has not been matched for a set time, the message to be matched is taken as a message to be detected. At the same time, messages to be matched that have been removed from the message hot pool are also taken as messages to be detected. An anomaly detection is performed on the messages to be detected through a compensation mechanism to obtain the anomaly detection result.

[0053] Understandably, by automating the abnormal message detection and compensation mechanism, anomaly handling is reduced, manual intervention is lessened, business downtime is shortened, and system robustness and data consistency are improved. The compensation engine's multi-level detection and flexible strategy configuration can adapt to the anomaly handling needs of different business scenarios.

[0054] Anomaly detection includes at least one of the following operations: Send a re-examination request to the message source of the message to be matched; the re-examination request is used to inquire whether the message to be matched has been sent or whether it can be resent. Perform a service rollback operation on the matched message; Mark the matching message as abnormal.

[0055] Specifically, for retransmissionable scenarios, a re-query request can be sent to the source of the message to be matched; the re-query request is used to inquire whether the message to be matched has been sent or whether it can be resent. For scenarios with strict consistency requirements, business rollback operations are performed on the message to be matched, such as canceling temporarily withheld funds or releasing inventory. For scenarios with eventual consistency, the message to be matched is marked as abnormal, the business is completed based on partial information, and the abnormal mark is recorded for post-event reconciliation. Furthermore, if automatic retries reach the maximum number, such as 3, and still fail, a manual work order is generated and pushed to the operations and maintenance personnel.

[0056] It should be noted that a compensation task table is maintained to record key information, compensation strategy, execution count, and execution result for each abnormal message, supporting idempotent execution and retries of compensation tasks.

[0057] In a concrete example, in an automated tax invoice submission scenario, the payment message, i.e., the target message (of type A), is received first. This payment message is stored in the message hot pool, and its priority is set to level 0. The aging thread scans every 100ms. After a 2-second wait, the message priority is raised to level 1, and after a 4-second wait, it is raised to level 2. At this point, the business message, i.e., the associated message (of type B), is received. The matching engine finds the payment message in the priority 2 area of ​​the message hot pool and successfully matches it, completing the business processing.

[0058] Suppose that after a payment message (Type A) arrives, a business message (Type B) fails to arrive due to a network failure. The aging thread continuously increases its priority. When the waiting time reaches 80% of the maximum waiting time (MaxWaitTime), such as 30 seconds (24 seconds), an early warning signal is issued, and the compensation engine begins monitoring. When the waiting time reaches 30 seconds, the aging thread removes the message from the hot pool and hands it over to the compensation engine.

[0059] The compensation engine executes operations according to the configured strategy, such as "retry 3 times". The first retry involves querying the initiator to inquire about the status of the transaction. If the return is "success", the compensation engine simulates and generates a business message, merges it with the payment message, and sends it for business processing; if the return is "failure", a rollback is triggered, releasing resources; if there is a timeout or no response, the failure is recorded, and the next retry is awaited. After three failed retries, a work order is generated and pushed to manual processing.

[0060] It should be noted that if the system restarts, unmatched payment messages in the cold pool will be reloaded into the hot pool, restoring their waiting time and priority. The compensation engine will also reload its compensation tasks to ensure that compensation is not interrupted.

[0061] The technical solution of this invention involves receiving a target message and extracting its service identifier and message type. Based on the service identifier and message type, it searches the message pool for a corresponding associated message in the pending match messages. The message pool is located in a high-speed storage area in memory and is used to temporarily store previously received messages. If an associated message exists, the target message and the associated message are merged, and both are deleted from the message cold pool. The message cold pool is a persistent storage area used to back up all pending match messages. If no associated message exists, the target message is written to the message hot pool using the service identifier as the key and its message content as the value, and is asynchronously written to the message cold pool. This technical solution, through real-time message matching in the message hot pool and message backup in the message cold pool, employs a two-level storage mode for message processing, ensuring both message matching accuracy and data integrity.

[0062] Figure 3 This is a schematic diagram of a dual-message matching device according to an embodiment of the present invention. This embodiment is applicable to different types of dual-message matching. The dual-message matching device can be implemented in hardware and / or software, and can be configured in an electronic device carrying dual-message matching functionality, such as a server. Figure 3 As shown, the device includes: The target message acquisition module 310 is used to receive the target message and extract the service identifier and message type of the target message; The message matching module 320 is used to search for whether there is an associated message corresponding to the target message in the message hot pool according to the service identifier and message type; wherein, the message hot pool is located in the high-speed storage area in memory and is used to temporarily store previously received messages. The message processing module 330 is used to merge the target message and the associated message if they exist, and delete the target message and the associated message from the message cold pool; wherein, the message cold pool is a persistent storage area used to back up all messages to be matched; The message processing module 330 is also used to write the target message into the message hot pool with the service identifier as the key and the message content of the target message as the value if the target message does not exist, and asynchronously write the target message into the message cold pool.

[0063] The technical solution of this invention involves receiving a target message and extracting its service identifier and message type. Based on the service identifier and message type, it searches the message pool for a corresponding associated message in the pending match messages. The message pool is located in a high-speed storage area in memory and is used to temporarily store previously received messages. If an associated message exists, the target message and the associated message are merged, and both are deleted from the message cold pool. The message cold pool is a persistent storage area used to back up all pending match messages. If no associated message exists, the target message is written to the message hot pool using the service identifier as the key and its message content as the value, and is asynchronously written to the message cold pool. This technical solution, through real-time message matching in the message hot pool and message backup in the message cold pool, employs a two-level storage mode for message processing, ensuring both message matching accuracy and data integrity.

[0064] Optionally, the message hot pool is divided into multiple priority areas according to message priority; correspondingly, the message matching module 320 is used for: Based on the business identifier and message type, and according to message priority, the system first searches for the corresponding associated message in the high-priority region of the message hot pool.

[0065] Optionally, the device also includes a thermal pool maintenance module for: Periodically scan all unmatched packets in the packet hot pool; Calculate the waiting time for the message to be matched; The priority of the packets to be matched is adjusted based on the waiting time, and the priority storage area of ​​the packets to be matched is also adjusted.

[0066] Optionally, the thermal pool maintenance module is specifically used for: If the waiting time is within the priority waiting time range, the message priority of the message to be matched will be raised to the message priority corresponding to the priority waiting time range, and the message to be matched will be moved to the priority storage area corresponding to the priority waiting time range. If the waiting time is greater than or equal to the maximum waiting time, the message to be matched will be removed from the message hot pool, and the message status of the message to be matched in the message cold pool will be updated; wherein, the maximum waiting time is within the priority waiting time range.

[0067] Optionally, the device may also include an anomaly detection module for: The priority of the packets to be matched is adjusted according to the waiting time, and the priority storage area of ​​the packets to be matched is adjusted. At the same time, the packets to be matched that have timed out and have not been matched in the cold pool, as well as the packets to be matched that have been removed from the hot pool, are taken as packets to be detected. Anomaly detection is performed on the message to be detected, and the anomaly detection results are obtained.

[0068] Optionally, anomaly detection may include at least one of the following operations: Send a re-examination request to the message source of the message to be matched; the re-examination request is used to inquire whether the message to be matched has been sent or whether it can be resent. Perform a service rollback operation on the matched message; Mark the matching message as abnormal.

[0069] The dual-message matching device provided in the embodiments of the present invention can execute the dual-message matching method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0070] According to embodiments of the present invention, the present invention also provides an electronic device, a readable storage medium, and a computer program product.

[0071] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the dual-message matching method of this invention. Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0072] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0073] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0074] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the dual-message matching method.

[0075] In some embodiments, the dual-message matching method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the dual-message matching method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the dual-message matching method by any other suitable means (e.g., by means of firmware).

[0076] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0077] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0078] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0079] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0080] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0081] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0082] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0083] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A dual-message matching method, characterized in that, include: Receive the target message and extract the service identifier and message type of the target message; Based on the service identifier and the message type, the system searches the message hot pool for a matching message to determine if there is an associated message corresponding to the target message. The message hot pool is located in a high-speed storage area in memory and is used to temporarily store previously received messages. If they exist, the target message and the associated message are merged, and the target message and the associated message are deleted from the message cold pool; wherein, the message cold pool is a persistent storage area used to back up all messages to be matched; If it does not exist, the target message is written to the message hot pool with the service identifier as the key and the message content of the target message as the value, and the target message is asynchronously written to the message cold pool.

2. The method according to claim 1, characterized in that, The message hot pool is divided into multiple priority areas according to message priority; Accordingly, based on the service identifier and the message type, the process involves searching the message pool for matching messages to determine if a related message corresponding to the target message exists, including: Based on the service identifier and the message type, and according to message priority, the system first searches for the existence of an associated message corresponding to the target message among the high-priority regions of the message hot pool.

3. The method according to claim 1, characterized in that, Also includes: Periodically scan all unmatched packets in the packet hot pool; Calculate the waiting time for the message to be matched; The message priority of the message to be matched is adjusted according to the waiting time, and the priority storage area of ​​the message to be matched is also adjusted.

4. The method according to claim 3, characterized in that, Adjusting the packet priority of the unmatched packets according to the waiting time, and adjusting the priority storage area of ​​the unmatched packets, including: If the waiting time is within the priority waiting time range, the message priority of the message to be matched is increased to the message priority corresponding to the priority waiting time range, and the message to be matched is increased to the priority storage area corresponding to the priority waiting time range. If the waiting time is greater than or equal to the maximum waiting time, the message to be matched is removed from the message hot pool, and the message status corresponding to the message to be matched in the message cold pool is updated; wherein, the maximum waiting time is greater than the priority waiting time range.

5. The method according to claim 3, characterized in that, In addition to adjusting the message priority of the message to be matched according to the waiting time and adjusting the priority storage area of ​​the message to be matched, the method also includes: The unmatched packets that timed out in the cold pool and the unmatched packets removed from the hot pool are taken as packets to be detected. Anomaly detection is performed on the message to be detected, and the anomaly detection result is obtained.

6. The method according to claim 5, characterized in that, The anomaly detection includes at least one of the following operations: A re-examination request is sent to the message source of the message to be matched; the re-examination request is used to inquire whether the message to be matched has been sent or whether it can be resent. Perform a service rollback operation on the message to be matched; The message to be matched is marked as abnormal.

7. A dual-message matching device, characterized in that, include: The target message acquisition module is used to receive target messages and extract the service identifier and message type of the target messages; The message matching module is used to search for whether there is an associated message corresponding to the target message in the message hot pool from the messages to be matched according to the service identifier and the message type; wherein, the message hot pool is located in the high-speed storage area in memory and is used to temporarily store previously received messages; The message processing module is used to merge the target message and the associated message if they exist, and delete the target message and the associated message from the message cold pool; wherein, the message cold pool is a persistent storage area used to back up all messages to be matched; The message processing module is further configured to, if the target message does not exist, write the target message into the message hot pool with the service identifier as the key and the message content of the target message as the value, and asynchronously write the target message into the message cold pool.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the dual-message matching method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the dual-message matching method according to any one of claims 1-6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the dual-message matching method according to any one of claims 1-6.