Compensation method, device and electronic equipment for messages

By retrieving and comparing messages from the target application in the message queue, predicting periods of stable network activity, and sending compensation messages, the problem of server pressure and performance degradation caused by message loss is solved, achieving the effect of accurate acquisition and reduced resource consumption.

CN116545973BActive Publication Date: 2026-07-14INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-05-06
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In existing technologies, when an application loses a message sent to a message queue, the application needs to resend the message, which increases server load and reduces performance.

Method used

By acquiring messages sent by the target application, predicting periods of stable network activity, acquiring and comparing messages within the target time period, identifying lost messages, and sending compensation messages to the message queue to replace the lost messages.

Benefits of technology

By effectively identifying lost messages and sending compensation messages, the high resource consumption caused by the application resending messages is avoided, thus reducing the impact on the performance of the target application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116545973B_ABST
    Figure CN116545973B_ABST
Patent Text Reader

Abstract

The application discloses a kind of compensation method, device and electronic equipment of message, it is related to artificial intelligence field, the method includes: obtaining the message that target application sends to message queue theme from message queue theme, obtains first message;According to the network fluctuation law of target application with time variation, predict target time period of target application network stability, and feedback target time period to target application;Obtain the message that target application sends in target time period, obtain second message, and compare first message and second message, obtain target comparison result;In the case where according to target comparison result determines that first message is different from second message, compensation message is sent to message queue theme, wherein, message queue theme is used to determine second message according to compensation message and first message.The application solves the technical problem that when the message that application sends to message queue is lost in the prior art, the application needs to resend the message, thereby affecting the working performance of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence, and more specifically, to a message compensation method, apparatus, and electronic device. Background Technology

[0002] Message queuing is a messaging pattern similar to email systems. It caches messages in a centralized or distributed queue and transmits and processes them according to specific rules. Applications can achieve asynchronous communication and decoupling by sending messages to and reading messages from the queue.

[0003] In a message queue architecture, different applications and services can run independently without direct interaction. This helps reduce dependencies between systems and improves reliability, flexibility, and scalability. However, in related technologies, when a message sent to a message queue is lost, it is typically resent by the application, which increases the server load and reduces application performance.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This invention provides a message compensation method, apparatus, and electronic device to at least solve the technical problem in the prior art where, when a message sent by an application to a message queue is lost, the application needs to resend the message, which affects the application's performance.

[0006] According to one aspect of the present invention, a message compensation method is provided, comprising: obtaining a message sent by a target application to a message queue topic from a message queue topic to obtain a first message, wherein the message queue topic includes multiple message queues; predicting a target time period for network stability of the target application based on the network fluctuation pattern of the target application over time, and feeding back the target time period to the target application; obtaining a message sent by the target application within the target time period to obtain a second message, and comparing the first message and the second message to obtain a target comparison result, wherein the message sent by the target application within the target time period is the same as the message sent by the target application to the message queue topic; and sending a compensation message to the message queue topic if the first message and the second message are determined to be different according to the target comparison result, wherein the message queue topic is used to determine the second message based on the compensation message and the first message.

[0007] Furthermore, the message compensation method also includes: before predicting the target time period when the network of the target application is stable based on the network fluctuation pattern of the target application over time, and after obtaining the time period acquisition instruction sent by the target application, determining the network fluctuation pattern of the target application over time based on multiple historical network delay information sent by the target application, wherein the multiple historical network delay information are sent by the target application at preset time intervals.

[0008] Furthermore, the message compensation method also includes: segmenting the first message to obtain N first message segments, where N is a positive integer greater than 1; segmenting the second message to obtain N second message segments; comparing the message segments in the same order position among the N first message segments and the N second message segments to obtain the matching result for each order position; and constructing the target matching result from the matching results for each order position.

[0009] Furthermore, the message compensation method also includes: for the first message segment and the second message segment with the same sequence position, performing feature extraction on the first message segment using a deep forest model to obtain a first target feature matrix, and performing feature extraction on the second message segment using a deep forest model to obtain a second target feature matrix; if the first target feature matrix and the second target feature matrix are the same, it is determined that the first message segment and the second message segment are the same; if the first target feature matrix and the second target feature matrix are different, it is determined that the first message segment and the second message segment are different.

[0010] Furthermore, the deep forest model includes multi-layer cascaded forests, each layer of which includes the same number of random forests and fully random forests. The message compensation method further includes: performing multi-granularity scanning on the first message segment to obtain feature vectors of the first message segment at different granularities; combining the feature vectors of the first message segment at different granularities to obtain a first feature vector; extracting features from the first feature vector through the first layer of cascaded forest to obtain a first feature matrix; and sequentially performing the step of extracting features from the feature matrix output by the previous layer of cascaded forest through the next layer of cascaded forest, and determining the feature matrix output by the last layer of cascaded forest as the first target feature matrix.

