Message processing method, device, apparatus, storage medium, and computer program product
By introducing the access layer and token bucket algorithm into the 5G messaging system, the inefficiency caused by traffic control in the MaaP platform was solved, achieving stable and efficient 5G messaging processing and improving the user experience.
Patent Information
- Application Number
- CN202411024759.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-07-29
AI Technical Summary
In existing 5G messaging systems, when traffic control is performed solely through the MaaP platform, the efficiency of 5G message processing for users is low, which may lead to request failures and affect user experience.
An access layer is added between the business platform and the MaaP platform. By caching 5G messages to a message queue and using a token bucket algorithm to control traffic, messages that do not meet traffic requirements are paused or waited to be processed, ensuring that the message sending speed does not exceed the processing limit of the MaaP platform.
This effectively avoids 5G message processing request failures, ensures that the sending rate on the user side is not affected, improves 5G message processing efficiency, and enhances user experience.
Smart Images

Figure CN119155636B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of wireless communication, and in particular to a message processing method and device, equipment, storage medium and computer program product. BACKGROUND
[0002] 5G message is a kind of rich media message service based on 5G communication technology, which is upgraded from traditional short message service. 5G message supports rich media formats, including text, pictures, audio and video, etc. Compared with traditional short message service, 5G message has more forms of expression, including point-to-point message, group message and chatbot. Users can send and receive 5G messages sent by other users (or other servers) without downloading a client or adding friends. 5G message can provide enhanced personal and application message service, realize "message as a service", and users can intuitively and conveniently enjoy various 5G application services in the message window.
[0003] At present, the existing 5G message system framework is as shown in Figure 1 , which includes 5G message center (5G Message Center, 5GMC) and message as platform (Message As A Platform, MaaP). The 5GMC provides user terminal access control, registration authentication, configuration management, message routing and other functions. The MaaP platform is built on the 5GMC and provides Chatbot related functions, including Chatbot management, authentication and 5G message flow control, etc.
[0004] However, directly controlling the flow of 5G messages through the MaaP platform may have certain problems in some cases. For example, when the rate of 5G messages sent by the client exceeds the maximum flow control value (referred to as flow control value) of the MaaP platform, the MaaP platform will directly reject the request flow that exceeds the part. This results in that if the client does not control the sending speed of 5G messages, it is likely that the request will fail due to the request flow sending rate exceeding the flow control value of the MaaP platform, affecting the normal use of users.
[0005] If the user sends 5G messages to ensure that the 5G messages do not exceed the flow control value of the MaaP platform, the client needs to slow down the sending rate of 5G messages. If a large number of 5G messages are sent, it will take a long time, which greatly affects the user experience.
[0006] Therefore, how to ensure that the sending rate of 5G messages on the user side is not affected, and at the same time avoid the request failure caused by the request flow sending rate exceeding the flow control value of the MaaP platform, has become a problem to be solved at present. SUMMARY
[0007] Embodiments of the present application provide a message processing method 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 only the MaaP platform is used to control the flow of 5G messages under the existing 5G message system framework.
[0008] Embodiments of the present application also provide 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 only the MaaP platform is used to control the flow of 5G messages under the existing 5G message system framework.
[0009] Embodiments of the present application also provide 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 only the MaaP platform is used to control the flow of 5G messages under the existing 5G message system framework.
[0010] Embodiments of the present application also provide 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 only the MaaP platform is used to control the flow of 5G messages under the existing 5G message system framework.
[0011] Embodiments of the present application also provide a computer program product 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 only the MaaP platform is used to control the flow of 5G messages under the existing 5G message system framework.
[0012] Embodiments of the present application adopt the following technical solutions:
[0013] A message processing method includes: receiving a 5G message uploaded by a service platform, and caching the 5G message to a message queue; obtaining a to-be-processed 5G message from the message queue, and determining a delivery quantity corresponding to the to-be-processed 5G message; determining whether the to-be-processed 5G message meets a flow control requirement according to the delivery quantity; when the determination result is no, determining a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspending processing of the to-be-processed 5G message according to the waiting duration; and when the determination result is yes, sending the to-be-processed 5G message to a message as a platform (MaaP) platform, and determining a remaining token quantity in a token bucket according to the delivery quantity.
[0014] A message processing apparatus, comprising: a 5G message caching unit, configured to receive a 5G message uploaded by a service platform, and cache the 5G message into a message queue; a 5G message management unit, configured to acquire a to-be-processed 5G message from the message queue, and determine a delivery quantity corresponding to the to-be-processed 5G message; a flow control unit, configured to determine whether the to-be-processed 5G message meets a flow control requirement according to the delivery quantity; a 5G message processing unit, configured to, when a judgment result obtained by the flow control unit is no, determine a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspend processing of the to-be-processed 5G message according to the waiting duration; and the 5G message processing unit, configured to, when the judgment result obtained by the flow control unit is yes, send the to-be-processed 5G message to a message as a platform (MaaP) platform, and determine a remaining token quantity in a token bucket according to the delivery quantity.
[0015] A message processing apparatus, comprising: a processor; and a memory arranged to store computer-executable instructions that, when executed, cause the processor to: receive a 5G message uploaded by a service platform, and cache the 5G message into a message queue; acquire a to-be-processed 5G message from the message queue, and determine a delivery quantity corresponding to the to-be-processed 5G message; determine whether the to-be-processed 5G message meets a flow control requirement according to the delivery quantity; when a judgment result is no, determine a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspend processing of the to-be-processed 5G message according to the waiting duration; and when the judgment result is yes, send the to-be-processed 5G message to a message as a platform (MaaP) platform, and determine a remaining token quantity in a token bucket according to the delivery quantity.
[0016] A computer-readable storage medium storing one or more programs, which when executed by an electronic device comprising a plurality of applications, cause the electronic device to: receive a 5G message uploaded by a service platform, and cache the 5G message into a message queue; acquire a to-be-processed 5G message from the message queue, and determine a delivery quantity corresponding to the to-be-processed 5G message; determine whether the to-be-processed 5G message meets a flow control requirement according to the delivery quantity; when a judgment result is no, determine a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspend processing of the to-be-processed 5G message according to the waiting duration; and when the judgment result is yes, send the to-be-processed 5G message to a message as a platform (MaaP) platform, and determine a remaining token quantity in a token bucket according to the delivery quantity.
[0017] The computer program product comprises a computer program, which, when executed by a processor, implements: receiving a 5G message uploaded by a business platform, and caching the 5G message into a message queue; obtaining a to-be-processed 5G message from the message queue, and determining a delivery quantity corresponding to the to-be-processed 5G message; determining, according to the delivery quantity, whether the to-be-processed 5G message meets a flow control requirement; when the determination result is no, determining a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspending processing of the to-be-processed 5G message according to the waiting duration; and when the determination result is yes, sending the to-be-processed 5G message to a message as a platform (MaaP) platform, and determining a remaining token quantity in a token bucket according to the delivery quantity.
[0018] The above at least one technical solution adopted by the embodiments of the present application can achieve the following beneficial effects:
[0019] The message processing method provided by the embodiments of the present application can be used for the 5G message uploaded by the business platform, the received 5G message can be first cached into the message queue, then the to-be-processed 5G message is obtained from the message queue, the delivery quantity corresponding to the to-be-processed 5G message is determined, and whether the to-be-processed 5G message meets the flow control requirement is determined according to the delivery quantity corresponding to the to-be-processed 5G message; when the determination result is no, the waiting duration corresponding to the to-be-processed 5G message is determined according to the delivery quantity, and the processing of the to-be-processed 5G message is suspended according to the waiting duration; and when the determination result is yes, the to-be-processed 5G message is sent to the 5G message center for processing, and the remaining token quantity in the token bucket is determined according to the delivery quantity. By using the method provided by the embodiments of the present application, the massive 5G messages generated by the business platform are avoided from being directly uploaded to the MaaP platform in the manner of adding a receiving layer between the business platform and the MaaP platform, on the one hand, since the 5G messages uploaded by the business platform will not be directly uploaded to the MaaP platform for processing, but are first temporarily cached into the message queue, so that the business platform does not need to consider the processing rate of the MaaP platform when sending the 5G messages, thereby ensuring that the business platform can send the 5G messages at a normal speed; on the other hand, when the receiving platform pulls the to-be-processed 5G message from the message queue for processing, the to-be-processed 5G message with sufficient tokens is sent to the MaaP platform for processing in the manner of requesting tokens from the token bucket, since the token update rate of the token bucket is determined according to the processing rate of the MaaP platform, so that the receiving platform can upload the to-be-processed 5G message to the MaaP platform at 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, and further causing the 5G message processing request to fail, thereby affecting the normal use of the user. BRIEF DESCRIPTION OF DRAWINGS
[0020] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0021] Figure 1 A schematic diagram of the specific structure of a 5G message processing system provided for existing technology;
[0022] Figure 2 This is a schematic diagram of the specific structure of a 5G message processing system provided in an embodiment of this application;
[0023] Figure 3 This is a schematic flowchart illustrating a message processing method provided in an embodiment of this application.
[0024] Figure 4 This application provides a schematic diagram illustrating a specific process for determining whether a message meets flow control requirements using a token bucket algorithm, as shown in the embodiments of this application.
[0025] Figure 5 This is a schematic flowchart illustrating a message processing method provided in an embodiment of this application.
[0026] Figure 6 This is a schematic diagram of the specific structure of a message processing device provided in an embodiment of this application;
[0027] Figure 7 This is a schematic diagram of the specific structure of a message processing device provided in an embodiment of this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] To address the issue of low 5G message processing efficiency for users when using the MaaP platform for flow control of 5G messages within the existing 5G messaging system framework, due to limitations imposed by the MaaP platform's flow control values, this application provides a message processing method. The technical solutions provided by each embodiment of this application are described in detail below with reference to the accompanying drawings.
[0030] like Figure 2 The diagram shown is a schematic representation of the basic architecture of a message processing system provided in an embodiment of this application. Figure 2As shown, in order to realize the ability of ensuring that the sending rate of the user side 5G message is not affected and avoiding the request failure caused by the request traffic sending rate exceeding the flow control value of the MaaP platform, the embodiments of the present application design a new 5G message processing system framework by adding an access layer between the business platform (for example, a Certified Service Partner (CSP)) and the MaaP platform, and the 5G message processing system is composed of the business platform, the access layer, the MaaP platform and the 5GMC.
[0031] The 5GMC has the functions of access control of 5G message users, registration authentication, message routing and addressing, terminal configuration management, etc. It is mainly composed of a group chat function module, an IP Multimedia Subsystem (IMS) access function module, a multimedia content storage function module and a configuration server.
[0032] The MaaP platform is carried on the 5G message center, provides a unified interface of the business platform, and is responsible for the access management, authentication, multimedia content uploading and storage of industry clients and messages. The MaaP platform includes two parts of basic functions and operation management, wherein the operation management is used for the management of opening, permission configuration, etc. of the industry client Chatbot by the operator.
[0033] The business platform, in the embodiments of the present application, generally refers to a Certified Service Partner (CSP) platform. The CSP platform is a 5G message operation platform jointly built by the operator and each ecological enterprise, is an operation tool platform for providing Chatbot service, is composed of an access module, a session adapter, an intent recognition engine, a business process configuration module, etc., and becomes the center of 5G message sending, operation and management.
[0034] The access layer is composed of a 5G message receiving module, a Kafka cluster and a queue service cluster. The 5G message receiving module is connected with the CSP platform, is used for receiving the massive 5G messages uploaded by the CSP platform, and buffers the received 5G messages to the Kafka cluster. The queue service cluster is used for flow control of the 5G messages in the message queue of the Kafka cluster, so as to deliver the 5G messages to the MaaP platform at a speed not exceeding the MaaP flow control value, and the 5G messages that have not been delivered in time are not returned to the business platform, but are temporarily stored in the message queue for slow delivery.
[0035] For convenience of description, the message processing method provided by the embodiments of the present application is introduced below by taking the access layer in the 5G message processing system as an example.
[0036] Specifically, the implementation flowchart of the message processing method provided in the present application is shown in the figure Figure 3 and mainly includes the following steps:
[0037] Step 11, receiving the 5G message uploaded by the service platform, and caching the 5G message into a message queue;
[0038] The access layer receives the 5G message sent by the enterprise customer through the CSP platform through the 5G message receiving module. It should be noted that the object served by the CSP platform is the enterprise customer (B-end user), and the enterprise customer generally performs a promotion business based on the 5G message through the CSP platform, so the 5G message sent by the CSP platform to the access layer is generally a 5G group message. For example, an enterprise customer needs to promote a certain business through group sending of 5G messages, and the enterprise customer can generate a 5G message to be promoted through a Chatbot on the CSP platform, set the number of group sending, such as 1000, and upload the generated 5G message to be promoted and the number of group sending to the access layer through the CSP platform.
[0039] In order to ensure data security, in the embodiment of the present application, after receiving the 5G message uploaded by the CSP platform, the access layer can perform simple security verification on the 5G message, such as permission verification, business verification and format verification on the received 5G message, etc., to ensure that the received 5G message is from a legitimate enterprise customer that has been authenticated.
[0040] After verification, the 5G message receiving module can cache the received 5G message into a message queue (Message queue, MQ). It should be noted that the access layer can use ActiveMQ, RabbitMQ, RocketMQ and Kafka as the middleware of the message queue, and in the embodiment of the present application, Kafka message queue is taken as an example to introduce the implementation of the method. It can be understood that caching the 5G message into the Kafka message queue by the access layer is only an exemplary description and should not be understood as a limitation of the method.
[0041] Step 12, obtaining the 5G message to be processed from the message queue, and determining the delivery quantity corresponding to the 5G message to be processed;
[0042] The access layer pulls a batch of 5G messages to be processed from the Kafka message queue through each queue service node in the queue service cluster to form a token request queue, and determines the delivery quantity corresponding to each 5G message to be processed in the token request queue in turn. In the embodiment of the present application, the delivery quantity corresponding to the 5G message to be processed refers to the group sending quantity corresponding to the 5G message. For example, if an enterprise customer sets the group sending quantity of a 5G message to be 1000 through the CSP platform, the delivery quantity corresponding to the 5G message is 1000.
[0043] Step 13, determining whether the 5G message to be processed meets the traffic control requirement according to the delivery quantity corresponding to each 5G message to be processed determined by performing step 12.
[0044] When the judgment result is no, step 14 is performed; when the judgment result is yes, step 16 is performed.
[0045] In the embodiment of the present application, the queue service node can apply for tokens in the token bucket based on the token bucket algorithm according to the delivery quantity corresponding to each 5G message to be processed in the token request queue, and determine whether the 5G message to be processed can apply for sufficient tokens by comparing the current tokens in the token bucket with the delivery quantity corresponding to the 5G message to be processed, so as to determine whether the 5G message to be processed meets the traffic control requirement.
[0046] In one embodiment, when the queue service node applies for tokens in the token bucket, and further determines whether the 5G message to be processed meets the traffic control requirement according to the token bucket algorithm, the queue service node can determine whether the 5G message to be processed meets the traffic control requirement according to the token bucket algorithm according to the sub-step as shown in FIG. 13. Figure 4
[0047] Sub-step 1301, after starting to apply for tokens, the queue service node can take the requested token bucket key (tokens_key) and the applied token quantity (reques), and the token refresh rate (rate) and the token bucket capacity (capacity) corresponding to the token bucket as input parameters according to the token bucket algorithm.
[0048] Among them, 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 token quantity (remain_token) and the current time (now).
[0050] Sub-step 1303, judge whether the remain_token is read, when the judgment result is yes, execute sub-step 1305; when the judgment result is no, execute 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 tokens at this time, that is, the number of tokens currently remaining in the token bucket (remain_token) is equal to the capacity of the token bucket (capacity), that is, remain_token = capacity, and continue to execute sub-step 1305;
[0052] Sub-step 1305, read the last time of refreshing tokens (last_refreshed);
[0053] Sub-step 1306, judge whether the last_refreshed is read, when the judgment result is yes, execute sub-step 1308; when the judgment result is no, execute sub-step 1307;
[0054] Sub-step 1307, when the last_refreshed is not read, it means that the token bucket has not been refreshed at this time, that is, last_refreshed = 0, and continue to execute sub-step 1308;
[0055] Sub-step 1308, determine the number of tokens that can be applied for refreshing of the token bucket according to last_refreshed;
[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, judge whether the number of tokens filled_token applied for by executing sub-step 1308 is above the number of tokens requested (reques), when the judgment result is yes, execute sub-step 1311; when the judgment result is no, execute sub-step 1312;
[0060] Sub-step 1311, determine that the 5G messages to be processed meet the flow control requirements, and execute sub-step 1313;
[0061] Sub-step 1312, it is determined that the to-be-processed 5G message does not meet the traffic control requirement;
[0062] Sub-step 1313, the current remaining token quantity (remain_token) of the token bucket is updated;
[0063] Specifically, the current remaining token quantity of the token bucket can be updated according to the following formula [2]:
[0064] remain_token = filled_token - request [2]
[0065] Sub-step 1314, the updated remain_token and last_refreshed are saved;
[0066] Sub-step 1315, the flow control result and remain_token are output.
[0067] In an implementation, the queue service node can determine whether the to-be-processed 5G message meets the traffic control requirement according to the following method: determining the first token quantity in the token bucket; judging 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 traffic control requirement; when the judgment result is no, it is determined that the to-be-processed 5G message does not meet the traffic control requirement.
[0068] It should be noted here that in the embodiments of the present application, when performing traffic control, the to-be-processed 5G message needs to obtain a token quantity equal to the delivery quantity, that is, assuming that the delivery quantity corresponding to a to-be-processed 5G message is 100, when 100 tokens are obtained by applying for tokens from the token bucket through the token bucket algorithm, the 5G message is considered to meet the traffic control requirement.
[0069] Step 14, when the judgment result obtained by executing step 13 is no, the waiting time corresponding to the to-be-processed 5G message is determined according to the delivery quantity, and the processing of the to-be-processed 5G message is suspended according to the waiting time;
[0070] When it is determined through step 13 that the 5G message does not meet the traffic control requirement, it means that the processing pressure of the MaaP platform has tended to be saturated at this time, and the MaaP platform cannot continue to receive 5G messages for processing, so the queue service node can suspend sending 5G messages to the MaaP platform at this time.
[0071] Meanwhile, the queue service node can update the token rate of the token bucket to determine the waiting time length for the 5G message. In an embodiment, the queue service node can determine the waiting time length according to the following method: determining the 5G message processing speed corresponding to the 5G message center; determining the token refresh rate of the token bucket according to the 5G message processing speed; and determining the waiting time length corresponding to the to-be-processed 5G message according to the delivery quantity, the first token quantity, and the token refresh rate.
[0072] Specifically, the queue service node can determine the token quantity difference according to the delivery quantity corresponding to the to-be-processed 5G message and the current token quantity in the token bucket, and then determine the waiting time length according to the token refresh rate of the token bucket and the token quantity difference according to the following formula [3]:
[0073] wait_time=(need-remain_token) / rate [3]
[0074] wherein need represents the delivery quantity corresponding to the to-be-processed 5G message, remain_token represents the current token quantity in the token bucket, and rate represents the token refresh rate of the token bucket. It should be noted that, since the token bucket is used to control the sending speed of the 5G message from the access layer to the MaaP platform to ensure that the sending speed of the 5G message from the access layer to the MaaP platform is lower than the processing speed of the MaaP platform, the token refresh rate of the token bucket is determined by the processing speed of the MaaP platform in the embodiment, that is, the token refresh rate ≤ the processing speed of the MaaP platform. For example, if the 5G message processing speed of the MaaP platform is 100000 pieces / s, the token refresh rate of the token bucket can be set to ≤ 100000 pieces / s.
[0075] After the waiting time length is determined by the above method, the queue service node can call the Thread.sleep() method to suspend the processing of the to-be-processed 5G message.
[0076] It should be noted that, in order to avoid the problem of thread death caused by too many times of non-passing of the token request for a to-be-processed 5G message, in an embodiment, the queue service node can set a processing time length threshold, and when it is determined that the processing time length of a 5G message suspended for processing has exceeded the processing time length threshold, the processing of the 5G message is ended, and the unique identifier of the 5G message in the Kafka message queue is rolled back.
[0077] In the embodiments of the present application, after the queue service node suspends the processing of a certain 5G message, the queue service node can monitor the total processing time of the 5G message in the following manner, and determine whether to roll back the 5G message according to the monitoring result, the method comprising: determining the processing start time of the to-be-processed 5G message; determining the first processing time corresponding to the to-be-processed 5G message according to the current time and the processing start time; determining the second processing time corresponding to the to-be-processed 5G message according to the waiting time and the first processing time; determining whether the second processing time is greater than the preset processing time threshold; when the determination result is yes, rolling back the unique identifier of the to-be-processed 5G message in the message queue, and ending the processing of the to-be-processed 5G message.
[0078] Specifically, after the processing time of a certain 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 re-roll 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, it can start from the 5G message and pull 5G messages from the Kafka message queue again to form a new token request queue for processing.
[0079] Step 15, determining the restart time for the 5G message, and restarting the processing of the to-be-processed 5G message according to the restart time, and determining whether the to-be-processed 5G message meets the flow control requirement;
[0080] In the embodiments of the present application, when the suspension time of a certain 5G message has reached the waiting time, the queue service node can restart the processing of the 5G message, and continue to perform step 13.
[0081] In one embodiment, the queue service node can determine whether to restart the processing of the suspended 5G message in the following manner, comprising: suspending the processing of the to-be-processed 5G message, and determining the suspension time; determining the restart time according to the suspension time and the waiting time; restarting the processing of the to-be-processed 5G message according to the restart time, and determining whether the to-be-processed 5G message meets the flow control requirement.
[0082] Step 16, when the determination result obtained by performing step 13 is yes, sending the to-be-processed 5G message to the MaaP platform, and determining the remaining token quantity in the token bucket according to the delivery quantity.
[0083] Among them, the to-be-processed 5G message can be sent to the MaaP platform to send the 5G message to the 5GMC through the MaaP platform, and at the same time, the queue service node can determine the remaining token quantity in the current token bucket according to the delivery quantity corresponding to the sent 5G message.
[0084] In an embodiment, the message processing scheme is mainly realized by relying on a queue service cluster in an access layer. After obtaining the 5G messages to be processed in the Kafka message queue, the queue service cluster can control its message processing speed according to the message processing rate of the MaaP platform, so as to avoid the problem that the uploading speed of the 5G messages exceeds the processing limit of the MaaP platform, thereby causing the 5G message processing request to fail and affecting the normal use of users.
[0085] Hereinafter, the specific processing flow of the queue service cluster in the embodiment of the present application will be described with reference to the flowchart shown in FIG. 8, which mainly includes the following steps: Figure 5
[0086] Step 201: The queue service node calls the poll method to obtain a batch of 5G messages to be processed from the Kafka message queue.
[0087] Suppose that the number of the obtained 5G messages to be processed is L.
[0088] Step 202: The current time is taken as the processing start time start_time, and i represents the number of the 5G messages to be processed at present. At the start time start_time, i = 0.
[0089] Step 203: The i-th message is processed, and the number of tokens need to be applied for by the i-th 5G message is determined.
[0090] Step 204: The token bucket algorithm is called to obtain the return result value pass and the remaining token number remain_token according to the number of tokens need to be applied for by the i-th 5G message.
[0091] 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.
[0092] Step 206: The i-th 5G message is uploaded to the MaaP platform, and the commitSync method is called to submit the Offset of the message.
[0093] Step 207: It is judged whether i+1 is less than L. When the judgment result is false, it is indicated that the L 5G messages to be processed have been completely processed, and then step 201 is executed to obtain a batch of 5G messages to be processed. When the judgment result is true, it is indicated that the L 5G messages to be processed have not been completely processed, and then step 203 is executed to process the i+1-th message.
[0094] Step 208, determine the waiting time corresponding to the 5G message wait_time = (need-remain_token) / rate;
[0095] Step 209, obtain the current time now, and determine the total time total_time = now-start_time that the 5G message has been processed;
[0096] Step 210, determine whether total_time+wait_time is greater than the pre-configured processing time threshold, when the determination result is no, step 211 is executed, and when the determination result is yes, step 212 is executed;
[0097] Step 211, call the Thread.sleep method to make the Kafka consumer thread pause processing of the 5G message, the pause duration is wait_time, and step 204 is executed after the pause;
[0098] Step 212, call the seek method to re-rollback the unique identifier of the 5G message to the Kafka message queue, so that when the queue service node completes processing of each 5G message in the current token request queue, the poll method is called again to start from the 5G message, and the 5G message is pulled from the Kafka message queue again to form a new token request queue.
[0099] The message processing method provided in the embodiment of the present application can be used for the 5G message uploaded by the service platform, the received 5G message can be first cached in the message queue, then the to-be-processed 5G message is obtained from the message queue, the delivery quantity corresponding to the to-be-processed 5G message is determined, and whether the to-be-processed 5G message meets the flow control requirement is determined according to the delivery quantity corresponding to the to-be-processed 5G message; when the determination result is no, the waiting duration corresponding to the to-be-processed 5G message is determined according to the delivery quantity, and the processing of the to-be-processed 5G message is suspended according to the waiting duration; when the determination result is yes, the to-be-processed 5G message is sent to the 5G message center for processing, and the remaining token quantity in the token bucket is determined according to the delivery quantity. By means of the method provided in the embodiment of the present application, the massive 5G messages generated by the service platform are avoided from being directly uploaded to the MaaP platform, on the one hand, since the 5G messages uploaded by the service platform will not be directly uploaded to the MaaP platform for processing, but are first temporarily cached in the message queue, thus the service platform does not need to consider the processing rate of the MaaP platform when sending the 5G messages, so that the service platform can send the 5G messages at a normal speed; on the other hand, when the receiving platform pulls the to-be-processed 5G message from the message queue for processing, the to-be-processed 5G message with sufficient tokens is sent to the MaaP platform for processing by means of the token bucket token request, since the token update rate of the token bucket is determined according to the processing rate of the MaaP platform, so that the receiving platform can upload the to-be-processed 5G message to the MaaP platform at 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, and further causing the 5G message processing request to fail, and affecting the normal use of the user.
[0100] In an implementation manner, the embodiment of the present application further provides a message processing device to solve the problem that the user's 5G message processing efficiency is low due to the limitation of the flow control value of the MaaP platform when the MaaP platform controls the flow of the 5G message in the existing 5G message system framework. The specific structure diagram of the message processing device is shown in Figure 6 The message processing device includes a 5G message caching unit 61, a 5G message management unit 62, a flow control unit 63, and a 5G message processing unit 64.
[0101] The 5G message caching unit 61 is configured to receive the 5G message uploaded by the service platform, and cache the 5G message in the message queue.
[0102] The 5G message management unit 62 is configured to obtain the to-be-processed 5G message from the message queue, and determine the delivery quantity corresponding to the to-be-processed 5G message.
[0103] The traffic control unit 63 is configured to determine whether the to-be-processed 5G message meets the traffic control requirement according to the delivery quantity.
[0104] The 5G message processing unit 64 is configured to, when the determination result obtained by the traffic control unit 63 is no, determine a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspend processing of the to-be-processed 5G message according to the waiting duration.
[0105] The 5G message processing unit 64 is configured to, when the determination result obtained by the traffic control unit 63 is yes, send the to-be-processed 5G message to a message as a platform (MaaP) platform, process the to-be-processed 5G message through the MaaP platform, and determine a remaining token quantity in a token bucket according to the delivery quantity.
[0106] In an embodiment, the traffic control unit 63 is specifically configured to: determine a first token quantity in the token bucket; determine whether the first token quantity is greater than the delivery quantity; when the determination result is yes, determine that the to-be-processed 5G message meets the traffic control requirement; and when the determination result is no, determine that the to-be-processed 5G message does not meet the traffic control requirement.
[0107] In an embodiment, the 5G message processing unit 64 is specifically configured to: 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; and determine a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, the first token quantity, and the token refresh rate.
[0108] In an embodiment, the 5G message processing unit 64 is specifically configured to: suspend processing of the to-be-processed 5G message, and determine a suspension time; determine a restart time according to the suspension time and the waiting duration; and restart processing of the to-be-processed 5G message according to the restart time, and determine whether the to-be-processed 5G message meets the traffic control requirement.
[0109] In an embodiment, the 5G message processing unit 64 is specifically configured to: determine a processing start time of the to-be-processed 5G message; determine a first processing time consumption corresponding to the to-be-processed 5G message according to a current time and the processing start time; determine a second processing time consumption corresponding to the to-be-processed 5G message according to the waiting duration and the first processing time consumption; determine whether the second processing time consumption is greater than a preset processing duration threshold; and when the determination result is yes, roll back a unique identifier of the to-be-processed 5G message in the message queue, and end processing of the to-be-processed 5G message.
[0110] The message processing device provided in the embodiment of the application can buffer the received 5G message to the message queue first, then acquire the to-be-processed 5G message from the message queue, determine the delivery quantity corresponding to the to-be-processed 5G message, and determine whether the to-be-processed 5G message meets the flow control requirement according to the delivery quantity corresponding to the to-be-processed 5G message; when the determination result is no, the waiting duration corresponding to the to-be-processed 5G message is determined according to the delivery quantity, and the processing of the to-be-processed 5G message is suspended according to the waiting duration; when the determination result is yes, the to-be-processed 5G message is sent to the 5G message center for processing, and the remaining token quantity in the token bucket is determined according to the delivery quantity. The method provided in the embodiment of the application avoids that the massive 5G messages generated by the service platform are directly uploaded to the MaaP platform by adding a receiving layer between the service platform and the MaaP platform, on the one hand, because the 5G messages uploaded by the service platform are not directly uploaded to the MaaP platform for processing, but are temporarily buffered to the message queue first, so that the service platform does not need to consider the processing rate of the MaaP platform when sending the 5G messages, thereby ensuring that the service platform can send the 5G messages at a normal speed; on the other hand, when the receiving platform pulls the to-be-processed 5G message from the message queue for processing, the to-be-processed 5G message with sufficient tokens is sent to the MaaP platform for processing by the token bucket request token mode, because the token update rate of the token bucket is determined according to the processing rate of the MaaP platform, so that the receiving platform can upload the to-be-processed 5G message to the MaaP platform according to the processing speed of the 5G message center, thereby avoiding that the 5G message upload speed exceeds the processing limit of the MaaP platform, and further causing the 5G message processing request to fail, thereby affecting the normal use of the user.
[0111] Figure 7 is a structural schematic diagram of an electronic device of an embodiment of the application. Please refer to Figure 7 At the hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The memory can include a memory such as a random-access memory (RAM), and can also include a non-volatile memory such as at least one disk memory. Of course, the electronic device can also include other hardware required by a business.
[0112] The processor, the network interface and the memory can be connected with each other 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, etc. 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 to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0113] The memory is used to store programs. Specifically, the program can include program code including computer operation instructions. The memory can include an internal memory and a non-volatile memory, and provide instructions and data for the processor.
[0114] The processor reads the corresponding computer program from the non-volatile memory into the internal memory and then runs, and forms a message processing device at a logical level. The processor executes the program stored in the memory, and is specifically used for the following operations: receiving a 5G message uploaded by a service platform, and caching the 5G message into a message queue; obtaining a to-be-processed 5G message from the message queue, determining a delivery quantity corresponding to the to-be-processed 5G message; determining whether the to-be-processed 5G message meets a flow control requirement according to the delivery quantity; when the determination result is no, determining a waiting time length corresponding to the to-be-processed 5G message according to the delivery quantity, and suspending processing of the to-be-processed 5G message according to the waiting time length; and when the determination result is yes, sending the to-be-processed 5G message to a message as a platform (MaaP) platform, and determining a remaining token quantity in a token bucket according to the delivery quantity.
[0115] The above as described in the present application Figure 7The method executed by the message processing electronic device disclosed in the embodiment can be applied to a processor or implemented by the processor. The processor can be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above method can be completed by integrated logic circuits of hardware in the processor or instructions in the form of software. The above processor can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; 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 gate or transistor logic devices, discrete hardware components. Each method, step and logic block disclosed in the embodiment of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiment of the present application can be directly embodied as a hardware decoding processor for execution, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory, an electrically erasable programmable memory, a register, etc. The storage medium in the art. The storage medium is located in the memory, and the processor reads the information in the memory and combines the hardware to complete the steps of the above method.
[0116] Of course, in addition to the software implementation, the electronic device of the present application does not exclude other implementation manners, such as logic devices or software and hardware combined manner, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but also can be hardware or logic device.
[0117] The embodiment of the present application also proposes a computer readable storage medium, the computer readable storage medium stores one or more programs, the one or more programs include instructions, when the instructions are executed by the portable electronic device including a plurality of application programs, the portable electronic device can execute Figure 3 The method of the embodiment, and specifically for executing the following operations:
[0118] Receiving a 5G message uploaded by a service platform, caching the 5G message into a message queue, obtaining a to-be-processed 5G message from the message queue, determining a delivery quantity corresponding to the to-be-processed 5G message, determining whether the to-be-processed 5G message meets a flow control requirement according to the delivery quantity, when the determination result is no, determining a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspending processing of the to-be-processed 5G message according to the waiting duration, and when the determination result is yes, sending the to-be-processed 5G message to a message as a platform (MaaP) platform, and determining a remaining token quantity in a token bucket according to the delivery quantity.
[0119] Those skilled in the art will appreciate that embodiments of the application can be supplied as methods, systems, or computer program products. Accordingly, the application can be embodied in the form of complete hardware embodiments, complete software embodiments, or embodiments combining software and hardware aspects. Furthermore, the application can be embodied in the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) having computer usable program code embodied thereon.
[0120] The present application is described in reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams, 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 apparatus to produce a machine, so that the instructions, which are executed via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowcharts and / or block diagrams block or blocks. Figure 1 The flow or flows and / or blocks Figure 1 The means for performing the functions specified in the flowchart
[0121] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instruction means that implement the function specified in the flowcharts and / or block diagrams block or blocks. Figure 1 The flow or flows and / or blocks Figure 1 The means for performing the functions specified in the flowchart
[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions executed on the computer or other programmable apparatus provide means for implementing the functions specified in the flowcharts and / or block diagrams block or blocks. Figure 1one or more processes and / or blocks Figure 1 steps of a function specified in one or more blocks.
[0123] In one typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0124] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory, etc. The memory is an example of computer readable media.
[0125] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as 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 disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carrier waves.
[0126] It should also be noted that the terms "comprising," "including," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements recited, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.
[0127] Those skilled in the art will appreciate that embodiments of the present application can be devised for a method, a system, or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer readable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable program code.
[0128] The above embodiments are only used to illustrate the present application, but not to limit it. Various modifications and changes can be made by those skilled in the art. Any modification, equivalent replacement, improvement, and the like made within the spirit and principle of the present application shall fall into the scope of claims of the present application.
Claims
1. A message processing method characterized by, The method comprises the following steps: receiving a 5G message uploaded by a service platform, and caching the 5G message to a message queue; obtaining a to-be-processed 5G message from the message queue, and determining a delivery quantity corresponding to the to-be-processed 5G message; determining whether the to-be-processed 5G message meets a traffic control requirement according to the delivery quantity; when the determination result is no, determining a waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, and suspending processing of the to-be-processed 5G message according to the waiting duration; when the determination result is yes, sending the to-be-processed 5G message to a message as a platform (MaaP) platform, and determining a remaining token quantity in a token bucket according to the delivery quantity; determining whether the to-be-processed 5G message meets the traffic control requirement according to the delivery quantity, specifically comprising the following steps: reading a token quantity remaining in the token bucket; obtaining a token refresh time point of the token bucket; obtaining a token refresh rate of the token bucket; determining a first token quantity in the token bucket according to a current time, the token refresh time point, the token refresh rate and the remaining token quantity based on formula (1); (1), wherein capacity represents the token bucket capacity, remain_token represents the current number of tokens remaining in the token bucket, now represents the current time, last_refreshed represents the last time the tokens were refreshed, and rate represents the token refresh rate of the token bucket. determining whether the first token quantity is greater than the delivery quantity; when the determination result is yes, determining that the to-be-processed 5G message meets the traffic control requirement; when the determination result is no, determining that the to-be-processed 5G message does not meet the traffic control requirement; determining the waiting duration corresponding to the to-be-processed 5G message according to the delivery quantity, specifically comprising the following steps: determining a 5G message processing speed corresponding to the 5G message center; determining the token refresh rate of the token bucket according to the 5G message processing speed; Based on formula (2), a token quantity difference is determined according to the delivery quantity and a current remaining token quantity of the token bucket, and then a waiting duration corresponding to the 5G message to be processed is determined according to the token quantity difference and the token refresh rate. (2), wherein need represents a delivery quantity corresponding to the 5G message to be processed.
2. The method of claim 1, wherein, suspending the processing of the to-be-processed 5G message according to the waiting duration, specifically comprising the following steps: suspending the processing of the to-be-processed 5G message, and determining a suspension time point; determining a restart time point according to the suspension time point and the waiting duration; restarting the processing of the to-be-processed 5G message according to the restart time point, and determining whether the to-be-processed 5G message meets the traffic control requirement.
3. The method of claim 1, wherein, After suspending the processing of the to-be-processed 5G message according to the waiting duration, the method further comprises the following steps: determining a processing start time point of the to-be-processed 5G message; determining a first processing time consumption corresponding to the to-be-processed 5G message according to a current time and the processing start time point; determining a second processing time consumption corresponding to the to-be-processed 5G message according to the waiting duration and the first processing time consumption; determining whether the second processing time consumption is greater than a preset processing duration threshold; when the determination result is yes, terminating the suspension processing of the to-be-processed 5G message, and ending the processing of the to-be-processed 5G message.
4. The method of claim 3, wherein, terminating the suspension processing of the to-be-processed 5G message and ending the processing of the to-be-processed 5G message, specifically comprising the following steps: rolling back a unique identifier of the to-be-processed 5G message in the message queue, and ending the processing of the to-be-processed 5G message.
5. A message processing device, characterized by The method comprises the following steps: a 5G message caching unit is configured to receive a 5G message uploaded by a service platform, and cache the 5G message to a message queue; 5G message management unit, configured to obtain a to-be-processed 5G message from the message queue, and determine a delivery quantity corresponding to the to-be-processed 5G message; a flow control unit, configured to determine whether the to-be-processed 5G message meets a flow control requirement according to the delivery quantity; a 5G message processing unit, configured to, when the determination result obtained by the flow control unit is no, determine a waiting time length corresponding to the to-be-processed 5G message according to the delivery quantity, and suspend processing of the to-be-processed 5G message according to the waiting time length; the 5G message processing unit, configured to, when the determination result obtained by the flow control unit is yes, send the to-be-processed 5G message to a message as a platform (MaaP) platform, and determine a remaining token quantity in a token bucket according to the delivery quantity; the flow control unit, further configured to read the remaining token quantity in the token bucket; obtain a token refreshing time of the token bucket; obtain a token refreshing rate of the token bucket; determine a first token quantity in the token bucket according to a current time, the token refreshing time, the token refreshing rate, and the remaining token quantity based on formula (1); (1), wherein capacity represents the token bucket capacity, remain_token represents the current remaining token quantity of the token bucket, now represents the current time, last_refreshed represents the last time of refreshing the token, and rate represents the token refreshing rate of the token bucket. determine whether the first token quantity is greater than the delivery quantity; when the determination result is yes, determine that the to-be-processed 5G message meets the flow control requirement; when the determination result is no, determine that the to-be-processed 5G message does not meet the flow control requirement; the 5G message processing unit, further configured to determine a 5G message processing speed corresponding to the 5G message center; determine the token refreshing rate of the token bucket according to the 5G message processing speed; Based on formula (2), a token quantity difference is determined according to the delivery quantity and a current remaining token quantity of the token bucket, and then a waiting duration corresponding to the 5G message to be processed is determined according to the token quantity difference and the token refresh rate. (2), wherein need represents a delivery quantity corresponding to the 5G message to be processed.
Citation Information
Patent Citations
Peak clipping processing method based on distributed token bucket
CN109194586A
5G message interface current limiting method and device, electronic equipment and storage medium
CN118250743A