Message monitoring method and device, equipment and storage medium
By judging whether to monitor asynchronous broadcast messages based on historical reliability data and random functions, and using variable-length status recording units and XOR operations, the problem of loss in asynchronous broadcast message transmission and the problem of large storage space usage are solved, and the implementation This improves the reliability of message transmission and storage efficiency.
Patent Information
- Application Number
- CN202411123570.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-10-11
AI Technical Summary
Asynchronous broadcast messages may be lost during transmission, and existing message monitoring solutions occupy too large a storage space and cannot effectively guarantee the reliable transmission of messages.
Based on historical reliability data and random functions, it is judged whether to monitor the messages to be sent, and only the messages confirmed to need monitoring are recorded. Variable-length status recording units and XOR operations are used to update the consumption status to reduce storage space consumption.
It realizes selective monitoring of asynchronous broadcast messages, significantly saves storage space, and improves the reliability of message transmission and storage efficiency.
Smart Images

Figure CN118764456A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message monitoring method, device, equipment and storage medium. Background Art
[0002] In the current Internet application system architecture, asynchronous broadcast messages are a common means of communication. The so-called asynchronous broadcast message refers to sending a message in the form of broadcast, and other business systems subscribe to the message on demand, such as Figure 1 As shown, Figure 1 The producer in is equivalent to the sender of the message, and multiple consumers have subscribed to the message, such as Figure 1 As shown in consumer_1 to consumer_n.
[0003] In a synchronous message transmission, the sender can only send a message to one receiver, and the sender needs to wait for the receiver's return to confirm the message consumption. The sender will send subsequent messages only after receiving the confirmation information returned by the receiver. In an asynchronous broadcast message, the sender can send messages to multiple consumers at the same time without waiting for the consumer's return. Therefore, asynchronous broadcast messages have better throughput than synchronous messages.
[0004] However, asynchronous broadcast messages also bring certain challenges. For example, messages may be lost during transmission, or messages may be discarded due to consumer abnormalities. How to monitor asynchronous broadcast messages to ensure the reliable transmission of asynchronous broadcast messages is an urgent problem that needs to be solved. Summary of the invention
[0005] The present application provides a message monitoring method, apparatus, device and storage medium for saving storage space required for message monitoring.
[0006] In a first aspect, the present application provides a message monitoring method, the method comprising:
[0007] Get the message to be sent and N consumers who subscribe to the message to be sent; N is a positive integer;
[0008] Determining whether to monitor the message to be sent based on historical reliability data and a random function, wherein the historical reliability data is determined based on message loss conditions within a historical time interval;
[0009] If it is determined that the message to be sent needs to be monitored, the message to be sent is sent to the N consumers, and the consumption of the message to be sent by the N consumers is recorded;
[0010] The historical reliability data is updated according to the consumption status of the N consumers for the message to be sent.
[0011] Existing message monitoring solutions usually monitor each message to be sent and record the consumption of the messages, which consumes too much storage space. The present application takes into account that message loss is a low-probability event. Therefore, it determines whether to monitor the messages to be sent based on historical reliability data, and the historical monitoring data is determined according to the loss of historical messages. In this way, the historical reliability data can provide an accurate basis for whether to monitor the messages to be sent, thereby realizing selective monitoring of the messages to be sent. Compared with recording the consumption of each message to be sent, the present application only needs to record the consumption of the messages to be sent that are confirmed to be monitored, which significantly saves storage space.
[0012] In a possible design, the historical reliability data is determined based on message loss conditions in K consecutive historical time intervals, each of the K consecutive historical time intervals having a corresponding reliability tag; K is a positive integer;
[0013] Wherein, the message sent in the i-th historical time interval is not monitored; or, at least one message sent in the i-th historical time interval is monitored, and the at least one message is not lost, then the reliability mark corresponding to the i-th historical time interval is the first value;
[0014] At least one message sent in the i-th historical time interval is monitored, and at least one of the at least one messages is lost, then the reliability mark corresponding to the i-th historical time interval is a second value;
[0015] The i-th historical time interval is any one of the K historical time intervals; i is a positive integer and i is less than or equal to K.
[0016] For a historical time interval, if the messages sent within the historical time interval are not monitored, it is considered that there is no message loss for the messages sent within the historical time interval, so as to ensure the continuity of the historical reliability data, and further ensure the accuracy of judging whether to monitor the messages to be sent based on the historical reliability data.
[0017] In a possible design, determining whether to monitor the message to be sent based on historical reliability data and a random function includes:
[0018] Calculating the historical reliability data to obtain a first calculation result;
[0019] Determine a second calculation result according to the first calculation result and the random function;
[0020] If the second calculation result is greater than a preset value, it is necessary to monitor the message to be sent;
[0021] If the second calculation result is less than or equal to the preset value, there is no need to monitor the message to be sent.
[0022] In a possible design, sending the to-be-sent message to the N consumers includes:
[0023] Determine the state recording unit corresponding to the message to be sent; any state recording unit is used to record the consumption of the message to be sent, and any message to be sent has a corresponding state recording unit;
[0024] The message confirmation identifier, the identifier of the state recording unit and the content of the message to be sent are constructed into the message to be sent and sent to the N consumers; the message confirmation identifier is used to indicate that the consumer needs to feedback a response message to the message to be sent;
[0025] Recording the consumption of the N consumers for the message to be sent, including:
[0026] Setting the initial consumption state of each consumer in the state recording unit to non-consumption;
[0027] receiving a response message from any one of the N consumers; the response message including an identifier of the state recording unit and an identifier of the consumer;
[0028] According to the response message of any consumer, the consumption status corresponding to the consumer in the status recording unit is updated.
[0029] In a possible design, any state recording unit is an array, and at least one array element in the array stores the consumption situation of the corresponding consumer; the identifier of the state recording unit is the identifier of the array;
[0030] The identifier of the consumer is the position identifier of the element corresponding to the consumer in the array.
[0031] If the consumer ID or consumer number is used as the consumer's identifier, then the consumer ID or consumer number also needs to be recorded when recording the message consumption status. Generally, the length of the consumer ID or consumer number is relatively long, and therefore, it consumes more storage space. However, the present application uses the position identifier of the array element, that is, the subscript of the array element as the consumer's identifier, and there is no need to record the consumer ID or consumer number, thereby further saving storage space.
[0032] In a possible design, the state recording unit is an array of variable length, and its length is determined according to the number of consumers.
[0033] The length of the array used to record the status is determined according to the number of consumers. When the number of consumers is large, the length of the array can be set longer; when the number of consumers is small, the length of the array can be set shorter to avoid wasting array elements; that is, the length of the array recording consumption status can be flexibly adjusted, which has good flexibility.
[0034] In one possible design, the determining a status recording unit corresponding to the message to be sent includes:
[0035] Using any state recording unit with a usage flag of unused as the state recording unit corresponding to the message to be sent and setting the usage flag of the state recording unit to used;
[0036] After recording the consumption of the message to be sent by the N consumers, the method further includes:
[0037] After a set condition is met, the use flag of the status recording unit is set to unused; the set condition indicates that the monitoring of the message to be sent has been completed.
[0038] After monitoring of the message to be sent is completed, the usage flag of the status recording unit can be modified to unused for subsequent reuse, avoiding the need to recreate the array each time to record the consumption status of the message, thereby improving the utilization rate of the status recording unit and the utilization rate of the storage space.
[0039] In a possible design, the state recording unit is a first array; the initial value of at least one array element in the first array is used to indicate that the consumer has not consumed the message to be sent;
[0040] According to the response message of any consumer, the consumption status corresponding to the consumer in the status recording unit is updated, including:
[0041] Creating a second array, the length of the second array being the same as the length of the first array;
[0042] According to a response message of any consumer, setting the consumption status of the consumer in the second array;
[0043] Perform an XOR operation on the first array and the second array to update the consumption status corresponding to the consumer in the first array
[0044] In one possible design, it also includes:
[0045] Creating a third array, wherein the third array is used to store the content of the message to be sent;
[0046] Determine consumers in the first array whose consumption status is non-consumption after a preset time interval;
[0047] The message to be sent is resent to the unconsumed consumer according to the content of the message to be sent stored in the third array.
[0048] A third array is created to separately store the content of the message to be sent. The status record array only needs to record the consumption status of the message, thereby realizing the functional decoupling of each array. When there are consumers who have not consumed the message, the message content stored in the third array can also be resent to improve the success rate of consumer message consumption.
[0049] In a second aspect, the present application further provides a message monitoring device, the device comprising: a transceiver unit and a processing unit;
[0050] The transceiver unit is used to obtain the message to be sent and N consumers who subscribe to the message to be sent; N is a positive integer;
[0051] The processing unit is used to determine whether to monitor the message to be sent based on historical reliability data and a random function, wherein the historical reliability data is determined according to message loss conditions within a historical time interval;
[0052] If it is determined that the message to be sent needs to be monitored, the transceiver unit is also used to send the message to be sent to the N consumers, and the processing unit is also used to record the consumption status of the message to be sent by the N consumers; and update the historical reliability data according to the consumption status of the message to be sent by the N consumers.
[0053] In a possible design, the historical reliability data is determined based on message loss conditions in K consecutive historical time intervals, each of the K consecutive historical time intervals having a corresponding reliability tag; K is a positive integer;
[0054] Wherein, the message sent in the i-th historical time interval is not monitored; or, at least one message sent in the i-th historical time interval is monitored, and the at least one message is not lost, then the reliability mark corresponding to the i-th historical time interval is the first value;
[0055] At least one message sent in the i-th historical time interval is monitored, and at least one of the at least one messages is lost, then the reliability mark corresponding to the i-th historical time interval is a second value;
[0056] The i-th historical time interval is any one of the K historical time intervals; i is a positive integer and i is less than or equal to K.
[0057] In a possible design, the processing unit is used to determine whether to monitor the message to be sent based on the historical reliability data and the random function: calculate the historical reliability data to obtain a first calculation result;
[0058] Determine a second calculation result according to the first calculation result and the random function;
[0059] If the second calculation result is greater than a preset value, it is necessary to monitor the message to be sent;
[0060] If the second calculation result is less than or equal to the preset value, there is no need to monitor the message to be sent.
[0061] In a possible design, the transceiver unit is used to send the message to be sent to the N consumers:
[0062] Determine the state recording unit corresponding to the message to be sent; any state recording unit is used to record the consumption of the message to be sent, and any message to be sent has a corresponding state recording unit;
[0063] The message confirmation identifier, the identifier of the state recording unit and the content of the message to be sent are constructed into the message to be sent and sent to the N consumers; the message confirmation identifier is used to indicate that the consumer needs to feedback a response message to the message to be sent;
[0064] The processing unit is used to record the consumption status of the N consumers for the message to be sent:
[0065] Setting the initial consumption state of each consumer in the state recording unit to non-consumption;
[0066] receiving a response message from any one of the N consumers; the response message including an identifier of the state recording unit and an identifier of the consumer;
[0067] According to the response message of any consumer, the consumption status corresponding to the consumer in the status recording unit is updated.
[0068] In a possible design, any state recording unit is an array, and at least one array element in the array stores the consumption situation of the corresponding consumer; the identifier of the state recording unit is the identifier of the array;
[0069] The identifier of the consumer is the position identifier of the element corresponding to the consumer in the array.
[0070] In a possible design, the state recording unit is an array of variable length, and its length is determined according to the number of consumers.
[0071] In one possible design, the processing unit is used to determine the state recording unit corresponding to the message to be sent:
[0072] Using any state recording unit with a usage flag of unused as the state recording unit corresponding to the message to be sent and setting the usage flag of the state recording unit to used;
[0073] The processing unit is used to record the consumption of the N consumers for the message to be sent, and is also used to set the usage flag of the status recording unit to unused after meeting the set conditions; the set conditions indicate that the monitoring of the message to be sent has been completed.
[0074] In a possible design, the state recording unit is a first array; the initial value of at least one array element in the first array is used to indicate that the consumer has not consumed the message to be sent;
[0075] The processing unit is used to update the consumption status corresponding to the consumer in the status recording unit according to the response message of any consumer:
[0076] Creating a second array, the length of the second array being the same as the length of the first array;
[0077] According to a response message of any consumer, setting the consumption status of the consumer in the second array;
[0078] An XOR operation is performed on the first array and the second array to update the consumption status corresponding to the consumer in the first array.
[0079] In a possible design, the processing unit is further used for:
[0080] Creating a third array, wherein the third array is used to store the content of the message to be sent;
[0081] Determine consumers in the first array whose consumption status is non-consumption after a preset time interval;
[0082] The message to be sent is resent to the unconsumed consumer according to the content of the message to be sent stored in the third array.
[0083] In a third aspect, the present application further provides a message monitoring device, the device comprising: a processor, and a memory communicatively connected to the processor;
[0084] The memory stores computer-executable instructions;
[0085] The processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect above.
[0086] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a program, and when the program is executed on a device, the device executes the method as described in any one of the above-mentioned first aspects.
[0087] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0089] Figure 1 A schematic diagram of sending an asynchronous broadcast message provided in an embodiment of the present application;
[0090] Figure 2 A schematic diagram of a message monitoring method flow provided in an embodiment of the present application;
[0091] Figure 3 A schematic diagram of the data structure of the state recording unit provided in an embodiment of the present application;
[0092] Figure 4 A schematic diagram of the interaction between the message prediction component, message status component, and message monitoring component provided in an embodiment of the present application;
[0093] Figure 5 A schematic diagram of the structure of the message monitoring device provided in the embodiment of the present application Figure 1 ;
[0094] Figure 6 A schematic diagram of the structure of the message monitoring device provided in the embodiment of the present application Figure 2 . DETAILED DESCRIPTION
[0095] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0096] The application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more.
[0097] The existing asynchronous message monitoring scheme is as follows: after the sender sends an asynchronous message, it records the consumption of each consumer on the asynchronous message one by one, and modifies the corresponding consumption status after receiving the consumer's feedback; wherein, the consumption status is usually recorded using a triple data structure, as shown in Table 1:
[0098] Broadcast message ID Subscribers Message content Consumption status 29402602dc323854b117b2995b2f1dde 13955235245B2497 ... S 29402602dc323854b117b2995b2f1dde 2D7067126EB08ADB ... F 29402602dc323854b117b2995b2f1dde BB2ABD2896E4F14F ... S
[0099] Table 1
[0100] As shown in Table 1, Table 1 is a record of the consumption of the asynchronous message with the message ID "29402602dc323854b117b2995b2f1dde". The asynchronous message has three subscribers, and the subscriber IDs are "13955235245B2497", "2D7067126EB08ADB" and "BB2ABD2896E4F14F" respectively. The consumption status is "S" which means that it has been successfully consumed. For asynchronous messages, the consumption status "F" indicates that the asynchronous message has not been consumed. Therefore, according to Table 1, consumers with IDs "13955235245B2497" and "BB2ABD2896E4F14F" have consumed the asynchronous message with ID "29402602dc323854b117b2995b2f1dde", and the consumer with ID "2D7067126EB08ADB" has not consumed the asynchronous message.
[0101] The existing asynchronous message monitoring solution monitors each asynchronous message, and according to Table 1, each record needs to store the asynchronous message ID, consumer ID and message content. The occupied storage space is linearly related to the number of consumers. As the number of consumers increases, the storage space occupancy rate also increases, and the performance of asynchronous message monitoring will decrease accordingly. At the same time, with the rapid growth of historical record data, the historical record data needs to be cleaned up, and the data cleaning process will waste a lot of computing resources, which may cause the server's CPU and disk IO to soar, and may even cause the entire server to be unavailable.
[0102] In order to solve the problem that the existing asynchronous message monitoring solution occupies a large storage space, this application proposes the following Figure 2 The message monitoring method shown in the figure can be performed by a server, a chip in the server, or a functional module or component in the server, and this application does not limit this. Figure 2 The message monitoring method shown is described below. The method specifically includes:
[0103] Step 200: Obtain the message to be sent and N consumers who subscribe to the message to be sent, where N is a positive integer.
[0104] Exemplarily, the message to be sent may be an asynchronous message. If you need to receive an asynchronous message, you should subscribe. After subscribing to the asynchronous message, you become a consumer of the asynchronous message. Each consumer has a unique identifier, which may be the consumer's ID or the consumer's number.
[0105] For example, taking an order message as an example, multiple consumers have subscribed to the order message. Assume that the consumers include logistics, payment, after-sales and customer service. Among them, logistics handles delivery-related business according to the order message, payment handles user deductions and other related business according to the order message, after-sales provides after-sales service to the user corresponding to the order according to the order message, and customer service provides consultation or help to the user corresponding to the order according to the order message.
[0106] Exemplarily, the server stores consumers corresponding to various messages. After obtaining the message to be sent, N consumers who have subscribed to the message to be sent can be obtained.
[0107] Step 201: Determine whether to monitor the message to be sent based on historical reliability data and a random function. The historical reliability data is determined based on the message loss situation within a historical time interval.
[0108] For example, historical reliability data is actually determined based on the message loss in K consecutive historical time intervals, where K is a positive integer; K consecutive historical time intervals can be understood as a time series to represent the sampling interval. Taking the time series [n, n-1, n-2, ..., 1] as an example, the larger the n, the farther away from the current time. For example, assuming the time series is [9, 8, 7, 6, 5, 4, 3, 2, 1], then the time series represents the sampling intervals of the 9th second in the past, the 8th second in the past ... the 1st second in the past.
[0109] Exemplarily, each of the above K consecutive historical time intervals has a corresponding reliability mark, and the reliability mark is a first value or a second value, for example, the first value is 0 and the second value is 1; or the first value is 1 and the second value is 0; this application does not limit this. It should be noted that the following explanation is based on the example that the first value is 0 and the second value is 1.
[0110] Taking the i-th historical time interval among K historical time intervals as an example, the determination of the reliability mark is further explained. The i-th historical time interval is any historical time interval among the K historical time intervals, and i is a positive integer and i is less than or equal to K:
[0111] Exemplarily, the reliability mark of the i-th historical time interval is a first value, indicating that no messages sent within the historical time interval are lost, wherein the absence of messages sent within the i-th historical time interval can be divided into two situations: first, the messages sent within the i-th historical time interval are not monitored. If the messages sent within the i-th historical time interval are not monitored, it is assumed that all messages sent within the time interval are successfully consumed and no messages are lost; second, at least one message sent within the i-th historical time interval is monitored, and at least one message is not lost. In this case, the reliability mark corresponding to the i-th historical time interval is also the first value.
[0112] For example, assuming that three asynchronous messages are sent in the i-th historical time interval, these three asynchronous messages are monitored, and these three asynchronous messages are successfully consumed by consumers, there is no message loss, then the reliability mark corresponding to the i-th historical time interval is the first value, that is, the reliability mark corresponding to the i-th historical time interval is 0.
[0113] Exemplarily, the reliability mark of the ith historical time interval as the second value indicates that messages sent in the historical time interval are lost. Since it can be determined that messages are lost in the ith historical time interval, it indicates that the messages sent in the ith historical time interval are monitored. Specifically, at least one message sent in the ith historical time interval is monitored, and at least one message in the at least one message is lost, then the reliability mark corresponding to the ith historical time interval is the second value; that is, if multiple messages are sent in the ith historical time interval, as long as one message is lost, it is considered that messages are lost in the ith historical time interval.
[0114] For example, assuming that 5 asynchronous messages are sent in the i-th historical time interval, and these 5 asynchronous messages are monitored, only one of the 5 messages is lost. Even if the other 4 messages have been successfully consumed by consumers, the reliability mark corresponding to the i-th historical time interval is still the second value, that is, the reliability mark corresponding to the i-th historical time interval is 1.
[0115] Further illustratively, by adopting the above method of determining the reliability mark corresponding to the i-th historical time interval, the reliability marks corresponding to other historical time intervals can also be determined, and then the reliability mark corresponding to each of the K historical time intervals can be determined, that is, K reliability marks are determined, and these K reliability marks are recorded as [S K , S K-1 , S K-2 ,......,S 1 ].
[0116] After obtaining K reliability marks, the K reliability marks can be calculated to obtain a first calculation result, which is equivalent to calculating the historical reliability data to obtain the first calculation result; assuming that K is 10 and the K reliability marks are [0,0,0,0,0,0,0,1,0,0], the first calculation result can be obtained by the following two calculation methods:
[0117] Method 1: Use a time series algorithm to calculate the historical reliability data to obtain a first calculation result; wherein the calculation formula of the time series prediction algorithm is: S K represents the reliability mark corresponding to each historical time interval in K historical time intervals, then
[0118] Method 2: Perform weighted summation on historical reliability data to obtain the first calculation result; the weight value of each reliability mark can be set according to actual business needs, and this application does not limit this. It is generally believed that the reliability mark closer to the current time has a greater impact on the prediction of whether to monitor the message to be sent. In this way, a larger weight value can be set for the reliability mark closer to the current time. For example, assuming that the weight values set for the above 10 reliability marks are 0.05, 0.05, 0.05, 0.1, 0.1, 0.1, 0.1, 0.2, 0.2 from far to near, then the first calculation result = 0.05×0+0.05×0+0.05×0+0.05×0+0.1×0+0.1×0+0.1×0+0.1×1+0.2×0+0.2×0=0.1.
[0119] Secondly, after obtaining the first calculation result, the second calculation result is determined based on the first calculation result and the random function. For example, the first calculation result and the random number generated by the random function are summed to obtain the second calculation result. Assuming that the random function used in this application is random(1), then the second calculation result = the first calculation result + random(1), where the value range of the random number generated by random(1) is 0 to 1.
[0120] For example, assuming that the random number generated by the random function is 0.3, if the first calculation result is obtained by the above method 1 That is 0.125, then the second calculation result = the first calculation result + random(1) = 0.125 + 0.3 = 0.425; if the first calculation result is 0.1 obtained by the above method 2, then the second calculation result = the first calculation result + random(1) = 0.1 + 0.3 = 0.4.
[0121] Finally, determine whether to monitor the message to be sent based on the second calculation result. Specifically, if the second calculation result is greater than the preset value, the message to be sent needs to be monitored; if the second calculation result is less than or equal to the preset value, there is no need to monitor the message to be sent; the preset value ranges from 0 to 1, and relevant technical personnel can set the preset value based on experience, and then use the preset value to monitor for a period of time. If the monitoring effect is not ideal, the preset value can be adjusted.
[0122] For example, assuming that the preset value is 0.3, no matter the second calculation result is 0.425 or 0.4, it is greater than the preset value, so the message to be sent needs to be monitored.
[0123] For message sending, message loss is a low-probability event. In most cases, messages are sent and received stably. If the decision on whether to monitor messages is based solely on historical reliability data, there may be a situation where the messages do not need to be monitored at all. Therefore, this application also introduces a random function based on historical reliability data to implement random sampling of messages, that is, to implement selective monitoring of messages.
[0124] Step 202: If it is determined that the message to be sent needs to be monitored, the message to be sent is sent to N consumers, and the consumption of the message to be sent by the N consumers is recorded.
[0125] Exemplarily, after determining that the message to be sent needs to be monitored according to the second calculation result of step 201, it is first necessary to determine the status recording unit for recording the consumption status of the message to be sent. It should be noted that any message to be sent has a corresponding status recording unit. In other words, for any message to be sent that is determined to need to be monitored, there is a corresponding status recording unit to record the consumption status of the message.
[0126] Exemplarily, the state recording unit is an array, and at least one array element in the array stores the consumption status of the corresponding consumer, such as Figure 3 The shown array is 64 bits long, and each bit can be called an array element; the highest bit of the array is the array usage flag, which can be 0 or 1. 0 can indicate that the array has not been used, and 1 can indicate that the array has been used. The remaining 63 bits can be used to record the consumer's consumption status, that is, each bit in the 63 bits can be used to record the consumption status of a consumer. When determining the status record unit, it should be searched in the array with the usage flag as unused, that is, an array with the highest bit as 0 should be searched as the status record unit, and after it is used as the status record unit corresponding to the message to be sent, the array usage flag should be set to used, that is, the highest bit of the array should be set to 1.
[0127] One thing that needs to be explained is that the length of the array is variable. The length of the array can be determined according to the number of consumers. When the number of consumers is large, the length of the array can be set longer, and when the number of consumers is small, the length of the array can be set shorter. The length of the array is usually a multiple of 8. For example, if there are 30 consumers, the length of the array can be set to 32 bits; if there are 6 consumers, the length of the array can be set to 8 bits. The length of the array can be flexibly adjusted according to the number of consumers to avoid wasting array elements and save storage space. Compared with the existing triple data structure, the more consumers there are, the more obvious the effect of saving storage space by using the array data structure in this application.
[0128] Exemplarily, each array has a subscript, which can be used as an identifier of the array or as an identifier of a state recording unit. For example, assuming that an array with a subscript of 234 is determined as a state recording unit, the identifier of the state recording unit is 234.
[0129] Exemplarily, the consumer also has a corresponding identification. Generally speaking, the consumer's identification is a consumer ID or a consumer number, similar to "BB2ABD2896E4F14F", which is relatively long. When stored in this format, it takes up more storage space. Therefore, the present application converts the consumer ID through preset configuration information. Taking the order message as an example, the four consumers of logistics, payment, after-sales and customer service have subscribed to the order message. Once the subscription relationship is determined, the preset configuration relationship will assign corresponding identifications to the consumers. For example, the identification assigned to logistics is 1, the identification assigned to payment is 2, the identification assigned to after-sales is 3, and the identification assigned to customer service is 4; corresponding to the array, each consumer has a corresponding array element in the array to record the consumer's consumption status, so the consumer's identification can also be represented by the position identification of the consumer's corresponding element in the array. This position identification is for the array element from low to high. For example, Figure 3 For example, Figure 3 The leftmost array element is the highest-order array element, and the rightmost array element is the lowest-order array element. For logistics, we should use Figure 3 The first array element from right to left in the table records the consumption status of the logistics consumer; for payment, the Figure 3 The second array element from right to left in the payment is used to record the consumption status of the consumer; similarly, for after-sales, Figure 3 The third array element from right to left in the table records the consumption status of the after-sales consumer; for customer service, you should use Figure 3 The fourth array element from right to left in the table records the consumption status of the customer service consumer. In this way, there is no need to record the consumer ID in the status recording unit. The consumer ID can be obtained directly according to the position identifier of the array element, saving storage space.
[0130] Exemplarily, after determining the status recording unit, the message confirmation identifier, the identifier of the status recording unit and the content of the message to be sent are constructed into a message to be sent and sent to N consumers, wherein the message confirmation identifier is used to indicate that the consumer needs to feedback a response message to the message to be sent, and the response message fed back by the consumer can be used to determine whether the consumer has consumed the message to be sent.
[0131] Exemplarily, after the message to be sent is sent to N consumers, the consumption status of the message to be sent by the N consumers can be recorded. It is assumed that the state unit recording the consumption status of the message to be sent is recorded as the first array, and the initial value of at least one array element in the first array is used to indicate that the consumer has not consumed the message to be sent. For example, the initial value can be set to 1, indicating that the consumer has not consumed the message. Since the message to be sent contains a message confirmation identifier, when the consumer consumes the message to be sent, a response message will be returned. The response message includes the identifier of the state recording unit and the identifier of the consumer. After receiving a response message from any consumer among the N consumers, the consumption status corresponding to the consumer in the state recording unit is updated according to the response message of any consumer, and the array element is updated from 1 to 0, indicating that the consumer has consumed the message to be sent.
[0132] Further exemplarily, the steps for updating the consumption status are as follows: first, create a second array, the length of the second array is the same as the length of the first array; then, according to the response message of any consumer, set the consumption status of the consumer in the second array; then perform an XOR operation on the first array and the second array to update the consumption status corresponding to the consumer in the first array.
[0133] For example, assuming that the first array is [1000 0111], the identifier of the first array is 234, and now a response message returned by a consumer is received, and the content of the response message is: ① consumer identifier: 2; ② status recording unit identifier: 234; after receiving the response message, create a second array [0000 0010] (the position of the second element from right to left corresponds to the subscript of the consumer), and perform an asynchronous operation on the first array and the second array, that is, perform an XOR operation on [1000 0111] and [0000 0010]. After the XOR operation, the first array is changed to [1000 0101], and the second array element from right to left is changed from 1 to 0, indicating that the consumer with consumer identifier 2 has consumed the message to be sent.
[0134] Exemplarily, after the set conditions are met, the usage flag of the status recording unit can also be set to unused to achieve reuse of the status recording unit. The set conditions indicate that monitoring of the messages to be sent has been completed. Completion of monitoring of the messages to be sent can also be understood as N consumers have successfully consumed the messages to be sent.
[0135] For example, after receiving the response message returned by each consumer in succession, the first array is updated from [1000 0111] to [1000 0000], indicating that the three consumers have successfully consumed the message to be sent. At this time, the usage flag of the first array can be modified to unused, that is, the highest bit of the first array is modified to 0, and the modified first value is [0000 0000].
[0136] In addition, in order to improve the success rate of consumers consuming the messages to be sent, a third array can be created after the messages to be sent are sent. The third array is used to store the content of the messages to be sent. If it is determined that there are consumers in the first array whose consumption status is non-consumption after a preset time interval, the messages to be sent can be resent to the non-consumed consumers based on the content of the messages to be sent stored in the third array. In this way, the content of the messages to be sent is only stored once in the third array, and the first array is only used to record the consumption status, thereby realizing the functional decoupling of each array.
[0137] For example, assuming that the preset time interval is 500ms, 500ms after the message to be sent is sent, there are still array elements in the first array whose consumption status is unconsumed, then the message content stored in the third array is resent to the consumer corresponding to the array element, thereby improving the consumption success rate of the message to be sent.
[0138] Step 203: Update the historical reliability data according to the consumption status of the N consumers for the messages to be sent.
[0139] Exemplarily, through step 202, the consumption of the message to be sent by N consumers can be obtained, and then the historical reliability data is updated according to the consumption of the message to be sent by the N consumers. If all N consumers have successfully consumed the message to be sent and there is no message loss, then the time interval corresponding to the sending time of the message to be sent is added to the historical reliability data, and the reliability mark corresponding to the time interval is set to the first value, that is, set to 0, for example, the historical reliability data is updated from [0,0,0,0,0,0,0,0,0,0] to [0,0,0,0,0,0,0,0,0,0,0]; if there is a consumer among the N consumers who has not consumed the message to be sent, that is, there is message loss, then the historical reliability data is updated from [0,0,0,0,0,0,0,0,0,0] to [0,0,0,0,0,0,0,0,0,0,1].
[0140] By updating the historical reliability data, it is ensured that whether to monitor the message to be sent is always determined based on the latest historical reliability data, thereby improving the accuracy of the judgment.
[0141] The above is an explanation of the message monitoring method proposed in this application with the server as the execution subject. The server can include a message prediction component, a message status component and a message monitoring component. The interaction between the three components is as follows: Figure 4 As shown, the message prediction component is used to execute the above step 201, the message status component is used to execute the above step 202, and the message monitoring component is used to execute the above step 203. The message monitoring method proposed in this application is explained below based on the message prediction component, the message status component and the message detection component:
[0142] (1) Send the first message msg1. First, the message prediction component performs reliability prediction. Assume that the historical reliability data is [0,0,0,0,0,0,0,0,0,0], the preset value is 0.3, and the second calculation result is 0.4. Since the second calculation result is greater than the preset value, the message prediction component determines that msg1 needs to be monitored.
[0143] (2) Find the array element with the usage flag of unused from the message status component, and change the usage flag of the array element to used. Assume that in this step we find the array with the subscript 234 as the status record unit, mark it in the message header of msg1 and record it {confirm: true, seq=234}, and send it to the consumer together with the message content of msg1, where "confirm: true" is the message confirmation flag, which is used to indicate that the consumer should feedback a response message, and "seq=234" is the array flag, that is, the flag of the status record unit;
[0144] (3) The message status component obtains the consumer index set of msg1 through the consumer configuration module as [1,2,3,4,13,18,22,23,12], and changes the array with index 234 to [10000000 00000000
[0145] 00000000 00000000 00000000 01100010 00011000 00001111], wherein the first element from left to right indicates that the array has been used, the first element from right to left is used to record the consumption status of the consumer labeled 1, the second element from right to left is used to record the consumption status of the consumer labeled 2, ..., the 23rd element from right to left is used to record the consumption status of the consumer labeled 23, and the 12th element from right to left is used to record the consumption status of the consumer labeled 12;
[0146] (4) After receiving msg1, the consumer with index 13 finds that the message confirmation mark is true, so it returns a response message to the message sender: [seq:234,cur:13,isConfirm:true];
[0147] (5) After receiving the response message of step (4), it can be determined that the status record unit identifier is 234, the consumer index is 13, and the array with index 234 is obtained from the message status component: [10000000
[0148] 00000000 00000000 00000000 00000000 01100010 00011000 00001111], and create a new array according to the response message, that is, the second array, and assign the value [00000000 00000000
[0149] 00000000 00000000 00000000 00010000 000000000], the position of the array element with the value 1 in the second array (the 13th from the right to the left) corresponds to the subscript of the consumer, and the second array is used to perform an XOR operation with the array with the subscript 234. After the XOR operation, the array with the subscript 234 is changed to [10000000 000000000000000 00000000 00000000 01100010 0000100000001111];
[0150] (6) After receiving msg1, the consumer with index 23 finds that the message confirmation mark is true, so it returns a response message to the message sender: [seq:234,cur:23,isConfirm:true];
[0151] (7) After receiving the response message of step (6), it can be determined that the status record unit identifier is 234, the consumer index is 23, and the array with index 234 is obtained from the message status component: [10000000
[0152] 00000000 00000000 00000000 00000000 01100010 00001000 00001111], and create a new array according to the response message, that is, the second array, and assign the value [00000000 00000000
[0153] 00000000 00000000 00000000 01000000 00000000 00000000], the position of the array element with the value 1 in the second array (the 23rd position from the right to the left) corresponds to the subscript of the consumer, and the second array is used to perform an XOR operation with the array with the subscript 234. After the XOR operation, the array with the subscript 234 is changed to [10000000 000000000000000 00000000 00000000 00100010 000010000001111];
[0154] (8) Similarly, consumers continue to return response messages, but the response message returned by the consumer with index 4 has not yet been received. Therefore, the array with index 234 is always [10000000 00000000 00000000 00000000 00000000 00000000 00001000];
[0156] (9) The message monitoring component scans the message status component and finds that the sending time of msg1 has exceeded 500ms, and the status recording unit used to record the consumption status of msg1, that is, the array with subscript 234, still contains array elements indicating unconsumed. Therefore, the message monitoring component believes that msg1 has message loss and updates the historical reliability data to [0,0,0,0,0,0,0,0,0,1].
[0157] (10) At this time, there is a second message msg2 that needs to be sent. The message prediction component calculates based on the historical reliability data updated in step (9) and determines that msg2 needs to be monitored;
[0158] (11) Find the array element with the usage flag of unused from the message status component, and change the usage flag of the array element to used. Assume that in this step we find the array with the subscript 98212 and use it as the status record unit. Mark it in the message header of msg2 and record it with {confirm: true, seq = 98212}, and send it to the consumer together with the message content of msg2, where "confirm: true" is the message confirmation flag, which is used to indicate that the consumer should feedback a response message, and "seq = 98212" is the array flag, that is, the flag of the status record unit;
[0159] (12) The message status component obtains the consumer index set of msg2 through the consumer configuration module as [5,8,9,16,21], and changes the array with index 98212 to [1000000 00000000 00000000
[0160] 00000000 00000000 00010000 10000001 10010000], wherein the first element from left to right indicates that the array has been used, the 5th element from right to left is used to record the consumption status of the consumer labeled 5, the 8th element from right to left is used to record the consumption status of the consumer labeled 8, ..., the 16th element from right to left is used to record the consumption status of the consumer labeled 16, and the 21st element from right to left is used to record the consumption status of the consumer labeled 21;
[0161] (13) After receiving msg2, the consumer with index 16 finds that the message confirmation mark is true, so it returns a response message to the message sender: [seq:98212,cur:16,isConfirm:true];
[0162] (14) After receiving the response message of step (13), it can be determined that the status record unit identifier is 98212, the consumer index is 16, and the array with index 98212 is obtained from the message status component: [1000000
[0163] 00000000 00000000 00000000 00010000 10000001 10010000], and create a new array according to the response message, that is, the second array, and assign the value [00000000 00000000
[0164] 00000000 00000000 00000000 00000000 10000000 00000000], the position of the array element with 1 in the second array (the 16th from the right) corresponds to the consumer's subscript, and the second array is used to perform an XOR operation with the array with subscript 98212. After the XOR operation, the array with subscript 98212 is changed to [100000000000000 00000000 00000000 00000000 00010000 00000001 10010000];
[0166] (15) After receiving msg2, the consumer with index 21 finds that the message confirmation mark is true, so it returns a response message to the message sender: [seq:98212,cur:21,isConfirm:true];
[0167] (16) After receiving the response message of step (15), it can be determined that the status record unit identifier is 98212, the consumer index is 21, and the array with index 98212 is obtained from the message status component: [1000000
[0168] 00000000 00000000 00000000 00000000 00010000 00000000 00000000 00010000 00000001 10010000], and create a new array according to the response message, that is, the second array, and assign the value [000000000 00000000
[0169] 00000000 00000000 00000000 00010000 000000000 00000000], the position of the array element with a value of 1 in the second array (the 21st position from the right to the left) corresponds to the consumer's subscript. The second array is used to perform an XOR operation with the array with a subscript of 98212. After the XOR operation, the array with a subscript of 98212 is changed to [100000000000000 00000000 00000000 00000000 00000000 00000001 10010000];
[0171] (17) Similarly, consumers with index 5, 8, and 9 return response messages one after another. Therefore, the array with index 98212 is changed to [1000000 00000000 00000000
[0172] 00000000 00000000 00000000 00000000 00000000], indicating that msg2 has been completely consumed by the consumer. At this time, the use flag of the array with subscript 98212 can be reset to unused, that is, the highest bit is set to 0. Finally, the array with subscript 98212 is [0000000 00000000 00000000 00000000
[0173] 00000000 00000000 00000000 00000000], which can be reused next time;
[0174] (18) The message monitoring component scans the message status component and finds that the status recording unit used to record the consumption status of msg2, that is, the array with subscript 98212, does not contain any array elements indicating unconsumed. Therefore, the message monitoring component believes that there is no message loss for msg2 and updates the historical reliability data to [0,0,0,0,0,0,0,0,1,0].
[0175] It should be noted that a third array can be created in the above step (2) to store the content of msg1, so that msg1 can be resent to the consumer with subscript 4 who has subscribed to msg1. Similarly, a third array can be created in step (11) to store the content of msg2 to support the resending of msg2.
[0176] The message monitoring method proposed in this application determines whether a message needs to be monitored through a message prediction component, thereby reducing storage requirements; the message consumption status is recorded through computer bit storage, which optimizes the storage architecture and improves retrieval efficiency; and the status recording unit can be reused, further reducing storage requirements; in addition, the historical record data cleaning process in the existing solution is eliminated, which greatly reduces disk IO reading and writing, thereby achieving more stable and reliable message monitoring.
[0177] Figure 5 and Figure 6 The schematic diagram of the structure of possible message monitoring devices provided by the embodiments of the present application. These message monitoring devices can be used to implement the functions of the server in the above method embodiments, and thus can also achieve the beneficial effects possessed by the above method embodiments.
[0178] like Figure 5 As shown, the message monitoring device 500 includes a transceiver unit 510 and a processing unit 520. The message monitoring device 500 is used to implement the above Figure 2 The functions of the server in the method embodiment are shown.
[0179] When the message monitoring device 500 is used to implement Figure 2 The functions of the server in the method embodiment shown are:
[0180] The transceiver unit 510 is used to obtain the message to be sent and N consumers who subscribe to the message to be sent; N is a positive integer;
[0181] The processing unit 520 is used to determine whether to monitor the message to be sent based on historical reliability data and a random function, wherein the historical reliability data is determined according to message loss conditions within a historical time interval;
[0182] If it is determined that the message to be sent needs to be monitored, the transceiver unit 510 is also used to send the message to be sent to the N consumers, and the processing unit 520 is also used to record the consumption status of the message to be sent by the N consumers; and update the historical reliability data according to the consumption status of the message to be sent by the N consumers.
[0183] In a possible design, the historical reliability data is determined based on message loss conditions in K consecutive historical time intervals, each of the K consecutive historical time intervals having a corresponding reliability tag; K is a positive integer;
[0184] Wherein, the message sent in the i-th historical time interval is not monitored; or, at least one message sent in the i-th historical time interval is monitored, and the at least one message is not lost, then the reliability mark corresponding to the i-th historical time interval is the first value;
[0185] At least one message sent in the i-th historical time interval is monitored, and at least one of the at least one messages is lost, then the reliability mark corresponding to the i-th historical time interval is a second value;
[0186] The i-th historical time interval is any one of the K historical time intervals; i is a positive integer and i is less than or equal to K.
[0187] In a possible design, the processing unit 520 is used to determine whether to monitor the message to be sent based on the historical reliability data and the random function: calculate the historical reliability data to obtain a first calculation result;
[0188] Determine a second calculation result according to the first calculation result and the random function;
[0189] If the second calculation result is greater than a preset value, it is necessary to monitor the message to be sent;
[0190] If the second calculation result is less than or equal to the preset value, there is no need to monitor the message to be sent.
[0191] In a possible design, the transceiver unit 510 is used to send the message to be sent to the N consumers:
[0192] Determine the state recording unit corresponding to the message to be sent; any state recording unit is used to record the consumption of the message to be sent, and any message to be sent has a corresponding state recording unit;
[0193] The message confirmation identifier, the identifier of the state recording unit and the content of the message to be sent are constructed into the message to be sent and sent to the N consumers; the message confirmation identifier is used to indicate that the consumer needs to feedback a response message to the message to be sent;
[0194] The processing unit 520 is used to record the consumption status of the N consumers for the message to be sent:
[0195] Setting the initial consumption state of each consumer in the state recording unit to non-consumption;
[0196] receiving a response message from any one of the N consumers; the response message including an identifier of the state recording unit and an identifier of the consumer;
[0197] According to the response message of any consumer, the consumption status corresponding to the consumer in the status recording unit is updated.
[0198] In a possible design, any state recording unit is an array, and at least one array element in the array stores the consumption situation of the corresponding consumer; the identifier of the state recording unit is the identifier of the array;
[0199] The identifier of the consumer is the position identifier of the element corresponding to the consumer in the array.
[0200] In a possible design, the state recording unit is an array of variable length, and its length is determined according to the number of consumers.
[0201] In a possible design, the processing unit 520 is used to determine the state recording unit corresponding to the message to be sent:
[0202] Using any state recording unit with a usage flag of unused as the state recording unit corresponding to the message to be sent and setting the usage flag of the state recording unit to used;
[0203] The processing unit 520 is used to record the consumption of the N consumers for the message to be sent, and is also used to set the usage flag of the status recording unit to unused after meeting the set conditions; the set conditions indicate that the monitoring of the message to be sent has been completed.
[0204] In a possible design, the state recording unit is a first array; the initial value of at least one array element in the first array is used to indicate that the consumer has not consumed the message to be sent;
[0205] The processing unit 520 is configured to update the consumption status corresponding to the consumer in the status recording unit according to a response message of any consumer:
[0206] Creating a second array, the length of the second array being the same as the length of the first array;
[0207] According to a response message of any consumer, setting the consumption status of the consumer in the second array;
[0208] An XOR operation is performed on the first array and the second array to update the consumption status corresponding to the consumer in the first array.
[0209] In a possible design, the processing unit 520 is further configured to:
[0210] Creating a third array, wherein the third array is used to store the content of the message to be sent;
[0211] Determine consumers in the first array whose consumption status is non-consumption after a preset time interval;
[0212] The message to be sent is resent to the unconsumed consumer according to the content of the message to be sent stored in the third array.
[0213] For more detailed description of the transceiver unit 510 and the processing unit 520, please refer to Figure 2 The relevant description in the method embodiment shown is directly obtained and will not be repeated here.
[0214] like Figure 6 As shown, the message monitoring device 600 includes a processor 610 and an interface circuit 620. The processor 610 and the interface circuit 620 are coupled to each other. It is understandable that the interface circuit 620 can be a transceiver or an input-output interface. Optionally, the message monitoring device 600 may also include a memory 630 for storing instructions executed by the processor 610 or storing input data required by the processor 610 to execute instructions or storing data generated after the processor 610 executes instructions.
[0215] When the message monitoring device 600 is used to implement Figure 2 When the method is shown, the processor 610 is used to implement the functions of the processing unit 520, and the interface circuit 620 is used to implement the functions of the transceiver unit 510.
[0216] The division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processor, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0217] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0218] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A message monitoring method, It is characterized in that The method includes: Get the message to be sent and N consumers who subscribe to the message to be sent; N is a positive integer; Determining whether to monitor the message to be sent based on historical reliability data and a random function, wherein the historical reliability data is determined based on message loss conditions within a historical time interval; If it is determined that the message to be sent needs to be monitored, the message to be sent is sent to the N consumers, and the consumption of the message to be sent by the N consumers is recorded; The historical reliability data is updated according to the consumption status of the N consumers for the message to be sent.
2. The method according to claim 1, It is characterized in that The historical reliability data is determined based on the message loss situation in K consecutive historical time intervals, each of the K consecutive historical time intervals has a corresponding reliability mark; K is a positive integer; Wherein, the message sent in the i-th historical time interval is not monitored; or, at least one message sent in the i-th historical time interval is monitored, and the at least one message is not lost, then the reliability mark corresponding to the i-th historical time interval is the first value; At least one message sent in the i-th historical time interval is monitored, and at least one of the at least one messages is lost, then the reliability mark corresponding to the i-th historical time interval is a second value; The i-th historical time interval is any one of the K historical time intervals; i is a positive integer and i is less than or equal to K.
3. The method according to claim 1, It is characterized in that The determining whether to monitor the message to be sent based on the historical reliability data and the random function includes: Calculating the historical reliability data to obtain a first calculation result; Determine a second calculation result according to the first calculation result and the random function; If the second calculation result is greater than a preset value, it is necessary to monitor the message to be sent; If the second calculation result is less than or equal to the preset value, there is no need to monitor the message to be sent.
4. The method according to claim 1, It is characterized in that The sending the to-be-sent message to the N consumers includes: Determine the state recording unit corresponding to the message to be sent; any state recording unit is used to record the consumption of the message to be sent, and any message to be sent has a corresponding state recording unit; The message confirmation identifier, the identifier of the state recording unit and the content of the message to be sent are constructed into the message to be sent and sent to the N consumers; the message confirmation identifier is used to indicate that the consumer needs to feedback a response message to the message to be sent; Recording the consumption of the N consumers for the message to be sent, including: Setting the initial consumption state of each consumer in the state recording unit to non-consumption; receiving a response message from any one of the N consumers; the response message including an identifier of the state recording unit and an identifier of the consumer; According to the response message of any consumer, the consumption status corresponding to the consumer in the status recording unit is updated.
5. The method according to claim 4, It is characterized in that Any of the state recording units is an array, and at least one array element in the array stores the consumption situation of the corresponding consumer; the identifier of the state recording unit is the identifier of the array; The identifier of the consumer is the position identifier of the element corresponding to the consumer in the array.
6. The method according to claim 5, It is characterized in that The state recording unit is an array of variable length, and its length is determined according to the number of consumers.
7. The method according to claim 4, It is characterized in that The determining of the state recording unit corresponding to the message to be sent includes: Using any state recording unit with a usage flag of unused as the state recording unit corresponding to the message to be sent and setting the usage flag of the state recording unit to used; After recording the consumption of the message to be sent by the N consumers, the method further includes: After a set condition is met, the use flag of the status recording unit is set to unused; the set condition indicates that the monitoring of the message to be sent has been completed.
8. The method according to claim 5, It is characterized in that The state recording unit is a first array; the initial value of at least one array element in the first array is used to indicate that the consumer has not consumed the message to be sent; According to the response message of any consumer, the consumption status corresponding to the consumer in the status recording unit is updated, including: Creating a second array, the length of the second array being the same as the length of the first array; According to a response message of any consumer, setting the consumption status of the consumer in the second array; An XOR operation is performed on the first array and the second array to update the consumption status corresponding to the consumer in the first array.
9. The method according to claim 8, It is characterized in that Also includes: Creating a third array, wherein the third array is used to store the content of the message to be sent; Determine consumers in the first array whose consumption status is non-consumption after a preset time interval; The message to be sent is resent to the unconsumed consumer according to the content of the message to be sent stored in the third array.
10. A message monitoring device, It is characterized in that The device comprises: a transceiver unit and a processing unit; The transceiver unit is used to obtain the message to be sent and N consumers who subscribe to the message to be sent; N is a positive integer; The processing unit is used to determine whether to monitor the message to be sent based on historical reliability data and a random function, wherein the historical reliability data is determined according to message loss conditions within a historical time interval; If it is determined that the message to be sent needs to be monitored, the transceiver unit is also used to send the message to be sent to the N consumers, and the processing unit is also used to record the consumption status of the message to be sent by the N consumers; and update the historical reliability data according to the consumption status of the message to be sent by the N consumers.
11. A message monitoring device, It is characterized in that include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.
13. A computer program product, It is characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 9 when being executed by a processor.