[0011] Furthermore, the message compensation method also includes: selecting a matching result to be matched from N matching results in the target matching results, wherein the matching result to be matched is a matching result that represents the difference between the first message segment and the second message segment; determining the second message segment matched by the matching result to be matched from N second message segments to obtain the target message segment; determining the target message segment as the compensation message, and sending the compensation message to the message queue topic.

[0012] Furthermore, the message compensation method also includes: obtaining the topic identifier of the message queue topic and the network address matching the message queue topic; finding the server where the message queue topic is located based on the network address, and subscribing to the message queue topic on the server based on the topic identifier; and obtaining the message sent by the target application to the message queue topic from the message queue topic to obtain the first message.

[0013] According to another aspect of the present invention, a message compensation device is also provided, comprising: an acquisition module, configured to acquire a message sent by a target application to a message queue topic from a message queue topic to obtain a first message, wherein the message queue topic includes multiple message queues; a prediction module, configured to predict a target time period in which the network of the target application is stable based on the network fluctuation pattern of the target application over time, and to feed back the target time period to the target application; a comparison module, configured to acquire a message sent by the target application within the target time period to obtain a second message, and to compare the first message and the second message to obtain a target comparison result, wherein the message sent by the target application within the target time period is the same as the message sent by the target application to the message queue topic; and a sending module, configured to send a compensation message to the message queue topic when it is determined from the target comparison result that the first message and the second message are different, wherein the message queue topic is used to determine the second message based on the compensation message and the first message.

[0014] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described message compensation method when it is run.

[0015] According to another aspect of the present invention, an electronic device is also provided, the electronic device including one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement a method for running the programs, wherein the programs are configured to execute the above-described message compensation method during runtime.

[0016] In this embodiment of the invention, in the event of message loss in the message queue, a compensation message is sent to the message queue by a third party. The process involves retrieving messages sent by the target application to the message queue topic to obtain a first message. Then, based on the network fluctuation patterns of the target application over time, a target time period for network stability is predicted and fed back to the target application. Next, messages sent by the target application within the target time period are retrieved to obtain a second message. The first and second messages are compared to obtain a target comparison result. If the target comparison result determines that the first and second messages are different, a compensation message is sent to the message queue topic. The message queue topic contains multiple message queues and is used to determine the second message based on the compensation message and the first message.

[0017] It is noteworthy that in the above process, by comparing the first message with the second message to obtain the target comparison result, the missing message can be effectively identified even if it is lost due to network issues. When the target comparison result indicates a difference between the first and second messages, a compensation message is automatically sent to the message queue topic. This avoids the problem of high resource consumption on the target application caused by resending the second message, thus reducing the impact on the target application's performance. Furthermore, by obtaining the messages sent by the target application during a target period with stable network conditions, the second message is obtained, ensuring accurate acquisition of the message that the target application actually intends to send to the message queue topic. This avoids the problem of message loss due to network issues affecting the accuracy of the target comparison result.

[0018] Therefore, the solution provided in this application achieves the goal of sending a compensation message to the message queue by a third party in the event of message loss in the message queue, thereby reducing the impact on the performance of the target application. It also solves the technical problem in the prior art where the application needs to resend the message when the message sent to the message queue is lost, which affects the performance of the application. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0020] Figure 1 This is a schematic diagram of an optional message compensation method according to an embodiment of the present invention;

[0021] Figure 2 This is a schematic diagram illustrating the interaction between an optional target compensation system, a message queue topic, and a target application according to an embodiment of the present invention.

[0022] Figure 3 This is a schematic diagram of an optional process for comparing a first message and a second message according to an embodiment of the present invention;

[0023] Figure 4 This is a schematic diagram of an optional message compensation device according to an embodiment of the present invention;

[0024] Figure 5 This is a schematic diagram of an optional electronic device according to an embodiment of the present invention. Detailed Implementation

[0025] 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.

[0026] 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 a 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.

[0027] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0028] Example 1

[0029] According to an embodiment of the present invention, an embodiment of a message compensation method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0030] Figure 1 This is a schematic diagram of an optional message compensation method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:

[0031] Step S101: Obtain the message sent by the target application to the message queue topic from the message queue topic to obtain the first message, wherein the message queue topic contains multiple message queues.

[0032] Optionally, an application system, server, electronic device, or other device can be used as the execution subject of this application. In this embodiment, the target compensation system is used as the execution subject to execute the aforementioned message compensation method. The aforementioned message queue topic contains multiple message queues. A message queue topic can be consumed by multiple consumers. When a producer publishes a new message to a message queue topic, the message is simultaneously sent to all message queues under the message queue topic and processed and consumed by each consumer. That is, all consumers subscribed to the message queue topic can obtain the same message. Here, the producer refers to the object responsible for sending messages to the message queue, and the consumer refers to the object responsible for consuming and receiving messages from the message queue. In step S101, the producer is the aforementioned target application, and the consumer is the target compensation system.

