Message processing method and device, equipment, storage medium and computer program product
By adding the receiving layer and token bucket algorithm in the 5G message system, the problem of low 5G message processing efficiency caused by the flow control value limit of the MaaP platform is solved, and stable message processing and user experience in the 5G message system is achieved.
Patent Information
- Application Number
- CN202411024759.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-07-29
AI Technical Summary
During the traffic control of existing 5G message systems, due to the flow control value limitation of the MaaP platform, users' 5G message processing efficiency is low, which may lead to request failure and affect user experience.
Add a receiving layer between the business platform and the MaaP platform, cache 5G messages through message queues and use the token bucket algorithm to control the message processing speed, ensuring that message processing is carried out within the processing limit of the MaaP platform and avoiding direct upload to the MaaP platform.
It effectively avoids request failure due to the speed of 5G message upload exceeding the processing limit of MaaP platform, improves the 5G message transmission rate and processing efficiency on the user side, and ensures the normal user experience.
Smart Images

Figure CN119155636A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of wireless communication technology, and in particular to a message processing method, apparatus, device, storage medium and computer program product. Background Art
[0002] 5G messaging is a rich media messaging service that is upgraded from traditional SMS services based on 5G communication technology. 5G messaging supports a variety of media formats, including text, pictures, audio, and video. Compared with traditional SMS services, 5G messaging is more diverse, including point-to-point messaging, group messaging, and chatbots. Users can send and receive 5G messages from other users (or other servers) without downloading a client or adding friends. 5G messaging can provide enhanced messaging services between individuals and applications, realizing "message as a service". Users can enjoy a variety of 5G application services intuitively and conveniently in the message window.
[0003] At present, the basic framework of the existing 5G messaging system is as follows Figure 1 As shown in the figure, it consists of 5G Message Center (5G Message Center, 5GMC) and Message As A Platform (MaaP). Among them, 5GMC provides functions such as user terminal access control, registration authentication, configuration management, and message routing. The MaaP platform is built on 5GMC and provides Chatbot-related functions, including Chatbot management, authentication, and 5G message flow control.
[0004] However, there may be certain problems in some cases when directly controlling the flow of 5G messages through the MaaP platform. For example, when the rate of 5G messages sent by the customer exceeds the maximum flow control value of the MaaP platform (referred to as the flow control value), the MaaP platform will directly reject the request flow that exceeds the limit. This means that if the customer does not control the sending speed of 5G messages, the request may fail because the request flow sending rate exceeds the flow control value of the MaaP platform, affecting the normal use of the user.
[0005] However, if users want to ensure that 5G messages do not exceed the flow control value of the MaaP platform when sending 5G messages, they need to slow down the rate of sending 5G messages. If a large number of 5G messages are sent, it will take a long time, which will greatly affect the user experience.
[0006] It can be seen that how to ensure that the sending rate of 5G messages on the user side is not affected, while avoiding request failure due to the request traffic sending rate exceeding the flow control value of the MaaP platform, has become a problem that needs to be solved urgently. Summary of the invention
[0007] The embodiment of the present application provides a message processing method to solve the problem of low efficiency of user 5G message processing due to the limitation of the flow control value of the MaaP platform when the flow control of 5G messages is performed only through the MaaP platform under the existing 5G message system framework.
[0008] The embodiment of the present application also provides a message processing device to solve the problem of low efficiency of user 5G message processing due to the limitation of the flow control value of the MaaP platform when the flow control of 5G messages is performed only through the MaaP platform under the existing 5G message system framework.
[0009] The embodiment of the present application also provides a message processing device to solve the problem of low user 5G message processing efficiency due to the limitation of the flow control value of the MaaP platform when the flow control of 5G messages is performed only through the MaaP platform under the existing 5G message system framework.
[0010] The embodiment of the present application also provides a computer-readable storage medium to solve the problem of low user 5G message processing efficiency due to the limitation of the flow control value of the MaaP platform when the flow control of 5G messages is performed only through the MaaP platform under the existing 5G message system framework.
[0011] The embodiment of the present application also provides a computer program product to solve the problem of low efficiency of user 5G message processing due to the limitation of the flow control value of the MaaP platform when the flow control of 5G messages is performed only through the MaaP platform under the existing 5G message system framework.
[0012] The present application embodiment adopts the following technical solutions:
[0013] A message processing method, comprising: receiving a 5G message uploaded by a business platform, and caching the 5G message in a message queue; obtaining a pending 5G message from the message queue, and determining the delivery quantity corresponding to the pending 5G message; determining whether the pending 5G message meets the flow control requirements according to the delivery quantity; when the judgment result is no, determining the waiting time corresponding to the pending 5G message according to the delivery quantity, and suspending the processing of the pending 5G message according to the waiting time; when the judgment result is yes, sending the pending 5G message to a message as a platform (MaaP) platform, and determining the number of remaining tokens in a token bucket according to the delivery quantity.
[0014] A message processing device includes: a 5G message caching unit, used to receive 5G messages uploaded by a business platform and cache the 5G messages in a message queue; a 5G message management unit, used to obtain pending 5G messages from the message queue and determine the delivery quantity corresponding to the pending 5G messages; a traffic control unit, used to determine whether the pending 5G messages meet traffic control requirements based on the delivery quantity; a 5G message processing unit, used to determine the waiting time corresponding to the pending 5G messages based on the delivery quantity when the judgment result obtained by the traffic control unit is no, and suspend the processing of the pending 5G messages based on the waiting time; the 5G message processing unit, used to send the pending 5G messages to a message as a platform (MaaP) platform when the judgment result obtained by the traffic control unit is yes, and determine the number of remaining tokens in a token bucket based on the delivery quantity.
[0015] A message processing device comprises: a processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor performs the following operations: receiving a 5G message uploaded by a service platform, and caching the 5G message in a message queue; obtaining a pending 5G message from the message queue, and determining the delivery quantity corresponding to the pending 5G message; determining whether the pending 5G message meets the flow control requirement according to the delivery quantity; when the judgment result is no, determining the waiting time corresponding to the pending 5G message according to the delivery quantity, and suspending the processing of the pending 5G message according to the waiting time; when the judgment result is yes, sending the pending 5G message to a message as a platform (MaaP) platform, and determining the number of remaining tokens in a token bucket according to the delivery quantity.
[0016] A computer-readable storage medium stores one or more programs, which, when executed by an electronic device including multiple applications, enable the electronic device to perform the following operations: receive a 5G message uploaded by a service platform, and cache the 5G message in a message queue; obtain a pending 5G message from the message queue, and determine the delivery quantity corresponding to the pending 5G message; determine whether the pending 5G message meets the flow control requirements based on the delivery quantity; when the judgment result is no, determine the waiting time corresponding to the pending 5G message based on the delivery quantity, and suspend the processing of the pending 5G message based on the waiting time; when the judgment result is yes, send the pending 5G message to a message as a platform (MaaP) platform, and determine the number of remaining tokens in a token bucket based on the delivery quantity.
[0017] A computer program product includes a computer program, which, when executed by a processor, implements: receiving a 5G message uploaded by a business platform, and caching the 5G message in a message queue; obtaining a pending 5G message from the message queue, and determining the delivery quantity corresponding to the pending 5G message; determining whether the pending 5G message meets the flow control requirement based on the delivery quantity; when the judgment result is no, determining the waiting time corresponding to the pending 5G message based on the delivery quantity, and suspending the processing of the pending 5G message based on the waiting time; when the judgment result is yes, sending the pending 5G message to a message-as-a-platform (MaaP) platform, and determining the number of remaining tokens in a token bucket based on the delivery quantity.
[0018] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0019] Using the message processing method provided in the embodiment of the present application, for the 5G messages uploaded by the business platform, the received 5G messages can be first cached in the message queue, and then the pending 5G messages can be obtained from the message queue, and the delivery quantity corresponding to the pending 5G messages can be determined, and according to the delivery quantity corresponding to the pending 5G messages, it is determined whether the pending 5G messages meet the flow control requirements; when the judgment result is no, the waiting time corresponding to the pending 5G messages is determined according to the delivery quantity, and according to the waiting time, the processing of the pending 5G messages is suspended; when the judgment result is yes, the pending 5G messages are sent to the 5G message center for processing, and the number of remaining tokens in the token bucket is determined according to the delivery quantity. By adopting the method provided in the embodiment of the present application, by adding a receiving layer between the business platform and the MaaP platform, the massive 5G messages generated by the business platform are avoided from being directly uploaded to the MaaP platform. On the one hand, since the 5G messages uploaded by the business platform are not directly uploaded to the MaaP platform for processing, but are temporarily cached in the message queue, the business platform does not need to consider the processing rate of the MaaP platform when sending 5G messages, thereby ensuring that the business platform can send 5G messages at a normal speed; on the other hand, when the receiving platform pulls the pending 5G messages from the message queue for processing, it sends the pending 5G messages with sufficient tokens to the MaaP platform for processing by requesting tokens through a token bucket. Since the token update rate of the token bucket is determined according to the processing rate of the MaaP platform, the receiving platform can upload the pending 5G messages to the MaaP platform according to the processing speed of the 5G message center, thereby avoiding the problem that the 5G message upload speed exceeds the processing limit of the MaaP platform, thereby causing the 5G message processing request to fail, affecting the normal use of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0021] Figure 1 A specific structural diagram of a 5G message processing system provided by the prior art;
[0022] Figure 2 A specific structural diagram of a 5G message processing system provided in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of a specific process of a message processing method provided in an embodiment of the present application;
[0024] Figure 4 A specific flow chart of determining whether a message meets the flow control requirements by using a token bucket algorithm provided in an embodiment of the present application;
[0025] Figure 5 A schematic diagram of a specific process of a message processing method provided in an embodiment of the present application;
[0026] Figure 6 A schematic diagram of the specific structure of a message processing device provided in an embodiment of the present application;
[0027] Figure 7 A schematic diagram of the specific structure of a message processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of 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.
[0029] In order to solve the problem of low user 5G message processing efficiency due to the limitation of the flow control value of the MaaP platform when the flow control of 5G messages is performed only through the MaaP platform under the existing 5G message system framework, an embodiment of the present application provides a message processing method. The technical solutions provided by the embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0030] like Figure 2 As shown, it is a schematic diagram of the basic architecture of the message processing system provided in the embodiment of the present application. Figure 2As shown, in order to achieve the ability to ensure that the sending rate of 5G messages on the user side is not affected and to avoid request failures due to the request traffic sending rate exceeding the flow control value of the MaaP platform, the embodiment of the present application designs a new 5G message processing system framework by adding an access layer between the business platform (for example, the certified service partner platform (Certified Service Partner, CSP)) and the MaaP platform. The 5G message processing system consists of a business platform, an access layer, a MaaP platform and a 5GMC.
[0031] Among them, 5GMC has the functions of access control, registration authentication, message routing addressing, terminal configuration management, etc. for 5G message users. It is mainly composed of group chat function module, IP Multimedia Subsystem (IMS) access function module, multimedia content storage function module and configuration server.
[0032] The MaaP platform is carried on the 5G message center, providing a unified interface for the business platform, responsible for access management, authentication, multimedia content upload and storage in industry messages, and other functions for industry customers and messages. The MaaP platform consists of two parts: basic functions and operation management. Operation management is used by operators to open and configure permissions for industry customer Chatbots.
[0033] Business platform. In the embodiment of the present application, the business platform generally refers to the Certified Service Partner (CSP) platform. The CSP platform is a 5G message operation platform jointly built by operators and various ecological enterprises. It is an operation tool platform for providing Chatbot services. It is composed of access modules, session adapters, intent recognition engines, business process configuration and other modules, and becomes the center of 5G message sending, operation and management.
[0034] The access layer consists of a 5G message receiving module, a Kafka cluster, and a queue service cluster. The 5G message receiving module is connected to the CSP platform to receive massive 5G messages uploaded by the CSP platform and cache the received 5G messages to the Kafka cluster. The queue service cluster is used to control the flow of 5G messages in the Kafka cluster message queue, so as to deliver 5G messages to the MaaP platform at a speed not exceeding the MaaP flow control value. In addition, 5G messages that cannot be delivered in time will not be rejected and returned to the business platform, but will be temporarily stored in the message queue for slow delivery.
[0035] For the convenience of description, the message processing method provided in the embodiment of the present application is introduced below by taking the execution subject of the method as the access layer in the 5G message processing system as an example.
[0036] Specifically, the implementation flow diagram of the message processing method provided in this application is as follows: Figure 3 As shown, it mainly includes the following steps:
[0037] Step 11, receiving a 5G message uploaded by the service platform, and caching the 5G message in a message queue;
[0038] The access layer receives 5G messages sent by enterprise customers through the CSP platform through the 5G message receiving module. It should be noted here that the CSP platform serves enterprise customers (B-end users). Enterprise customers generally promote services based on 5G messages through the CSP platform. Therefore, the 5G messages sent by the CSP platform to the access layer are generally 5G group messages. For example, if an enterprise customer needs to promote a certain service by sending group 5G messages, the enterprise customer can generate 5G messages to be promoted through the Chatbot on the CSP platform, and set the number of group messages, such as 1,000, and upload the generated 5G messages to be promoted and the number of group messages to the access layer through the CSP platform.
[0039] In order to ensure data security, in an embodiment of the present application, after receiving the 5G message uploaded by the CSP platform, the access layer can perform a simple security check on the 5G message, such as performing authority check, service check, and format check on the received 5G message, to ensure that the received 5G messages are all from authenticated and legitimate corporate customers.
[0040] After the verification is passed, the 5G message receiving module can cache the received 5G message in the message queue (Messagequeue, MQ). It should be noted here that the access layer can use ActiveMQ, RabbitMQ, RocketMQ and Kafka as the middleware of the message queue. In the embodiment of the present application, the implementation method of the method is introduced by taking the Kafka message queue as an example. It can be understood that the access layer caches the 5G message in the Kafka message queue is only an exemplary description and should not be understood as a limitation of the method.
[0041] Step 12, obtaining the pending 5G message from the message queue, and determining the delivery quantity corresponding to the pending 5G message;
[0042] The access layer pulls a batch of pending 5G messages from the Kafka message queue to form a token request queue through the queue service nodes in the queue service cluster, and determines the delivery quantity corresponding to each pending 5G message in the token request queue in turn. In an embodiment of the present application, the delivery quantity corresponding to the pending 5G message refers to the number of group messages corresponding to the 5G message. For example, an enterprise customer sets the number of group messages of a 5G message to 1,000 through the CSP platform, then the delivery quantity corresponding to the 5G message is 1,000.
[0043] Step 13, determining whether the 5G messages to be processed meet the flow control requirements according to the delivery quantity corresponding to each 5G message to be processed determined by executing step 12;
[0044] When the judgment result is no, step 14 is executed, and when the judgment result is yes, step 16 is executed.
[0045] In an embodiment of the present application, the queue service node can apply for tokens from the token bucket based on the token bucket algorithm according to the delivery quantity corresponding to each pending 5G message in the token request queue, and determine whether the pending 5G message can apply for a sufficient number of tokens by comparing the data of the current tokens in the token bucket with the delivery quantity corresponding to the pending 5G message, and then determine whether the pending 5G message meets the flow control requirements.
[0046] In one embodiment, when a queue service node applies for a token from a token bucket, it then uses the token bucket algorithm as follows: Figure 4 The sub-steps shown determine whether the pending 5G message meets the flow control requirements, including:
[0047] Sub-step 1301, after starting to apply for tokens, according to the token bucket algorithm, the queue service node can use the requested token bucket key (tokens_key) and the number of tokens applied for (reques), as well as the token refresh rate (rate) and token bucket capacity (capacity) corresponding to the token bucket as input parameters;
[0048] The token bucket key (tokens_key) represents the unique identifier of the token bucket, and the token refresh rate (rate) and the token bucket capacity (capacity) corresponding to the token bucket can be determined according to the token bucket key (tokens_key).
[0049] Sub-step 1302, the token bucket reads the current remaining number of tokens (remain_token) and the current time (now);
[0050] Sub-step 1303, determining whether remain_token is read, if the determination result is yes, executing sub-step 1305; if the determination result is no, executing sub-step 1304;
[0051] Sub-step 1304, when the remain_token is not read, it means that the token bucket has not been applied for a token at this time, that is, the current remaining number of tokens in the token bucket (remain_token) is equal to the token bucket capacity (capacity), that is, remain_token = capacity, and continue to execute sub-step 1305;
[0052] Sub-step 1305, read the time when the token was last refreshed (last_refreshed);
[0053] Sub-step 1306, determining whether last_refreshed is read, if the determination result is yes, executing sub-step 1308; if the determination result is no, executing sub-step 1307;
[0054] Sub-step 1307, when last_refreshed is not read, it means that the token bucket has not refreshed the token at this time, that is, last_refreshed = 0, and continue to execute sub-step 1308;
[0055] Sub-step 1308, according to last_refreshed, determine the number of tokens that can be applied for refresh in the token bucket;
[0056] Specifically, the number of tokens that can be applied for can be calculated according to the following formula [1]:
[0057] filled_token=math.min(capacity,remain_token+(now-last_refreshed)*rate)[1]
[0058] Sub-step 1309, update the token refresh time, last_refreshed = now;
[0059] Sub-step 1310, determining whether the number of tokens filled_token applied for by executing sub-step 1308 is greater than the number of tokens applied for (reques), and when the determination result is yes, executing sub-step 1311;
[0060] When the judgment result is no, execute sub-step 1312;
[0061] Sub-step 1311, determining that the 5G message to be processed meets the flow control requirement, and executing sub-step 1313;
[0062] Sub-step 1312, determining that the 5G message to be processed does not meet the flow control requirement;
[0063] Sub-step 1313, updating the current remaining number of tokens in the token bucket (remain_token);
[0064] Specifically, the number of tokens currently remaining in the token bucket can be updated according to the following formula [2]:
[0065] remain_token=filled_token-request[2]
[0066] Sub-step 1314, saving the updated remain_token and last_refreshed;
[0067] Sub-step 1315, output the flow control result and remain_token.
[0068] In one embodiment, the queue service node can determine whether the pending 5G message meets the flow control requirements by the following method: determine the number of first tokens in the token bucket; determine whether the number of first tokens is greater than the delivery number; when the judgment result is yes, determine that the pending 5G message meets the flow control requirements; when the judgment result is no, determine that the pending 5G message does not meet the flow control requirements.
[0069] It should be noted here that in an embodiment of the present application, when performing flow control, the number of tokens that a 5G message to be processed needs to obtain is equal to the number of delivery. That is, assuming that the number of delivery corresponding to a 5G message to be processed is 100, when a token is applied for from the token bucket through the token bucket algorithm and 100 tokens are obtained, the 5G message can be considered to meet the flow control requirements.
[0070] Step 14: when the judgment result obtained by executing step 13 is no, determine the waiting time corresponding to the 5G message to be processed according to the delivery quantity, and suspend the processing of the 5G message to be processed according to the waiting time;
[0071] When it is determined by executing step 13 that the 5G message does not meet the flow control requirements, it means that the processing pressure of the MaaP platform has reached saturation and cannot continue to receive 5G messages for processing. At this time, the queue service node can suspend sending 5G messages to the MaaP platform.
[0072] At the same time, the queue service node can determine the pause waiting time for the 5G message based on the token update rate of the token bucket. In one embodiment, the queue service node can determine the waiting time according to the following method: determine the 5G message processing speed corresponding to the 5G message center; determine the token refresh rate of the token bucket based on the 5G message processing speed; determine the waiting time corresponding to the 5G message to be processed based on the delivery quantity, the first token quantity and the token refresh rate.
[0073] Specifically, the queue service node can determine the token quantity difference based on the delivery quantity corresponding to the 5G message to be processed and the current number of tokens in the token bucket, and then determine the waiting time according to the token refresh rate of the token bucket and the token quantity difference according to the following formula [3]:
[0074] wait_time=(need-remain_token)rate[3]
[0075] Among them, need represents the delivery quantity corresponding to the 5G messages to be processed, remain_token represents the number of tokens currently in the token bucket, and rate represents the token refresh rate of the token bucket. It should be noted here that since the token bucket is needed to realize the control of the speed of sending 5G messages from the access layer to the MaaP platform to ensure that the speed of sending 5G messages from the access layer to the MaaP platform is lower than the processing speed of the MaaP platform, in the embodiment of the present application, the token refresh rate of the token bucket is determined by the processing rate of the MaaP platform, that is, the token refresh rate ≤ the processing rate of the MaaP platform. For example, the 5G message processing rate of the MaaP platform is: 100,000 / s, then the token refresh rate of the token bucket can be set to ≤100,000 / s.
[0076] After determining the waiting time through the above method, the queue service node can call the Thread.sleep() method to suspend the processing of the pending 5G message.
[0077] In addition, it should be noted here that in order to avoid the problem of thread pseudo-death caused by too long waiting time for a 5G message to be processed due to too many failed token requests for the message, in one embodiment, the queue service node can set a processing time threshold, and after determining that the processing time of a suspended 5G message has exceeded the processing time threshold, it ends the processing of the 5G message and rolls back the unique identifier of the 5G message in the Kafka message queue.
[0078] In an embodiment of the present application, after the queue service node suspends processing of a certain 5G message, the queue service node can monitor the total processing time of the 5G message according to the following method, and determine whether the 5G message needs to be rolled back based on the monitoring result, the method including: determining the processing start time of the 5G message to be processed; determining the first processing time corresponding to the 5G message to be processed based on the current time and the processing start time; determining the second processing time corresponding to the 5G message to be processed based on the waiting time and the first processing time; determining whether the second processing time is greater than a preset processing time threshold; when the judgment result is yes, rolling back the unique identifier of the 5G message to be processed in the message queue, and ending the processing of the 5G message to be processed.
[0079] Specifically, when the processing time of a 5G message has exceeded the processing time threshold, the queue service node can end the processing of the 5G message, delete the 5G message from the token request queue, and roll the unique identifier of the 5G message back to the Kafka message queue, so that when the queue service node completes the processing of each 5G message in the current token request queue, it can start from this 5G message and pull 5G messages from the Kafka message queue again to form a new token request queue for processing.
[0080] Step 15, determining a restart time for the 5G message, and restarting the processing of the pending 5G message according to the restart time, to determine whether the pending 5G message meets the flow control requirements;
[0081] In an embodiment of the present application, when the pause time for a certain 5G message has reached the waiting time, the queue service node can restart the processing of the 5G message and continue to execute step 13.
[0082] In one embodiment, the queue service node can determine whether to restart the processing of the suspended 5G message according to the following method, including: suspending the processing of the 5G message to be processed and determining the pause time; determining the restart time according to the pause time and the waiting time; restarting the processing of the 5G message to be processed according to the restart time, and determining whether the 5G message to be processed meets the flow control requirements.
[0083] Step 16, when the judgment result obtained by executing step 13 is yes, the 5G message to be processed is sent to the MaaP platform, and the number of remaining tokens in the token bucket is determined based on the delivery quantity.
[0084] Among them, the 5G message to be processed can be sent to the MaaP platform to send the 5G message to the 5GMC through the MaaP platform. At the same time, the queue service node can determine the number of remaining tokens in the current token bucket according to the delivery number corresponding to the sent 5G message.
[0085] In one embodiment, the message processing solution is mainly implemented by the queue service cluster in the access layer. After obtaining the pending 5G messages in the Kafka message queue, the queue service cluster can control its own message processing speed according to the message processing rate of the MaaP platform, thereby avoiding the problem that the 5G message upload speed exceeds the processing limit of the MaaP platform, which in turn causes the 5G message processing request to fail and affects the normal use of users.
[0086] The following uses a queue service node in a queue service cluster as an example. Figure 5 The process shown in the figure illustrates the specific processing process of the queue service cluster in the embodiment of the present application, which mainly includes the following steps:
[0087] Step 201, the queue service node calls the poll method to obtain a batch of pending 5G messages to be processed from the Kafka message queue;
[0088] Assume that the number of 5G messages to be processed is L.
[0089] Step 202, taking the current time as the processing start time start_time, i represents the number of pending 5G messages currently being processed, and at the start time start_time, i=0;
[0090] Step 203, processing the i-th message, and determining the number of tokens needed to be applied for the i-th 5G message;
[0091] Step 204, calling the token bucket algorithm, and obtaining the return result value pass and the remaining token number remain_token according to the number of tokens need required for the i-th 5G message;
[0092] Step 205: when the return result value pass is true, it is determined that the i-th 5G message meets the flow control requirement, and then step 206 is executed; when the return result value pass is false, it is determined that the i-th 5G message does not meet the flow control requirement, and then step 208 is executed;
[0093] Step 206: Upload the i-th 5G message to the MaaP platform and call the commitSync method to commit the Offset of the message;
[0094] Step 207, judging whether i+1 is less than L. If the judgment result is no, it means that the obtained L pending 5G messages have been processed completely, then executing step 201, reacquiring a batch of pending 5G messages. If the judgment result is yes, it means that the obtained L pending 5G messages have not been processed completely, then executing step 203, processing the i+1th message;
[0095] Step 208, determine the waiting time corresponding to the 5G message wait_time = (need-remain_token) / rate;
[0096] Step 209, obtain the current time now, and determine the total time total_time=now-start_time that the 5G message has been processed;
[0097] Step 210, determining whether total_time+wait_time is greater than a pre-configured processing time threshold, if the determination result is no, executing step 211, if the determination result is yes, otherwise executing step 212;
[0098] Step 211, calling the Thread.sleep method to make the Kafka consumer thread suspend processing the 5G message for a duration of wait_time, and executing step 204 after the suspension;
[0099] Step 212, call the seek method to roll back the unique identifier of the 5G message to the Kafka message queue, so that when the queue service node completes the processing of each 5G message in the current token request queue, when the poll method is called again, it can start from the 5G message and pull 5G messages from the Kafka message queue again to form a new token request queue.
[0100] Using the message processing method provided in the embodiment of the present application, for the 5G messages uploaded by the business platform, the received 5G messages can be first cached in the message queue, and then the pending 5G messages can be obtained from the message queue, and the delivery quantity corresponding to the pending 5G messages can be determined, and according to the delivery quantity corresponding to the pending 5G messages, it is determined whether the pending 5G messages meet the flow control requirements; when the judgment result is no, the waiting time corresponding to the pending 5G messages is determined according to the delivery quantity, and according to the waiting time, the processing of the pending 5G messages is suspended; when the judgment result is yes, the pending 5G messages are sent to the 5G message center for processing, and the number of remaining tokens in the token bucket is determined according to the delivery quantity. By adopting the method provided in the embodiment of the present application, by adding a receiving layer between the business platform and the MaaP platform, the massive 5G messages generated by the business platform are avoided from being directly uploaded to the MaaP platform. On the one hand, since the 5G messages uploaded by the business platform are not directly uploaded to the MaaP platform for processing, but are temporarily cached in the message queue, the business platform does not need to consider the processing rate of the MaaP platform when sending 5G messages, thereby ensuring that the business platform can send 5G messages at a normal speed; on the other hand, when the receiving platform pulls the pending 5G messages from the message queue for processing, it sends the pending 5G messages with sufficient tokens to the MaaP platform for processing by requesting tokens through a token bucket. Since the token update rate of the token bucket is determined according to the processing rate of the MaaP platform, the receiving platform can upload the pending 5G messages to the MaaP platform according to the processing speed of the 5G message center, thereby avoiding the problem that the 5G message upload speed exceeds the processing limit of the MaaP platform, thereby causing the 5G message processing request to fail, affecting the normal use of users.
[0101] In one implementation, the present application also provides a message processing device to solve the problem of low efficiency of user 5G message processing due to the limitation of the flow control value of the MaaP platform when the flow control of 5G messages is performed only through the MaaP platform under the existing 5G message system framework. The specific structural diagram of the message processing device is as follows Figure 6 As shown, it includes: a 5G message cache unit 61, a 5G message management unit 62, a traffic control unit 63 and a 5G message processing unit 64.
[0102] The 5G message cache unit 61 is used to receive the 5G message uploaded by the service platform and cache the 5G message in the message queue;
[0103] The 5G message management unit 62 is used to obtain the pending 5G message from the message queue and determine the delivery quantity corresponding to the pending 5G message;
[0104] A flow control unit 63, configured to determine whether the to-be-processed 5G message meets the flow control requirement according to the delivery quantity;
[0105] The 5G message processing unit 64 is configured to determine the waiting time corresponding to the 5G message to be processed according to the delivery quantity when the judgment result obtained by the traffic control unit 63 is no, and suspend the processing of the 5G message to be processed according to the waiting time;
[0106] The 5G message processing unit 64 is used to send the pending 5G message to the message platform MaaP platform when the judgment result obtained by the traffic control unit 63 is yes, process the pending 5G message through the MaaP platform, and determine the remaining number of tokens in the token bucket according to the delivery number.
[0107] In one embodiment, the traffic control unit 63 is specifically used to: determine the first token number in the token bucket; determine whether the first token number is greater than the delivery number; when the judgment result is yes, determine that the pending 5G message meets the traffic control requirements; when the judgment result is no, determine that the pending 5G message does not meet the traffic control requirements.
[0108] In one embodiment, the 5G message processing unit 64 is specifically used to: determine the 5G message processing speed corresponding to the 5G message center; determine the token refresh rate of the token bucket according to the 5G message processing speed; determine the waiting time corresponding to the 5G message to be processed according to the delivery quantity, the first token quantity and the token refresh rate.
[0109] In one embodiment, the 5G message processing unit 64 is specifically used to: suspend the processing of the pending 5G message and determine the suspension time; determine the restart time according to the suspension time and the waiting time; restart the processing of the pending 5G message according to the restart time, and determine whether the pending 5G message meets the flow control requirements.
[0110] In one embodiment, the 5G message processing unit 64 is specifically used to: determine the processing start time of the pending 5G message; determine the first processing time corresponding to the pending 5G message according to the current time and the processing start time; determine the second processing time corresponding to the pending 5G message according to the waiting time and the first processing time; determine whether the second processing time is greater than a preset processing time threshold; when the judgment result is yes, roll back the unique identifier of the pending 5G message in the message queue, and end the processing of the pending 5G message.
[0111] By using the message processing device provided in the embodiment of the present application, for the 5G messages uploaded by the business platform, the received 5G messages can be first cached in the message queue, and then the pending 5G messages can be obtained from the message queue, and the delivery quantity corresponding to the pending 5G messages can be determined, and according to the delivery quantity corresponding to the pending 5G messages, it is determined whether the pending 5G messages meet the flow control requirements; when the judgment result is no, the waiting time corresponding to the pending 5G messages is determined according to the delivery quantity, and according to the waiting time, the processing of the pending 5G messages is suspended; when the judgment result is yes, the pending 5G messages are sent to the 5G message center for processing, and the number of remaining tokens in the token bucket is determined according to the delivery quantity. By adopting the method provided in the embodiment of the present application, by adding a receiving layer between the business platform and the MaaP platform, the massive 5G messages generated by the business platform are avoided from being directly uploaded to the MaaP platform. On the one hand, since the 5G messages uploaded by the business platform are not directly uploaded to the MaaP platform for processing, but are temporarily cached in the message queue, the business platform does not need to consider the processing rate of the MaaP platform when sending 5G messages, thereby ensuring that the business platform can send 5G messages at a normal speed; on the other hand, when the receiving platform pulls the pending 5G messages from the message queue for processing, it sends the pending 5G messages with sufficient tokens to the MaaP platform for processing by requesting tokens through a token bucket. Since the token update rate of the token bucket is determined according to the processing rate of the MaaP platform, the receiving platform can upload the pending 5G messages to the MaaP platform according to the processing speed of the 5G message center, thereby avoiding the problem that the 5G message upload speed exceeds the processing limit of the MaaP platform, thereby causing the 5G message processing request to fail, affecting the normal use of users.
[0112] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 7 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0113] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0114] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0115] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a message processing device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations: receive the 5G message uploaded by the business platform, cache the 5G message in the message queue; obtain the pending 5G message from the message queue, and determine the delivery quantity corresponding to the pending 5G message; determine whether the pending 5G message meets the flow control requirements according to the delivery quantity; when the judgment result is no, determine the waiting time corresponding to the pending 5G message according to the delivery quantity, and suspend the processing of the pending 5G message according to the waiting time; when the judgment result is yes, send the pending 5G message to the message as a platform MaaP platform, and determine the number of remaining tokens in the token bucket according to the delivery quantity.
[0116] The above application Figure 7The method performed by the message processing electronic device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in software form. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0117] Of course, in addition to software implementation, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0118] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 3 The method of the embodiment shown is specifically used to perform the following operations:
[0119] Receive 5G messages uploaded by the business platform, and cache the 5G messages in the message queue; obtain the pending 5G messages from the message queue, and determine the delivery quantity corresponding to the pending 5G messages; determine whether the pending 5G messages meet the flow control requirements based on the delivery quantity; when the judgment result is no, determine the waiting time corresponding to the pending 5G messages based on the delivery quantity, and suspend the processing of the pending 5G messages based on the waiting time; when the judgment result is yes, send the pending 5G messages to the message-as-a-platform MaaP platform, and determine the remaining number of tokens in the token bucket based on the delivery quantity.
[0120] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0121] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0122] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0123] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0124] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0125] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0126] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0127] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0128] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0129] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A message processing method, characterized in that: include: Receive 5G messages uploaded by the service platform, and cache the 5G messages in a message queue; Obtain a pending 5G message from the message queue, and determine a delivery quantity corresponding to the pending 5G message; Determine, according to the delivery quantity, whether the to-be-processed 5G message meets the flow control requirement; When the judgment result is no, determining the waiting time corresponding to the pending 5G message according to the delivery quantity, and suspending the processing of the pending 5G message according to the waiting time; When the judgment result is yes, the to-be-processed 5G message is sent to the message-as-a-platform MaaP platform, and the number of remaining tokens in the token bucket is determined based on the delivery quantity.
2. The method according to claim 1, characterized in that Determining, according to the delivery quantity, whether the to-be-processed 5G message meets the flow control requirement specifically includes: According to the token bucket algorithm and the delivery quantity, by applying for a token from the token bucket, it is determined whether the to-be-processed 5G message meets the flow control requirements.
3. The method according to claim 2, characterized in that Determining whether the to-be-processed 5G message meets the flow control requirement by applying for a token from the token bucket according to the token bucket algorithm and the delivery quantity specifically includes: Determining the first number of tokens in the token bucket according to the token bucket algorithm; Based on the first token quantity and the delivery quantity, determine whether the to-be-processed 5G message meets the flow control requirements.
4. The method according to claim 3, characterized in that The determining, according to the first token quantity and the delivery quantity, whether the to-be-processed 5G message meets the flow control requirement specifically includes: Determining whether the first token quantity is greater than the delivery quantity; When the judgment result is yes, it is determined that the to-be-processed 5G message meets the flow control requirement; When the judgment result is no, it is determined that the to-be-processed 5G message does not meet the flow control requirements.
5. The method according to claim 3, characterized in that: Determining the first number of tokens in the token bucket according to the token bucket algorithm specifically includes: Read the number of remaining tokens in the token bucket; Obtaining a token refresh time of the token bucket; Obtaining a token refresh rate of the token bucket; The first number of tokens in the token bucket is determined according to the current time, the token refresh time, the token refresh rate, and the remaining number of tokens.
6. The method according to claim 1, characterized in that Determining the waiting time corresponding to the to-be-processed 5G message according to the delivery quantity specifically includes: Determine a 5G message processing speed corresponding to the 5G message center; Determine a token refresh rate of the token bucket according to the 5G message processing speed; Determine the waiting time corresponding to the 5G message to be processed based on the delivery quantity, the first token quantity and the token refresh rate.
7. The method according to claim 1, characterized in that The suspending the processing of the pending 5G message according to the waiting time specifically includes: Suspending the processing of the pending 5G message and determining a suspension time; Determine a restart time according to the pause time and the waiting time; According to the restart time, restart the processing of the pending 5G message to determine whether the pending 5G message meets the flow control requirements.
8. The method according to claim 1, characterized in that After suspending the processing of the pending 5G message according to the waiting time, the method further includes: Determine a start time for processing the 5G message to be processed; Determine, according to the current time and the processing start time, a first processing time corresponding to the to-be-processed 5G message; Determine a second processing time corresponding to the to-be-processed 5G message according to the waiting time and the first processing time; Determine whether the second processing time is greater than a preset processing time threshold; When the judgment result is yes, terminate the suspension processing of the pending 5G message and end the processing of the pending 5G message.
9. The method according to claim 8, characterized in that The terminating the suspension processing of the pending 5G message and ending the processing of the pending 5G message specifically includes: Roll back the unique identifier of the pending 5G message in the message queue, and end the processing of the pending 5G message.
10. A message processing device, characterized in that: include: A 5G message cache unit, used to receive 5G messages uploaded by the service platform and cache the 5G messages in a message queue; A 5G message management unit, configured to obtain a pending 5G message from the message queue and determine a delivery quantity corresponding to the pending 5G message; A flow control unit, configured to determine whether the to-be-processed 5G message meets the flow control requirement according to the delivery quantity; A 5G message processing unit, configured to determine a waiting time corresponding to the 5G message to be processed according to the delivery quantity when the judgment result obtained by the traffic control unit is negative, and suspend the processing of the 5G message to be processed according to the waiting time; The 5G message processing unit is used to send the to-be-processed 5G message to the message-as-a-platform MaaP platform when the judgment result obtained by the traffic control unit is yes, and determine the number of remaining tokens in the token bucket according to the delivery number.
Citation Information
Patent Citations
Peak clipping processing method based on distributed token bucket
CN109194586A
Message congestion control method, system and equipment, and storage medium
CN109347757A
5G message pushing speed control method and device, equipment and medium
CN114641033A
5G message identity authentication method and system and computer readable storage medium
CN114650142A
System and method for realizing message issuing stability based on negative feedback dynamic token bucket
CN115766590A
