Message retransmission method and device, computer equipment, medium and program product
By dynamically adjusting the retransmission interval based on message importance and network conditions, the problem of inflexible message retransmission modes in existing technologies is solved, thus improving the efficiency and adaptability of message processing systems.
Patent Information
- Application Number
- CN202511762792.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-24
AI Technical Summary
The existing message resending service cannot flexibly adjust the message resending mode according to the needs of different application scenarios, which can easily lead to performance bottlenecks under high concurrency and affect the overall efficiency of the message processing system.
By determining the importance of the message to be retransmitted, and combining the number of retransmissions, network request round-trip time, packet loss rate, and network congestion level, the retransmission interval is dynamically adjusted to prioritize message retransmission and avoid fixed-frequency retransmission.
It improves the processing efficiency of the message processing system, reduces the backlog of messages waiting to be resent under high concurrency, and enhances the system's flexibility and adaptability.
Smart Images

Figure CN121567282A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technology, and in particular to a message retransmission method, apparatus, computer equipment, medium, and program product. Background Technology
[0002] With the rapid development of internet technology and the widespread adoption of the Internet of Things (IoT), message retransmission services are playing an increasingly important role in modern information transmission. Message retransmission services not only need to process large amounts of data, but also need to be efficient, secure, and reliable to meet the needs of different application scenarios.
[0003] Existing retransmission services typically retransmit messages at a fixed frequency, failing to flexibly adjust the retransmission mode according to the needs of different application scenarios. Furthermore, many retransmission services are prone to performance bottlenecks under high concurrency, unable to adaptively retries based on network conditions and message importance, thus impacting the overall efficiency of the message processing system.
[0004] Therefore, how to resend messages to improve the processing efficiency of message processing systems is a problem that needs to be solved. Summary of the Invention
[0005] Therefore, it is necessary to provide a message retransmission method, apparatus, computer equipment, medium, and program product to address the aforementioned technical problems and improve the processing efficiency of message processing systems.
[0006] Firstly, this application provides a message retransmission method, which includes:
[0007] Confirmed to be resent;
[0008] The priority of the messages to be retransmitted is determined based on their importance.
[0009] The retransmission interval is determined based on the priority, the number of times the message to be retransmitted will be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level.
[0010] The message to be retransmitted will be retransmitted based on the retransmission interval.
[0011] In one embodiment, determining the retransmission interval based on the priority, the number of retransmissions of the message to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level includes:
[0012] The adjustment interval is determined based on the base interval time, the priority, the number of times the message to be retransmitted is to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level.
[0013] The retransmission interval is determined based on the base interval, the adjusted interval, and the maximum interval.
[0014] In one embodiment, the network request round-trip time includes the current network request round-trip time and the network request reference round-trip time; determining the adjustment interval based on the base interval time, the priority, the number of retransmissions of the message to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level includes:
[0015] The first adjustment factor is determined based on the number of times the message to be retransmitted is to be retransmitted;
[0016] The second adjustment factor is determined based on the current round-trip time of the network request, the reference round-trip time of the network request, and the packet loss rate.
[0017] A third adjustment factor is determined based on the priority and the network congestion level;
[0018] The base interval time is adjusted based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the adjusted interval time.
[0019] In one embodiment, adjusting the base interval time based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the adjusted interval time includes:
[0020] The base interval time is adjusted based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the initial adjustment interval time.
[0021] Based on the initial adjustment interval and preset jitter parameters, the jitter factor is determined;
[0022] The adjustment interval time is determined based on the jitter factor and the initial adjustment interval time.
[0023] In one embodiment, determining the current retransmission interval based on the base interval, the adjusted interval, and the maximum interval includes:
[0024] The first interval time is determined based on the adjustment interval time and the maximum interval time;
[0025] The retransmission interval is determined based on the base interval and the first interval.
[0026] In one embodiment, the method further includes:
[0027] The threshold number of retransmissions for the message to be retransmitted is determined based on the priority.
[0028] If the number of retransmissions of the message to be retransmitted is less than the retransmission threshold, then the message to be retransmitted will be retransmitted.
[0029] If the number of retransmissions of the message to be retransmitted reaches the retransmission threshold, then the priority determines whether the message to be retransmitted should be stored and the corresponding storage queue.
[0030] Secondly, this application also provides a message retransmission device, which includes:
[0031] The message determination module is used to determine messages that need to be resent.
[0032] A priority determination module is used to determine the priority of the message to be retransmitted based on its importance.
[0033] The interval time determination module is used to determine the retransmission interval time based on the number of retransmissions of the message to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level.
[0034] The message retransmission module is used to retransmit the message to be retransmitted based on the priority and the current retransmission interval.
[0035] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method in any of the above embodiments.
[0036] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the methods in any of the above embodiments.
[0037] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the methods in any of the above embodiments.
[0038] In the above implementation process, the retransmission interval is determined by priority, the number of retransmissions of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level. Messages to be retransmitted are then retransmitted according to their priority and the current retransmission interval. This eliminates the need for retransmissions at a fixed frequency, allowing the message retransmission process to adapt to the current network conditions, reducing the backlog of messages to be retransmitted under high concurrency, and effectively improving the processing efficiency of the message processing system. Furthermore, retransmitting messages based on their priority allows the retransmission mode to be adaptively adjusted according to different messages, increasing the flexibility of the message processing system and further improving its processing efficiency. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram illustrating the application environment of a message retransmission method provided in an embodiment of this application;
[0041] Figure 2 This is a flowchart of a message retransmission method provided in an embodiment of this application;
[0042] Figure 3 This is a schematic diagram of a message processing system structure provided in an embodiment of this application;
[0043] Figure 4 This is a schematic diagram of the structure of a message retransmission device provided in an embodiment of this application;
[0044] Figure 5 This is an internal structural diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0046] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0047] The message retransmission method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, Figure 1 This is a schematic diagram illustrating the application environment of a message retransmission method provided in an embodiment of this application. For example... Figure 1 As shown, terminal 102 can communicate with server 104 via a network. The data storage system can store the message data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0048] In one exemplary embodiment, Figure 2 This is a flowchart of a message retransmission method provided in an embodiment of this application, which is applied to... Figure 1 Taking server 104 as an example, the explanation is as follows: Figure 2 The message retransmission method shown may include the following steps:
[0049] Step 201: Determine the message to be resent.
[0050] Step 202: Determine the priority of messages to be resent based on their importance.
[0051] Step 203: Determine the retransmission interval based on priority, the number of times the message to be retransmitted will be retransmitted, the round-trip time of the network request, the packet loss rate, and the network congestion level.
[0052] Step 204: Resend the message to be resent based on the current resend interval.
[0053] For example, external messages can be transmitted from different terminals 102 to server 104 through various communication networks. These communication networks may include HTTP, Kafka, and TCP / UDP sockets, or other communication networks, but this application is not limited to these. Furthermore, the external message can be a publish, subscribe, broadcast, request, or response message. The format of the external message can be JSON, XML, or other formats, but this application is not limited to these.
[0054] Server 104 receives the external message and can perform security verification, format conversion, and encapsulation operations on it. For example, the server performs AK or SK verification on the received message to ensure its security and legitimacy. Furthermore, the server includes conversion and encapsulation strategies. The verified external message is then converted to the target format using the conversion strategy. For example, if the received data is JSON, it is converted to a form format, and the JSON keys are converted to the values required by the target platform, along with time format conversion. This conversion strategy can be pre-configured by the system or dynamically configured by the user; no restrictions are placed here. Furthermore, the server can also uniformly encapsulate the converted message according to the encapsulation strategy to adapt it to different target platforms. For example, this may include encryption, HTTP header filling, and uniform encapsulation of the message body with code, request ID, etc. The encapsulation strategy can also be dynamically customized by the user.
[0055] After processing the message, the server can forward it to the target platform. If multiple messages need to be forwarded to the same target platform, a shared DNS can be set for messages on the same target platform to improve forwarding speed and concurrency. If too many messages need to be forwarded during this process, causing forwarding failures, the failed messages need to be retransmitted. At this time, the server needs to determine the messages to be retransmitted.
[0056] Furthermore, the server determines the corresponding priority based on the importance of the messages to be retransmitted. Specifically, the server can classify the messages to be retransmitted into star ratings based on their importance and determine the priority according to the corresponding star ratings. For example, a message to be retransmitted that is 100% complete and has strict time-sequence requirements may correspond to 5 stars, with a priority of level 1; an important message to be retransmitted that has relatively lenient time-sequence requirements may correspond to 4 stars, with a priority of level 2; a message to be retransmitted that is less important may correspond to 3 stars, with a priority of level 3; an ordinary message to be retransmitted may correspond to 2 stars, with a priority of level 4; and an unimportant message to be retransmitted may correspond to 1 star, with a priority of level 5.
[0057] Furthermore, the retransmission interval for the current message to be retransmitted is determined based on priority, the current retransmission count of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level. Additionally, the priority weight of the corresponding message to be retransmitted can be determined based on priority; the higher the priority, the higher the priority weight. As an example, a base interval can be set in the server. An adjustment factor can be determined based on the priority weight, the current retransmission count of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level. The base interval is then adjusted according to the adjustment factor to obtain the adjusted interval, which is then determined as the current retransmission interval for the message to be retransmitted.
[0058] Furthermore, the message to be resent will be resent after the current resentment interval.
[0059] In the above implementation process, the retransmission interval is determined by priority, the number of retransmissions of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level. Messages to be retransmitted are then retransmitted according to their priority and the current retransmission interval. This eliminates the need for retransmissions at a fixed frequency, allowing the message retransmission process to adapt to the current network conditions, reducing the backlog of messages to be retransmitted under high concurrency, and effectively improving the processing efficiency of the message processing system. Furthermore, retransmitting messages based on their priority allows the retransmission mode to be adaptively adjusted according to different messages, increasing the flexibility of the message processing system and further improving its processing efficiency.
[0060] In one embodiment, determining the retransmission interval based on priority, the number of retransmissions of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level may include the following steps:
[0061] Step 1: Determine the adjustment interval based on the base interval time, priority, number of retransmissions of messages to be retransmitted, network request round-trip time, packet loss rate, and network congestion level.
[0062] Step 2: Determine the retransmission interval based on the base interval, the adjusted interval, and the maximum interval.
[0063] For example, the server determines the corresponding priority weight based on the priority of the message to be retransmitted; the higher the priority, the higher the corresponding priority weight. For instance, the weight is 1 for a message with priority level 1; 0.8 for a message with priority level 2; 0.7 for a message with priority level 3; 0.6 for a message with priority level 4; and 0.5 for a message with priority level 5. It should be noted that this application only uses this priority weight value as an example. In practical applications, the priority weight value can be adaptively set according to the actual situation, as long as the rule is that the higher the priority, the higher the corresponding priority weight; no restrictions are imposed here.
[0064] Furthermore, an adjustment factor is determined based on priority, the number of times the message to be resent is to be resent, the round-trip time of the network request, the packet loss rate, and the network congestion level. The base interval time is then adjusted based on the adjustment factor to obtain the adjusted interval time.
[0065] The server can also set a maximum interval, further determining the retransmission interval based on the base interval, adjustment interval, and maximum interval. As one example, the maximum value among the base interval, adjustment interval, and maximum interval can be used as the retransmission interval, minimizing the retransmission frequency and alleviating network load. As another example, the average value among the base interval, adjustment interval, and maximum interval can be used as the retransmission interval, effectively balancing the system's retransmission frequency and ensuring system stability. As yet another example, the minimum value among the base interval, adjustment interval, and maximum interval can be used as the retransmission interval, maximizing the retransmission frequency and improving retransmission efficiency.
[0066] In the above implementation process, the adjustment interval is determined based on priority, basic interval time, number of retransmissions of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level. This further facilitates the determination of the current retransmission interval based on the basic interval time, adjustment interval time, and maximum interval time, enabling the current retransmission interval time to be adaptively adjusted according to the adjustment interval time.
[0067] In one embodiment, the network request round-trip time includes the current network request round-trip time and the network request reference round-trip time; determining the adjustment interval based on priority, base interval, number of retransmissions of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level may include the following steps:
[0068] Step 1: Determine the first adjustment factor based on the number of times the message to be resent will be resent.
[0069] Step 2: Determine the second adjustment factor based on the current round-trip time of the network request, the reference round-trip time of the network request, and the packet loss rate.
[0070] Step 3: Determine the third adjustment factor based on priority and network congestion level.
[0071] Step 4: Adjust the base interval time based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the adjusted interval time.
[0072] For example, the first adjustment factor can be determined based on the current number of retransmissions of the message to be retransmitted. Specifically, the first adjustment factor can be determined using the following expression. :
[0073] =2 ∧ t (1)
[0074] in, Let t be the first adjustment factor, and t be the number of times the message to be resent can be resent. The first adjustment factor can optimize the number of resentments and reduce invalid resentments.
[0075] The network request round-trip time can include the current round-trip time and the reference round-trip time, and a second adjustment factor can be determined based on the current round-trip time, the reference round-trip time, and the packet loss rate. Specifically, the second adjustment factor can be determined using the following expression. :
[0076] = (T 当前 / T 参考 )*(1+γ) (2)
[0077] in, As the second adjustment factor, T 当前 For network requests of the current round-trip time, T 参考 T represents the reference round-trip time for network requests, γ represents the packet loss rate, and T represents the packet loss rate. 当前And γ can be determined by real-time monitoring of the system. The more severe the network congestion, the more the retry interval is increased and the number of retries is reduced. That is, the second adjustment factor can effectively avoid the network load caused by too many repeated attempts.
[0078] Furthermore, the corresponding priority weight can be determined based on the priority of the message to be resent. The third adjustment factor is further determined based on priority weights and network congestion levels. Specifically, the third adjustment factor can be determined using the following expression. :
[0079] = / ( +L) (3)
[0080] in, As the third adjustment factor, Here, L represents the priority weight of messages to be retransmitted, and L is the network congestion level, which can be determined based on the system's data transmission efficiency. The third adjustment factor effectively adjusts the interval based on the network congestion level and priority, ensuring that high-priority messages are processed first under high congestion conditions.
[0081] Furthermore, it can be based on the first adjustment factor Second adjustment factor and the third adjustment factor The base interval time is adjusted to obtain the adjustment interval time. Specifically, the adjustment interval time T can be determined by the following expression. 调整 :
[0082] T 调整 =T 基础 * * * (4)
[0083] Among them, T 调整 To adjust the interval time, T 基础 The base interval time.
[0084] In the above implementation process, the first adjustment factor, the second adjustment factor, and the third adjustment factor are determined by the number of retransmissions of the message to be retransmitted, the current round-trip time of the network request, the reference round-trip time of the network request, the packet loss rate, and the network congestion level, respectively. The base adjustment time is then adjusted by comprehensively using the determined adjustment factors to obtain the adjustment interval time. This allows the retransmission interval time to be adaptively adjusted according to the current operating status of the system, thereby minimizing the network load of high-concurrency message retransmission and improving the system performance.
[0085] In one embodiment, adjusting the base interval time based on a first adjustment factor, a second adjustment factor, and a third adjustment factor to obtain an adjusted interval time may include the following steps:
[0086] Step 1: Adjust the base interval time based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the initial adjustment interval time.
[0087] Step 2: Determine the jitter factor based on the initial adjustment interval and preset jitter parameters.
[0088] Step 3: Determine the adjustment interval based on the jitter factor and the initial adjustment interval.
[0089] For example, to avoid multiple retransmissions of messages simultaneously, the interval time can be adjusted using a jitter factor.
[0090] As another example, the initial adjustment interval T 初始调整 =T 基础 * * * Furthermore, the jitter factor is determined based on the initial adjustment interval and preset jitter parameters. Specifically, the jitter factor (jitter) can be determined using the following expression:
[0091] jitter = random value ∈ [-δ*T] 初始调整 ,δ*T 初始调整 (5)
[0092] Here, jitter is the jitter factor, and δ is the preset jitter parameter. As an example, δ=0.5, but it can also be other values. This value can be set adaptively according to the actual scenario, and there are no restrictions here.
[0093] Furthermore, the adjustment interval is determined based on the jitter factor and the initial adjustment interval. Specifically, the adjustment interval T can be determined using the following expression. 调整 :
[0094] T 调整 =T 基础 * * * + jitter (6)
[0095] In the above implementation process, by adding a jitter factor to the initial adjustment interval time obtained after adjusting the first adjustment factor, the second adjustment factor and the third adjustment factor, random jitter can be added to the retransmission interval, which effectively avoids multiple retransmission messages from being processed at the same time, further reduces the network load of the retransmission message processing process, and thus improves the processing efficiency of retransmission messages.
[0096] In one embodiment, determining the retransmission interval based on the base interval, the adjusted interval, and the maximum interval may include the following steps:
[0097] Step 1: Determine the first interval time based on the adjustment interval time and the maximum interval time.
[0098] Step 2: Determine the retransmission interval based on the base interval and the first interval.
[0099] For example, the first interval time can be determined based on the adjusted interval time and the maximum interval time. Specifically, the minimum value between the adjusted interval time and the maximum interval time can be determined as the first interval time. Further, the maximum value between the base interval time and the first interval time is determined as the current retransmission interval time. That is, the current retransmission interval time T can be determined using the following expression. 重发 :
[0100] T 重发 =Max(T) 基础 Min(T) 调整 T 最大 (7)
[0101] Among them, T 重发 T is the interval between retransmissions. 最大 Let T be the maximum interval time, and T 基础 With T 最大 It can be pre-defined; as an example, T 基础 =2 seconds, T 最大 =60 seconds, or other time values, both can be adjusted according to actual needs; no restrictions are imposed here. First interval time T 第一 = Min(T) 调整 T 最大 ).
[0102] In the above implementation process, by determining the minimum value between the adjustment interval time and the maximum interval time as the first interval time, the maximum interval time can be adaptively adjusted by adjusting the interval time. The maximum value between the base interval time and the first interval time is determined as the retransmission interval time for this time, thereby adaptively adjusting the message retransmission time by using the first interval time, thus realizing flexible adjustment of the message interval time.
[0103] In one embodiment, the method may further include the following steps:
[0104] Step 1: Determine the threshold number of times a message should be resent based on its priority.
[0105] Step 2: If the number of retransmissions of the message to be retransmitted is less than the retransmission threshold, then the message to be retransmitted is retransmitted; if the number of retransmissions of the message to be retransmitted reaches the retransmission threshold, then it is determined whether the message to be retransmitted should be stored based on priority.
[0106] For example, to avoid all messages being resent in a loop, the number of retransmissions can be limited by determining a threshold for the number of retransmissions.
[0107] Specifically, the retransmission threshold can be determined by the priority of the message to be retransmitted. As an example, the higher the priority of the message to be retransmitted, the higher the retransmission threshold, thus ensuring that important messages are sent successfully. For instance, a message with a priority of level 1 has a retransmission threshold of 5 times; a message with a priority of level 2 has a retransmission threshold of 4 times; a message with a priority of level 3 has a retransmission threshold of 3 times; a message with a priority of level 4 has a retransmission threshold of 2 times; and a message with a priority of level 2 has a retransmission threshold of 1 time.
[0108] As another example, a message with a priority of level 1 can be resent indefinitely until it is successfully sent; for other priority messages, the resentment threshold can be 4 times, and the resentment threshold decreases sequentially for other priorities.
[0109] Furthermore, if the number of retransmissions exceeds the threshold, the system can determine whether to store messages to be retransmitted based on their priority, and then retransmit them after a set time, thereby increasing storage space utilization. For example, messages with priorities of level 1, 2, and 3 that fail to be retransmitted after reaching the retransmission limit are added to the local storage queue, while messages with priorities of level 4 and 5 are discarded after reaching the retransmission limit. Moreover, messages with different priorities can be stored in different message queues. For example, messages with priority of level 1 can be stored in an in-memory message queue for fast access and processing; messages with priority of level 2 can be stored in local storage to ensure message balance and reliability; and messages with priority of level 3 can be stored in a database component that stores low-priority and large-volume messages, as well as user-specified specific messages, such as messages with specific time periods or content.
[0110] In the above implementation process, a retransmission threshold for messages to be retransmitted is determined by priority. This effectively avoids the cyclical retransmission of all messages, thus significantly reducing the system's retransmission pressure. Furthermore, the system determines whether to store messages that have reached the retransmission threshold based on priority, omitting low-priority messages and increasing storage space utilization.
[0111] Figure 3 This is a schematic diagram of a message processing system structure provided in an embodiment of this application, such as... Figure 3 As shown, the message processing system 30 includes: a message access module 301, a message processing module 302, a message forwarding module 303, a security verification module 304, a monitoring and logging module 305, a rule base 306, and a storage queue 307.
[0112] The message access module 301 accesses HTTP services, Kafka services, and other services. The security verification module 304 performs AK or SK verification on the accessed messages to ensure message security and legitimacy. After successful verification, the message access module 301 transmits the accessed messages to the message processing module 302. The message processing module 302 further performs format conversion and unified encapsulation on the received messages. Specifically, the message processing module 302 calls the conversion and encapsulation strategies in the rule base 306 to convert and encapsulate the messages.
[0113] Specifically, message transformation: Based on the transformation strategies in the rule base, the input data is transformed into the target format. The rule base includes default rules and also accepts dynamic configuration by the user. For example, received JSON data is transformed into a form format, and the JSON key values are converted to the values required by the target platform, and the time format is converted, etc. Message encapsulation: According to the encapsulation strategy of the rule base, the transformed data is uniformly encapsulated to adapt to the validation rules of different platforms, such as encryption, HTTP header filling, and uniform encapsulation of code, request ID, etc. in the message body. The encapsulation strategy can also be dynamically customized.
[0114] Furthermore, the message processing module 302 transforms and encapsulates the message before transmitting it to the message forwarding module 303. The message forwarding module 303 forwards the message, thereby outputting the messages corresponding to the HTTP service and the Kafka service. Messages that fail to forward are identified as messages to be retransmitted, and the steps in the message retransmission method of any of the above embodiments are executed. Additionally, when message transmission fails, the messages to be retransmitted can be transmitted to the storage queue 307 for storage.
[0115] Furthermore, the security verification module 304 can also be used to verify the security of users and message content, including identity authentication and encryption / decryption components. Identity authentication is performed through username and password verification, with the password encrypted using the MD5 or SHA algorithm. Message content security verification involves encrypting and decrypting the message content to ensure that subscription and publishing operations can only be performed after successful verification.
[0116] During the above process, the monitoring and logging module 305 can monitor the system's operating status and error logs in real time, facilitating troubleshooting and performance optimization. When anomalies occur in message processing efficiency, connection status, message reception status, message conversion status, or forwarding status, the system will automatically send alarm information to preset monitoring personnel. Simultaneously, it also supports the analysis and statistics of access logs and error logs, facilitating troubleshooting and performance optimization. The message forwarding service is essentially an information flow processing system. Through flow analysis, we can clearly trace the complete path of messages from input to output, identifying potential bottlenecks, redundancies, or inefficient links.
[0117] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0118] Based on the same inventive concept, this application also provides a message retransmission apparatus for implementing the message retransmission method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more message retransmission apparatus embodiments provided below can be found in the limitations of the message retransmission method described above, and will not be repeated here.
[0119] In one exemplary embodiment, Figure 4 This is a schematic diagram of the structure of a message retransmission device provided in an embodiment of this application, as shown below. Figure 4 The message retransmission device shown includes:
[0120] Message determination module 401 is used to determine messages to be retransmitted;
[0121] Priority determination module 402 is used to determine the priority of messages to be retransmitted based on their importance.
[0122] The interval time determination module 403 is used to determine the retransmission interval time based on priority, the number of retransmissions of the message to be retransmitted, network request round-trip time, packet loss rate and network congestion level.
[0123] The message retransmission module 404 is used to retransmit messages to be retransmitted based on the current retransmission interval.
[0124] In one embodiment, the interval determination module 403 is specifically used for:
[0125] The adjustment interval is determined based on the base interval time, priority, number of retransmissions of the message to be retransmitted, network request round-trip time, packet loss rate, and network congestion level.
[0126] The retransmission interval is determined based on the base interval, the adjusted interval, and the maximum interval.
[0127] In one embodiment, the network request round-trip time includes the current round-trip time of the network request and the reference round-trip time of the network request; the interval time determination module 403 is specifically used for:
[0128] The first adjustment factor is determined based on the number of times the message to be retransmitted is to be retransmitted;
[0129] The second adjustment factor is determined based on the current round-trip time of the network request, the reference round-trip time of the network request, and the packet loss rate.
[0130] The third adjustment factor is determined based on priority and network congestion level;
[0131] The base interval time is adjusted based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the adjusted interval time.
[0132] In one embodiment, the interval determination module 403 is specifically used for:
[0133] The base interval time is adjusted based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the initial adjustment interval time;
[0134] The jitter factor is determined based on the initial adjustment interval and preset jitter parameters;
[0135] The adjustment interval is determined based on the jitter factor and the initial adjustment interval.
[0136] In one embodiment, the interval determination module 403 is specifically used for:
[0137] The first interval time is determined based on the adjustment interval time and the maximum interval time;
[0138] The retransmission interval is determined based on the base interval and the first interval.
[0139] In one embodiment, the interval determination module 403 is further configured to:
[0140] The threshold for the number of times a message to be resent is determined based on priority.
[0141] If the number of retransmissions for a message to be retransmitted is less than the retransmission threshold, then the message to be retransmitted will be retransmitted.
[0142] If the number of retransmissions of a message to be retransmitted reaches the retransmission threshold, the priority will determine whether the message to be retransmitted should be stored and the corresponding storage queue.
[0143] Each module in the aforementioned message retransmission device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0144] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. Figure 5 This is an internal structural diagram of a computer device provided in an embodiment of this application. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The database stores message data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a message retransmission method.
[0145] Those skilled in the art will understand that Figure 5The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0146] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the message retransmission method in any of the above embodiments.
[0147] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the message retransmission method in any of the above embodiments.
[0148] 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, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0149] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0150] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0151] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A message retransmission method, characterized in that, The method includes: Confirmed to be resent; The priority of the messages to be retransmitted is determined based on their importance. The retransmission interval is determined based on the priority, the number of times the message to be retransmitted will be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level. The message to be retransmitted will be retransmitted based on the retransmission interval.
2. The method according to claim 1, characterized in that, The determination of the retransmission interval based on the priority, the number of retransmissions of the message to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level includes: The adjustment interval is determined based on the base interval time, the priority, the number of times the message to be retransmitted is to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level. The retransmission interval is determined based on the base interval, the adjusted interval, and the maximum interval.
3. The method according to claim 2, characterized in that, The network request round-trip time includes the current network request round-trip time and the network request reference round-trip time; the determination of the adjustment interval time based on the base interval time, the priority, the number of retransmissions of the message to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level includes: The first adjustment factor is determined based on the number of times the message to be retransmitted is to be retransmitted; The second adjustment factor is determined based on the current round-trip time of the network request, the reference round-trip time of the network request, and the packet loss rate. A third adjustment factor is determined based on the priority and the network congestion level; The base interval time is adjusted based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the adjusted interval time.
4. The method according to claim 3, characterized in that, The step of adjusting the base interval time based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the adjusted interval time includes: The base interval time is adjusted based on the first adjustment factor, the second adjustment factor, and the third adjustment factor to obtain the initial adjustment interval time. Based on the initial adjustment interval and preset jitter parameters, the jitter factor is determined; The adjustment interval time is determined based on the jitter factor and the initial adjustment interval time.
5. The method according to claim 2, characterized in that, Determining the current retransmission interval based on the base interval, the adjusted interval, and the maximum interval includes: The first interval time is determined based on the adjustment interval time and the maximum interval time; The retransmission interval is determined based on the base interval and the first interval.
6. The method according to claim 1, characterized in that, The method further includes: The threshold number of retransmissions for the message to be retransmitted is determined based on the priority. If the number of retransmissions of the message to be retransmitted is less than the retransmission threshold, then the message to be retransmitted will be retransmitted. If the number of retransmissions of the message to be retransmitted reaches the retransmission threshold, then the priority determines whether the message to be retransmitted should be stored and the corresponding storage queue.
7. A message retransmission device, characterized in that, The device includes: The message determination module is used to determine messages that need to be resent. A priority determination module is used to determine the priority of the message to be retransmitted based on its importance. The interval time determination module is used to determine the retransmission interval time based on the priority, the number of retransmissions of the message to be retransmitted, the network request round-trip time, the packet loss rate, and the network congestion level. The message retransmission module is used to retransmit the message to be retransmitted based on the current retransmission interval.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.