[0033] Optionally, in this embodiment, Figure 2 This is a schematic diagram illustrating the interaction between an optional target compensation system, a message queue topic, and a target application according to an embodiment of the present invention, such as... Figure 2 As shown, the target application intends to send messages to other applications via a message queue topic to achieve information exchange with them. However, due to network fluctuations or other reasons, the message sent by the target application to the message queue topic may not be the same as the message actually received by the message queue topic. If the message sent by the target application to the message queue topic differs from the message actually received by the message queue topic, then other applications will not receive the accurate message, thus preventing effective interaction between the target application and other applications. The aforementioned other applications are equivalent to the consumers described above.

[0034] Therefore, in this embodiment, the target compensation system can first obtain the messages actually received by the message queue topic to subsequently determine whether message loss occurred during the process of sending the messages to the message queue topic. Specifically, as follows: Figure 2 As shown, after the target application sends a message to the message queue topic, it can send the topic information of the message queue topic to the target compensation system. This allows the target application to successfully subscribe to the message queue topic based on the topic information, and thus retrieve the message sent by the target application to the message queue topic, obtaining the first message. The first message is the message actually received by the aforementioned message queue topic. Therefore, the message sent by the target application to the message queue topic may be the same as or different from the first message.

[0035] Step S102: Based on the network fluctuation pattern of the target application over time, predict the target time period when the network of the target application is stable, and feed back the target time period to the target application.

[0036] Optionally, the target compensation system can acquire network latency information sent by the target application in real time at preset time intervals, thereby determining the network fluctuation pattern of the target application over time based on the network latency information. In another optional embodiment, staff can determine the network fluctuation pattern of the target application over time based on the historical working status of the target application and record it in a database. This allows the target compensation system to directly obtain the network fluctuation pattern of the target application over time from the database. The network fluctuation pattern can be: the duration of each network stability period for the target application is 20 seconds, and the time interval between adjacent network stability periods is 10 seconds.

[0037] Furthermore, the target application system can predict the nearest period of network stability for the target application in the future based on the network fluctuation pattern of the target application over time, thereby obtaining the target time period and feeding the target time period back to the target application.

[0038] Step S103: Obtain the messages sent by the target application within the target time period, obtain the second message, and compare the first message and the second message to obtain the target comparison result, wherein the messages sent by the target application within the target time period are obtained.

[0039] Optional, such as Figure 2 As shown, after the target application obtains the target time period, it sends a message to the target compensation system within that time period, thus enabling the target compensation system to receive a second message. The message sent by the target application to the target compensation system is the same as the message sent by the target application to the message queue topic.

[0040] Furthermore, the target compensation system can directly compare the first message and the second message to determine whether they are the same, thereby obtaining the target comparison result. Optionally, the target compensation system can also segment the first message and the second message separately to obtain the same number of message segments, and then process the message segments with the same sequence position to obtain the comparison result for each sequence position matching. The target comparison result is then determined based on the comparison result for each sequence position matching. The target comparison result includes information indicating whether the first message and the second message are the same. If the first message and the second message are different, the target comparison result also includes information indicating what the first message lacks relative to the second message.

[0041] It should be noted that by comparing the first message with the second message to obtain the target comparison result, the missing message can be effectively identified in the event of message loss due to network issues. This facilitates subsequent effective message compensation and ensures message integrity. Furthermore, obtaining the second message by acquiring the messages sent by the target application within the target time period ensures accurate acquisition of the messages that the target application actually intends to send to the message queue topic, avoiding the problem of message loss due to network issues affecting the accuracy of the target comparison result.

[0042] It should be emphasized that steps S102 and S103 are executed after the target application sends the message to the message queue topic message. Furthermore, the step of obtaining the second message in steps S102 and S103 can be executed before or after step S101. That is, in this embodiment, there is no specific limitation on the order in which the target compensation system obtains the first message and the second message.

[0043] Step S104: If the first message and the second message are determined to be different based on the target comparison result, a compensation message is sent to the message queue topic, wherein the message queue topic is used to determine the second message based on the compensation message and the first message.

[0044] In step S104, the compensation message is the message that is missing from the first message relative to the second message. For example... Figure 2 As shown, after determining that the first message and the second message are different based on the target comparison results, the target compensation system can determine a compensation message based on the target comparison results and then send the compensation message to the message queue topic. Upon receiving the compensation message, the message queue topic can combine the compensation message into the first message and replace the abnormal message in the first message to obtain the second message.

[0045] Optionally, if the target compensation system determines that the first message and the second message are the same, the target compensation system can send the corresponding notification information to the message queue topic. Furthermore, after determining the second message based on the compensation message or obtaining the notification information, the message queue topic can update its subscription information so that the target application's intended message recipients (i.e., the aforementioned other applications) can promptly obtain the accurate second message from the message queue topic.

[0046] It should be noted that by automatically sending a compensation message to the message queue topic when a difference is found between the first and second messages, the high resource consumption of the target application caused by resending the second message through the target application is avoided, thereby reducing the impact on the target application's performance. Furthermore, existing message loss solutions typically address different types of message queues, increasing the learning curve for developers. In this application, by avoiding analysis of the target comparison results using message queue topics, the applicability of the method provided is improved, and manual labor costs are reduced.

[0047] Based on the scheme defined in steps S101 to S103 above, it can be understood that in this embodiment of the invention, in the event of message loss in the message queue, a compensation message is sent to the message queue by a third party. This involves obtaining the first message from the message queue topic by retrieving messages sent by the target application to the message queue topic; then, based on the network fluctuation pattern of the target application over time, predicting a target time period for network stability for the target application, and feeding this target time period back to the target application; next, retrieving messages sent by the target application within the target time period to obtain the second message; and comparing the first and second messages to obtain a target comparison result. If the target comparison result determines that the first and second messages are different, a compensation message is sent to the message queue topic. The message queue topic contains multiple message queues, and the message queue topic is used to determine the second message based on the compensation message and the first message.

[0048] It is noteworthy that in the above process, by comparing the first message with the second message to obtain the target comparison result, the missing message can be effectively identified even if it is lost due to network issues. When the target comparison result indicates a difference between the first and second messages, a compensation message is automatically sent to the message queue topic. This avoids the problem of high resource consumption on the target application caused by resending the second message, thus reducing the impact on the target application's performance. Furthermore, by obtaining the messages sent by the target application during a target period with stable network conditions, the second message is obtained, ensuring accurate acquisition of the message that the target application actually intends to send to the message queue topic. This avoids the problem of message loss due to network issues affecting the accuracy of the target comparison result.

[0049] Therefore, the solution provided in this application achieves the goal of sending a compensation message to the message queue by a third party in the event of message loss in the message queue, thereby reducing the impact on the performance of the target application. It also solves the technical problem in the prior art where the application needs to resend the message when the message sent to the message queue is lost, which affects the performance of the application.

[0050] In an optional embodiment, during the process of retrieving the message sent by the target application to the message queue topic and obtaining the first message, the target compensation system can obtain the topic identifier of the message queue topic and the network address matching the message queue topic, then find the server where the message queue topic is located based on the network address, and subscribe to the message queue topic on the server based on the topic identifier, thereby retrieving the message sent by the target application to the message queue topic and obtaining the first message.

[0051] Optionally, the target application can transmit data with the target compensation system. Specifically, when sending a message to a message queue topic, the target application can send its identifier, the message queue topic identifier, and the network address matching the message queue topic to the target compensation system. The network address matching the message queue topic consists of an IP address (Internet Protocol) and a port number. The target compensation system can store the acquired information in a database for later retrieval. Specifically, the target compensation system can store the aforementioned target application identifier, message queue topic identifier, and network address matching the message queue topic in a client information table within the database.

[0052] Furthermore, the target compensation system can periodically scan the client information table to locate the server where the message queue topic resides based on the network address recorded in the client information table, and subscribe to the message queue topic on the server according to the topic identifier. Thus, when the subscribed information is updated, the system can promptly retrieve messages sent by the target application to the message queue topic, obtaining the first message.

[0053] It should be noted that by obtaining the topic identifier and the network address of the message queue topic, it is possible to accurately subscribe to the message queue topic, thereby enabling timely receipt of the first message.

[0054] In an optional embodiment, before predicting the target time period when the network of the target application is stable based on the network fluctuation pattern of the target application over time, the target compensation system can determine the network fluctuation pattern of the target application over time based on multiple historical network delay information sent by the target application after obtaining the time period acquisition instruction sent by the target application. The multiple historical network delay information are sent by the target application at preset time intervals.

[0055] Optionally, the target application sends heartbeat information to the target compensation system at preset time intervals. The heartbeat information includes the target application's IP address, network latency information, the sending time of the heartbeat information, and the topic identifier of the message queue topic. The target compensation system receives the heartbeat information and stores it in the aforementioned client information table. The aforementioned network latency information refers to the network latency time.

[0056] Furthermore, after the target application sends a message to the message queue topic, it needs to send a message to the target compensation system. In this case, the target application does not immediately send the message to the target compensation system, but first sends a time period retrieval command to obtain the allowed message sending time period from the target compensation system, i.e., obtain the target time period. Optionally, the time period retrieval command includes the target application's IP address and the message queue topic's identifier. After the target compensation system receives the time period retrieval command, it can query the client information table for the 1000 most recent heartbeat messages sent by the target application based on the target application's IP address and the message queue topic's identifier. Then, it extracts historical network latency information from these 1000 heartbeat messages and determines the network fluctuation pattern of the target application over time based on the historical network latency information. For example, the time point corresponding to the network latency time less than a preset threshold is determined as the network stable time point, and the time point corresponding to the network latency time greater than or equal to the preset threshold is determined as the network busy time point, thereby determining the network fluctuation pattern of the target application over time. The number of heartbeat messages mentioned above can also be other values ​​depending on the actual application requirements.

[0057] It should be noted that by determining the network fluctuation pattern of the target application over time based on the historical network latency information sent by the target application, the network fluctuation pattern can be accurately determined, thereby enabling the accurate determination of the target time period.

[0058] In one optional embodiment, during the process of comparing the first message and the second message to obtain the target comparison result, the target compensation system can segment the first message to obtain N first message segments, then segment the second message to obtain N second message segments, and then compare the message segments in the same order position among the N first message segments and the N second message segments to obtain the comparison result for each order position matching. Thus, the comparison result for each order position matching constitutes the target comparison result. Here, N is a positive integer greater than 1.

[0059] Optional, Figure 3 This is a schematic diagram of an optional process for comparing a first message and a second message according to an embodiment of the present invention, as shown below. Figure 3 As shown, after obtaining the second message, the target compensation system can segment the second message using a slicing algorithm to obtain N second message fragments. The sequence position of each second message fragment within the second message is used as the key, and each fragment as the value, resulting in key-value pairs. Then, the `HashCode()` method is used to store each key-value pair in a hash table, and the target application's IP address is linked to this hash table. To ensure query speed, the segmentation unit length can be adjusted based on the second message size during fragment generation. The hash table can be persistently stored in a database.

[0060] Furthermore, such as Figure 3 As shown, after obtaining the first message, the target compensation system can also segment the first message using a slicing algorithm to obtain N first message fragments. Then, based on the order of the first message fragment in the first message, the corresponding second message fragment is found from the hash table using the HashCode() method. The first message fragment is then compared with the found second message fragment to obtain the matching result for that order. Thus, the target comparison result can be constructed from the matching results of each order. It should be emphasized that the target compensation system can also store the first message fragments in the form of key-value pairs in a database, and then match the first message fragments with the same order using the second message fragment; therefore, this will not be elaborated here. Optionally, in other embodiments, the target compensation system can also directly record the matching relationship between the first message fragment (or the second message fragment) and the order in the database.

[0061] It should be noted that by splitting the first and second messages into multiple message fragments, on the one hand, the computational performance during comparison is improved, and on the other hand, the compensation message is determined quickly in the subsequent process.

[0062] In one alternative embodiment, such as Figure 3As shown, in the process of comparing message segments in the same order among N first message segments and N second message segments to obtain the matching result for each order, the target compensation system can extract features from the first message segments and the second message segments in the same order using a deep forest model to obtain a first target feature matrix, and extract features from the second message segments using the deep forest model to obtain a second target feature matrix. Thus, if the first target feature matrix and the second target feature matrix are the same, it is determined that the first message segments and the second message segments are the same; if the first target feature matrix and the second target feature matrix are different, it is determined that the first message segments and the second message segments are different.

[0063] Optionally, a deep forest model from related technologies can be used to extract features from the first message segment. Specifically, if the elements at each position in the first target feature matrix are the same as the elements at the same position in the second target feature matrix, the first target feature matrix and the second target feature matrix are determined to be the same; if the elements at each position in the first target feature matrix are not completely identical to the elements at the same position in the second target feature matrix, the first target feature matrix and the second target feature matrix are determined to be different. In other embodiments, the target compensation system can also use a convolutional neural network model or other models to extract features from the first and second message segments.

[0064] It should be noted that by using the deep forest model to obtain the target feature matrices of the first and second message segments, and comparing the target feature matrices to determine the comparison results, it is possible to more accurately determine whether a message has been lost, thereby improving the accuracy of determining whether a message has been lost.

[0065] In one optional embodiment, the deep forest model includes multiple cascaded forests, each of which includes the same number of random forests and fully random forests. During the process of extracting features from a first message segment using the deep forest model to obtain a first target feature matrix, the deep forest model can perform multi-granularity scanning on the first message segment to obtain feature vectors at different granularities. Then, the feature vectors at different granularities are combined to obtain a first feature vector. Next, feature extraction is performed on the first feature vector through the first cascaded forest to obtain a first feature matrix. This process is repeated sequentially, performing feature extraction on the feature matrix output by the next cascaded forest from the previous cascaded forest, and finally determining the feature matrix output by the last cascaded forest as the first target feature matrix.

[0066] Specifically, assuming that the first message segment in this embodiment is 400-dimensional sequence data, the process of feature extraction of the first message segment by the deep forest model will be described. In this embodiment, the granularity in the multi-granularity scan is set to 100, 200, and 300. During the multi-granularity scan of the first message segment, the 100-granularity sliding window scans the first message segment to obtain 301 feature vectors, the 200-granularity sliding window scans the first message segment to obtain 201 feature vectors, and the 300-granularity sliding window scans the first message segment to obtain 101 feature vectors. Thus, the aforementioned 301 feature vectors, 201 feature vectors, and 101 feature vectors can be combined to obtain the first feature vector.

[0067] Further, in this embodiment, the deep forest model comprises a three-layer cascaded forest, each layer including two random forests and two fully random forests, with each random forest (or fully random forest) containing three execution trees. After obtaining the first feature vector, the deep forest model inputs the first feature vector into the first-layer cascaded forest. In the first-layer cascaded forest, for the aforementioned 301 feature vectors in the first feature vector, each random forest (or fully random forest) in the first layer performs feature extraction on the first feature vector, obtaining a 301*3 dimensional sub-feature matrix. Similarly, for the aforementioned 201 feature vectors in the first feature vector, a 201*3 dimensional sub-feature matrix can be obtained, and for the aforementioned 101 feature vectors in the first feature vector, a 101*3 dimensional sub-feature matrix can be obtained. Further, the first-layer cascaded forest randomly selects elements from the sub-feature matrices output by all random forests and fully random forests, thereby selecting a (301+201+101)*3 dimensional first feature matrix.

[0068] Next, the deep forest model inputs the first feature matrix into the second-level cascaded forest. The second-level cascaded forest processes the first feature matrix in the same way that the first-level cascaded forest processes the first feature vector, so it will not be described again here. The second-level forest outputs a second feature matrix with dimensions of (301+201+101)*3.

[0069] Furthermore, the deep forest model inputs the second feature matrix into the third-layer cascaded forest. The third-layer cascaded forest processes the second feature matrix in the same way as the first-layer cascaded forest processes the first feature vector, so it will not be repeated here. The third-layer cascaded forest outputs a third feature matrix of dimension (301+201+101)*3. This third feature matrix is ​​then used as the first target feature matrix.

[0070] It should be noted that by extracting features from the first message segment using the multi-layered cascaded forest in the deep forest model, the effective acquisition of the first target feature matrix is ​​achieved. Furthermore, the feature extraction method for the second message segment using the deep forest model is the same as that for the first message segment, and therefore will not be elaborated upon here.

[0071] In one optional embodiment, during the process of sending a compensation message to the message queue topic, the target compensation system can filter out the comparison result to be matched from N comparison results in the target comparison results, and then determine the second message segment that the comparison result to be matched matches from N second message segments to obtain the target message segment. The target message segment is then identified as the compensation message, and the compensation message is sent to the message queue topic. Here, the comparison result to be matched is the comparison result that indicates the difference between the first message segment and the second message segment.

[0072] Optionally, after obtaining the target comparison results, the target compensation system can determine the matching result to be matched from the target comparison results, and then record the second message fragment matched by the matching result to be matched, the topic identifier of the message queue topic, the identifier of the target application, and the current time in the failure message table of the database. Among them, the second message fragment matched by the matching result to be matched is the message fragment lost during the process of the target application sending a message to the message queue topic.

[0073] After that, as Figure 3 As shown, the target compensation system can scan the failure message table at preset time intervals and send the second message fragment (i.e., the compensation message) from the failure message table to the message queue topic. For example, Figure 3 As shown, after the second message fragment in the failure message table is sent, the target compensation system can record the message queue topic identifier, current time, second message fragment, target application's application identifier, and message queue topic's network address in the failure message details table in the database.

[0074] It should be noted that by determining the compensation message based on the comparison results, the compensation message is effectively determined, thus avoiding the high resource consumption problem that occurs when sending the complete second message to the message topic queue.

[0075] In one alternative embodiment, the target step size system can provide users with a visual interactive page, which users can interact with to query relevant records or related time sequence diagrams by time, target application identifier, message queue topic identifier, and message queue topic network address, thereby achieving more convenient monitoring.

[0076] It should be noted that by setting up a visual interactive page, it is convenient for operations and maintenance personnel and developers to monitor message loss. They can also determine when the target application may have experienced network instability based on the time of message loss. This avoids the problem that in existing technologies, relevant developers can only find corresponding failure messages by checking logs, which is inconvenient for checking message execution status.

[0077] In one optional embodiment, the operation of the target compensation system is described. Optionally, the target system includes a visual interactive page, a backend, and a database. In the event of message sending failure, the user can view the lost information and corresponding time through the visual interactive page. The backend can provide an external interface, which is called simultaneously when the target application sends a message to the message queue. This interface is used to receive messages sent by the target application with a delay (i.e., within a target time period) and to subscribe to the message queue topic that the target application actually needs to send messages to, thereby acting as a consumer to receive the messages. Subsequently, the backend uses a deep forest model to obtain the corresponding target feature matrix to determine whether the message is consistent with the actual sent message, thereby deciding whether to resend the corresponding message to the message queue topic. Specifically, if they are inconsistent, the backend resends the lost message to the message queue topic and records it in the database so that the user can view it on the visual interactive page; if they are consistent, no action is taken.

[0078] Therefore, the solution provided in this application achieves the goal of sending a compensation message to the message queue by a third party in the event of message loss in the message queue, thereby reducing the impact on the performance of the target application. It also solves the technical problem in the prior art where the application needs to resend the message when the message sent to the message queue is lost, which affects the performance of the application.

[0079] Example 2

[0080] According to an embodiment of the present invention, an embodiment of a message compensation device is provided, wherein, Figure 4 This is a schematic diagram of an optional message compensation device according to an embodiment of the present invention, such as... Figure 4 As shown, the device includes:

[0081] The acquisition module 401 is used to retrieve messages sent by the target application to the message queue topic from the message queue topic, and obtain the first message, wherein the message queue topic contains multiple message queues;

[0082] Prediction module 402 is used to predict the target time period when the network of the target application is stable based on the network fluctuation pattern of the target application over time, and to feed back the target time period to the target application.

[0083] The comparison module 403 is used to obtain the messages sent by the target application within the target time period, obtain the second message, and compare the first message and the second message to obtain the target comparison result. The message sent by the target application within the target time period is the same as the message sent by the target application to the message queue topic.

[0084] The sending module 404 is used to send a compensation message to the message queue topic when the first message and the second message are determined to be different based on the target comparison result. The message queue topic is used to determine the second message based on the compensation message and the first message.

[0085] It should be noted that the above-mentioned acquisition module 401, prediction module 402, comparison module 403 and sending module 404 correspond to steps S101 to S104 in the above embodiments. The examples and application scenarios implemented by the four modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiment 1.

[0086] Optionally, the message compensation device further includes: a determination module, used to determine the network fluctuation pattern of the target application over time based on multiple historical network delay information sent by the target application when a time period acquisition instruction is obtained from the target application, wherein the multiple historical network delay information are sent by the target application at preset time intervals.

[0087] Optionally, the comparison module 403 further includes: a first processing submodule, used to segment the first message to obtain N first message fragments, where N is a positive integer greater than 1; a second processing submodule, used to segment the second message to obtain N second message fragments; a comparison submodule, used to compare the N first message fragments with the message fragments in the same order position among the N second message fragments to obtain a comparison result for each order position matching; and a third processing submodule, used to construct a target comparison result from the comparison results for each order position matching.

[0088] Optionally, the comparison submodule includes: a feature extraction unit, used to extract features from the first message segment and the second message segment with the same ordinal position using a deep forest model to obtain a first target feature matrix, and to extract features from the second message segment using a deep forest model to obtain a second target feature matrix; a first determination unit, used to determine that the first message segment and the second message segment are the same if the first target feature matrix and the second target feature matrix are the same; and a second determination unit, used to determine that the first message segment and the second message segment are different if the first target feature matrix and the second target feature matrix are different.

[0089] Optionally, the deep forest model includes multi-layer cascaded forests, each layer of which includes the same number of random forests and fully random forests. The feature extraction unit includes: a processing subunit for performing multi-granularity scanning on the first message segment to obtain feature vectors of the first message segment at different granularities; a combination subunit for combining the feature vectors of the first message segment at different granularities to obtain a first feature vector; a feature extraction subunit for extracting features from the first feature vector through the first layer of cascaded forest to obtain a first feature matrix; and a determination subunit for sequentially executing the step of extracting features from the feature matrix output by the previous layer of cascaded forest through the next layer of cascaded forest, and determining the feature matrix output by the last layer of cascaded forest as the first target feature matrix.

[0090] Optionally, the acquisition module 401 includes: a first acquisition submodule, used to acquire the topic identifier of the message queue topic and the network address matching the message queue topic; a subscription submodule, used to find the server where the message queue topic is located based on the network address, and subscribe to the message queue topic on the server based on the topic identifier; and a second acquisition submodule, used to acquire the message sent by the target application to the message queue topic from the message queue topic, and obtain the first message.

[0091] Example 3

[0092] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program is configured to execute the compensation device for the above-described message when it is run.

[0093] Example 4

[0094] According to another aspect of the present invention, an electronic device is also provided, wherein, Figure 5 This is a schematic diagram of an optional electronic device according to an embodiment of the present invention, such as... Figure 5 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to perform operations on the programs, wherein the programs are configured to execute compensation devices for the aforementioned messages during runtime.

[0095] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0096] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0097] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0098] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0099] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0100] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0101] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A message compensation method, characterized in that, include: The message sent by the target application to the message queue topic is obtained from the message queue topic to obtain the first message, wherein the message queue topic contains multiple message queues; Based on the network fluctuation pattern of the target application over time, predict the target time period when the network of the target application is stable, and feed the target time period back to the target application. The message sent by the target application within the target time period is obtained, the second message is obtained, and the first message and the second message are compared to obtain the target comparison result, wherein the message sent by the target application within the target time period is the same as the message sent by the target application to the message queue topic; If the first message and the second message are determined to be different based on the target comparison result, a compensation message is sent to the message queue topic, wherein the compensation message is the message that is missing from the first message relative to the second message, and the message queue topic is used to determine the second message based on the compensation message and the first message.

2. The method according to claim 1, characterized in that, Before predicting the target time period when the target application network is stable based on the network fluctuation pattern of the target application over time, the method further includes: Upon receiving a time period acquisition instruction sent by the target application, the network fluctuation pattern of the target application over time is determined based on multiple historical network delay information sent by the target application, wherein the multiple historical network delay information are sent by the target application at preset time intervals.

3. The method according to claim 1, characterized in that, By comparing the first message and the second message, the target comparison result is obtained, including: The first message is segmented to obtain N first message fragments, where N is a positive integer greater than 1; The second message is segmented to obtain N second message fragments; Compare the N first message segments with the N second message segments that are in the same order to obtain the matching result for each order; The target alignment result is constituted by the alignment results of each sequence position matching.

4. The method according to claim 3, characterized in that, Compare the N first message segments with the N second message segments that are in the same sequence position to obtain the comparison result for each sequence position match, including: For the first message segment and the second message segment with the same sequence position, the first message segment is used to extract features through the deep forest model to obtain the first target feature matrix, and the second message segment is used to extract features through the deep forest model to obtain the second target feature matrix. If the first target feature matrix is ​​the same as the second target feature matrix, then the first message segment and the second message segment are determined to be the same. If the first target feature matrix is ​​different from the second target feature matrix, then the first message fragment and the second message fragment are determined to be different.

5. The method according to claim 4, characterized in that, The deep forest model includes multiple cascaded forests, each of which includes the same number of random forests and fully random forests. The deep forest model is used to extract features from the first message segment to obtain a first target feature matrix, including: Perform multi-granularity scanning on the first message segment to obtain the feature vectors of the first message segment at different granularities; The first feature vector is obtained by combining the feature vectors of the first message segment at different granularities. The first feature matrix is ​​obtained by extracting features from the first feature vector through the first-level cascaded forest. The steps of extracting features from the feature matrix output by the previous cascaded forest through the next cascaded forest are executed sequentially, and the feature matrix output by the last cascaded forest is determined as the first target feature matrix.

6. The method according to claim 3, characterized in that, Sending a compensation message to the message queue topic includes: From the N comparison results in the target comparison results, the comparison results to be matched are selected, wherein the comparison results to be matched are the comparison results that characterize the difference between the first message segment and the second message segment; The target message segment is obtained by determining the second message segment that matches the comparison result of the N second message segments; The target message fragment is identified as the compensation message, and the compensation message is sent to the message queue topic.

7. The method according to claim 1, characterized in that, Retrieve messages sent by the target application to the message queue topic from the message queue topic to obtain the first message, including: Obtain the topic identifier of the message queue topic and the network address that matches the message queue topic; The server where the message queue topic is located is found based on the network address, and the message queue topic is subscribed to on the server based on the topic identifier; The first message is obtained by retrieving the message sent by the target application to the message queue topic.

8. A message compensation device, characterized in that, include: The acquisition module is used to acquire messages sent by the target application to the message queue topic from the message queue topic, and obtain the first message, wherein the message queue topic contains multiple message queues; The prediction module is used to predict the target time period when the network of the target application is stable based on the network fluctuation pattern of the target application over time, and to feed back the target time period to the target application. The comparison module is used to obtain messages sent by the target application within the target time period, obtain a second message, and compare the first message and the second message to obtain a target comparison result, wherein the message sent by the target application within the target time period is the same as the message sent by the target application to the message queue topic; A sending module is configured to send a compensation message to the message queue topic when it is determined, based on the target comparison result, that the first message and the second message are different. The compensation message is the message that is missing from the first message relative to the second message, and the message queue topic is used to determine the second message based on the compensation message and the first message.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the compensation method for the message as described in any one of claims 1 to 7 when it is run.

10. An electronic device, characterized in that, The electronic device includes one or more processors; A memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to perform operations on the programs, wherein the programs are configured to execute the message compensation method as described in any one of claims 1 to 7 at runtime.

Citation Information

Patent Citations

  • Data packet multi-sending parameter prediction method and device and storage medium

    CN113839830A

  • Method and system for transmitting data from cloud to local terminal at high speed

    CN115834973A