Update Method, Device, Computer Equipment and Storage Medium for Message Data

By constructing message queues and decoupling response components, message data processing is optimized, hardware bottlenecks and database pressure problems are solved, and efficient and flexible message data updates and emergency incident handling are achieved.

CN112559211BActive Publication Date: 2025-07-29CHINA PING AN LIFE INSURANCE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011492374.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-16
Publication Date
2025-07-29
Estimated Expiration
2040-12-16

AI Technical Summary

Technical Problem

When the prior art faces the processing of large amounts of message data, there are problems such as low processing efficiency and high database pressure in the process of the prior art, and middleware is prone to errors and difficult to recover.

Method used

Receive data processing requests through the message component, construct a message queue and send message events, use the decoupled response component to perform distributed processing, respond first according to the emergency level, and feedback the results to the front-end service layer, combining cache rules and load state optimization component selection.

Benefits of technology

It realizes efficient and flexible message data processing, improves processing efficiency and resource utilization, ensures priority response to emergencies, and reduces coupling dependence between components.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112559211B_ABST
    Figure CN112559211B_ABST
Patent Text Reader

Abstract

This application relates to the field of data processing, and particularly to a method, device, computer device, and storage medium for updating message data. The method includes: receiving a data processing request initiated by a service component through a message component, determining the request type of the data processing request, and constructing a message queue of the request type; constructing a message event of the data processing request based on the message component and sending the message event to the message queue corresponding to the request type; controlling a response component to obtain the message event from the message queue and respond to the message event, and returning the response result after responding to the message event to the message queue; when the service component monitors the response result in the message queue, obtaining the response result and feeding back the response result to the front-end service layer. Decoupled components are used to implement distributed processing of a large amount of message data, improving the efficiency of message data update.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and particularly to a method, apparatus, computer device, and storage medium for updating message data. Background Art

[0002] With the continuous replacement and iteration of application versions, the data used by the business is constantly evolving. In the face of the increasing amount of data and access volume, the amount of data borne by the backend service is also getting larger and larger. Especially when data needs to be persistently written into the external storage of the server, the hardware and software bottlenecks of a single machine both restrict the upper limit of the access volume of the backend service.

[0003] Currently, the main methods in the industry to cope with the pressure on the backend to write to the database are read-write separation, database sharding, and table partitioning. Although the above methods can relieve the database pressure, they require the introduction of middleware into the system, which introduces instability, and it is not easy to recover data once the middleware fails. Summary of the Invention

[0004] The main objective of this application is to provide a method, apparatus, computer device, and storage medium for updating message data, aiming to solve the problems of low processing efficiency and high database pressure caused by hardware bottlenecks in the processing of message data with an increasing amount of data.

[0005] To achieve the above invention objective, this application proposes a method for updating message data, including the following steps:

[0006] Receive a data processing request initiated by a service component through a message component, determine the request type of the data processing request, and construct a message queue of the request type;

[0007] Construct a message event of the data processing request based on the message component, and send the message event to the message queue corresponding to the request type;

[0008] Control a response component to obtain the message event from the message queue and respond to the message event, and return the response result after responding to the message event to the message queue;

[0009] When the service component monitors the response result in the message queue, obtain the response result and feedback the response result to the front-end service layer.

[0010] Further, after constructing the message event of the data processing request based on the message component and sending the message event to the message queue corresponding to the request type, it further includes:

[0011] Obtain target message events in the message queue sequentially according to a preset caching rule;

[0012] Persistently store the target message event in an external memory.

[0013] Furthermore, the control response component obtains the message event from the message queue, responds to the message event, and returns the response result after responding to the message event to the message queue, including:

[0014] Obtain the load status of several response components;

[0015] Select the response components with a load status lower than the preset value as the target response components;

[0016] Control the target response component to obtain the message event from the message queue, respond to the message event, and return the response result after responding to the message event to the message queue.

[0017] Furthermore, constructing the message event of the data processing request based on the message component and sending the message event to the message queue corresponding to the request type further includes:

[0018] Construct the message event of the data processing request based on the message component, add the corresponding emergency level identifier to the message event, and send the message event with the added emergency level identifier to the message queue corresponding to the request type;

[0019] The control response component obtains the message event from the message queue and responds to the message event, including:

[0020] Control the response component to obtain the message event from the message queue according to the emergency level identifier and respond to the message event.

[0021] Furthermore, after the service component monitors the response result in the message queue, obtains the response result and feeds back the response result to the front-end service layer, it further includes:

[0022] Judge whether the response result is correct to obtain a judgment result;

[0023] Statistically calculate the correct rate of the response component in responding to the message event according to the judgment result.

[0024] Furthermore, after statistically calculating the correct rate of the response component in responding to the message event according to the judgment result, it further includes:

[0025] Obtain the correct rates of the response results of different response components for different types of message events;

[0026] Configure the response components whose accuracy meets the preset requirements as the priority response components for the message events of the corresponding types.

[0027] Further, after the service component monitors the response result in the message queue, obtains the response result and feeds back the response result to the front-end service layer, it further includes:

[0028] Calculate the elapsed time data of the response result;

[0029] Statistically analyze the performance data of the response components for responding to the message events according to the elapsed time data;

[0030] Configure the response components whose performance data meets the preset requirements as the priority response components for the corresponding message events.

[0031] This application also provides an update device for message data, including:

[0032] Message receiving module: used to receive the data processing request initiated by the service component through the message component, determine the request type of the data processing request, and construct a message queue of the request type;

[0033] Event construction module: used to construct a message event of the data processing request based on the message component and send the message event to the message queue corresponding to the request type;

[0034] Execution response module: used to control the response component to obtain the message event from the message queue and respond to the message event, and return the response result after responding to the message event to the message queue;

[0035] Result feedback module: used to obtain the response result and feed back the response result to the front-end service layer when the service component monitors the response result in the message queue.

[0036] This application also provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, it implements the steps of the message data update method described in any one of the above.

[0037] This application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the message data update method described in any one of the above.

[0038] The present application provides a method for implementing distributed message data update by using multiple independent components. By decoupling the front-end business layer of the application from the message processing system, and also decoupling multiple components of the message processing system, the operations of the front-end business layer are obtained through business components, and then data processing requests initiated by the business components are received through message components. Next, the request type of the data processing request is determined, and then message queues corresponding to different request types are created. At the same time, the data processing requests are constructed as message events and message queues, and different types of message events are stored in different message queues, which is convenient for grading different message events. Different response components can respond to different message events in the message queue according to preset rules, especially can give priority to responding to message events with a high emergency level, so as to feedback the response result to the message queue after obtaining the response result, and then the business components obtain the response result from the message queue and feedback it to the front-end business layer. This can maximize the handling of emergency events. At the same time, the operations between different components are no longer coupled, and the work execution between different components does not need to wait for the response of other components to execute, and can quickly process and update a large amount of message data, improve the efficiency of message data processing and update, and at the same time each component can be flexibly started or stopped to improve the utilization rate of resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 is a schematic flowchart of an embodiment of the method for updating message data of the present application;

[0040] Figure 2 is a schematic diagram of an embodiment of the message processing system of the present application;

[0041] Figure 3 is a schematic structural diagram of an embodiment of the device for updating message data of the present application;

[0042] Figure 4 is a schematic block diagram of an embodiment of the structural diagram of a computer device of the present application.

[0043] The implementation, functional features and advantages of the purpose of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0044] In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0045] Refer to Figure 1 , the embodiments of the present application provide a method for updating message data, which at least includes steps S10 - S40. The detailed description of each step of the method for updating message data is as follows.

[0046] S10. Receive a data processing request initiated by a service component through a message component, determine the request type of the data processing request, and construct a message queue of the request type.

[0047] The embodiments of the present application are applied to a message processing system of an application. The message system is composed of several independent functional components, and the message system includes a service component, a message component, and a response component. When a preset operation is performed on the front-end service layer of the application, the search operation includes operations such as performing a search operation, submitting an order operation, a payment operation, and a deletion operation in the application. The operations of the front-end service layer are transmitted to the service component, and the service component initiates a corresponding data processing request. For example, when a user performs a search for a product operation on the front-end service layer of the application, the front-end service layer transmits the search product operation to the service component. Since searching for a product requires querying product information, the service component initiates a corresponding product query request. In the message processing system, the message component receives the data processing request initiated by the service component. These data processing requests include operations for adding, deleting, modifying, and reading the database. When the message component receives the data processing request, it determines the request type of the data processing request. In one implementation, the data processing request is classified according to the operation behavior on the database to determine whether the data processing request is a read data request, a write data request, a modify data request, or a delete data request. In another embodiment, the data processing request is classified according to the source of the data processing request. Then, different message queues are constructed according to different request types to classify the data processing requests.

[0048] S20. Construct a message event of the data processing request based on the message component and send the message event to the message queue corresponding to the request type.

[0049] In this embodiment, after the message component receives the data processing request, it constructs a message event corresponding to the data processing request, and constructs the operation to be executed by the data processing request into a message event. When the data processing request is a read data request, the constructed message event is to read the value of parameter X from the database. When the data processing request is a write data request, another constructed message event is to write the value obtained by adding Y to the value of parameter X into the database. Then, the message event is sent to the message queue corresponding to the request type. The read data request corresponds to the read message queue, and the write data request corresponds to the write message queue. Multiple message events of the same request type can be stored in one message queue to facilitate the distribution of different message events. In this embodiment, by classifying data processing requests differently and sending different data processing requests to different message queues, not only can data processing requests be classified as read requests or write requests according to different operations on data, but also data processing requests can be classified according to different application scenarios. The message events corresponding to the requests of the payment module are classified into the same message queue, and the message events corresponding to the requests of the order module are classified into another message queue. Thus, different classifications of messages can be achieved, and message events can be divided into different emergency levels, facilitating the distributed processing of different messages.

[0050] S30. The control response component obtains the message event from the message queue and responds to the message event, and returns the response result after responding to the message event to the message queue.

[0051] In this embodiment, after the message event is sent to the message queue, the control response component extracts the corresponding message event from the message queue according to the set processing time. In one implementation, a response component extracts one message event from the message queue each time, and then the response component parses the message event to determine what data the message event operates on, so as to respond to the message event to obtain a response result, and then feedback the response result to the message queue. The status of the message event in the message queue is immediately modified, changing the message event from to-be-responded to responded. By modifying the status of the message event, the processing progress of the message event is tracked, facilitating the classification and statistics of message events in the message queue. Further, for different emergency levels of message events, the control response component can preferentially process the message events in the message queue with a higher emergency level according to the level of emergency.

[0052] S40. When the service component monitors the response result in the message queue, it obtains the response result and feeds back the response result to the front-end service layer.

[0053] In this embodiment, after the response component in the message processing system responds to the message event, it feeds back the response result to the message queue. The business component in the message processing system continuously monitors the status of the message event in the message queue. After the status of the message event changes to the responded status, it obtains the response result of the corresponding message event from the message queue, and then feeds back the response result to the front-end business layer. The front-end business layer updates the message data, and the front-end business layer can obtain the result corresponding to the executed operation.

[0054] This embodiment provides a method for implementing distributed message data update by using multiple independent components. By decoupling the front-end business layer of the application from the message processing system, and also decoupling multiple components of the message processing system. The business component obtains the operations of the front-end business layer, and then the message component receives the data processing request initiated by the business component, determines the request type of the data processing request, then creates message queues corresponding to different request types, and at the same time constructs the data processing request as a message event and a message queue, stores different types of message events in different message queues, which is convenient for grading different message events. Different response components can respond to different message events in the message queue according to preset rules, especially can give priority to responding to message events with a high emergency level, so as to obtain the response result and feed it back to the message queue, and then the business component obtains the response result from the message queue and feeds it back to the front-end business layer, which can maximize the handling of emergency events. At the same time, the operations between different components are no longer coupled, and the work execution between different components does not need to wait for the response of other components to execute, and can quickly process and update a large amount of message data, improve the efficiency of message data processing and update, and at the same time each component can be flexibly started or stopped, improving the utilization rate of resources.

[0055] Such as Figure 2The figure shows a working flowchart of the message processing system of the present invention. The message system processes message data in an application. The application also includes a front-end service layer. After the front-end service layer performs an operation, the service component obtains the operation of the front-end service layer and generates a data processing request. The distributed message components (including Message Components 1 and 2) receive the data processing request initiated by the service component. Only one message component is required to receive and process one data processing request. Then, it determines the request type of the data processing request, constructs a message event and a message queue for the data processing request, and stores the message event in the message queue. Different response components can obtain different message events from the message queue according to preset rules and respond. For example, Response Components 1 and 2 only process the message events in Message Queue 1, and Response Component 3 only processes the message events in Message Queue 2. Then, the response results obtained from the response are fed back to the message queue. Then, the service component obtains the response results of the message events that have completed the corresponding response from the message queue and feeds them back to the front-end service layer. The front-end service layer updates the message data according to the response results, thereby obtaining the results corresponding to the executed operation.

[0056] In one embodiment, after constructing the message event of the data processing request based on the message component and sending the message event to the message queue corresponding to the request type, it further includes;

[0057] Sequentially obtain the target message events in the message queue according to preset caching rules;

[0058] Persistently store the target message events in an external memory.

[0059] In this embodiment, to avoid data loss caused by a sudden system crash, the message processing system is configured with disaster recovery measures. Specifically, a message caching policy is formulated in the message component. After sending the message event to the message queue corresponding to the request type, the target message events in the message queue are sequentially obtained according to preset caching rules, and then the target message events are persistently stored in the memory. In one implementation, the message events are sorted according to the time when they are added to the message queue, and the target message events are sequentially selected at preset time intervals, and then the target message events are stored in the memory external to the message processing system to complete the persistence of the message events, avoiding the loss of message data caused by the crash of the message processing system and improving the security of the system. In another implementation, the message events are persistently stored in the external memory in sequence according to the security levels of the message events. Further, the memory corresponds to the classification of the message events. According to the classification of different message events, the message events are persistently stored in the corresponding classified external memory. When searching and retrieving message events subsequently, the required message events can be quickly found from the corresponding memory, improving the data retrieval efficiency.

[0060] In one embodiment, the control response component obtains the message event from the message queue, responds to the message event, and returns the response result after responding to the message event to the message queue, including:

[0061] Obtain the load status of several response components;

[0062] Select the response component with a load status lower than the preset value as the target response component;

[0063] Control the target response component to obtain the message event from the message queue, respond to the message event, and return the response result after responding to the message event to the message queue.

[0064] In this embodiment, the response components are deployed distributively on different nodes. Different nodes have different processing resources, and the resources occupied by different nodes at the current time are also different. When it is necessary for the response components to respond to message events, by obtaining the load status of the response components of several different nodes, and then selecting the response components with a load status lower than the preset value as the target response components, and then controlling the target response components to obtain the message events from the message queue and respond to the message events, and returning the response results after responding to the message events to the message queue. The response components with a lower current load are preferentially used to respond to message events, avoiding the phenomenon that the response components of the same node process too many message events at the same time, resulting in excessive load and untimely response, so as to process message events with the maximum concurrency and improve the processing efficiency of message events.

[0065] In one embodiment, constructing the message event of the data processing request based on the message component and sending the message event to the message queue corresponding to the request type further includes:

[0066] Constructing the message event of the data processing request based on the message component, adding a corresponding emergency level identifier to the message event, and sending the message event with the added emergency level identifier to the message queue corresponding to the request type;

[0067] The controlling the response component to obtain the message event from the message queue and respond to the message event includes:

[0068] Controlling the response component to obtain the message event from the message queue according to the emergency level identifier and respond to the message event.

[0069] In this embodiment, after the message component receives the data processing request, it constructs the message event corresponding to the data processing request, and at the same time adds a corresponding emergency level identifier to the implementation message event according to the information of the data processing request. That is, in this embodiment, different data processing requests have different emergency levels. The higher the emergency level of the data processing request, the more urgently the data processing request needs to be processed. After adding the corresponding emergency level identifier to the message event, the message event with the added emergency level identifier is sent to the message queue corresponding to the request type. At this time, different message events in the message queue have different emergency levels. When the subsequent response component processes the message event, it controls the response component to obtain the message event from the message queue according to the emergency level identifier, preferentially controls the response component to obtain the message event with a high emergency level, and responds to the message event, ensuring that the data processing request with a high emergency level can be processed preferentially and ensuring the security of the system.

[0070] In one embodiment, after the service component monitors the response result in the message queue, obtains the response result, and feeds back the response result to the front-end service layer, the following steps are further included:

[0071] Determine whether the response result is correct to obtain a determination result;

[0072] According to the determination result, count the correct rate of the response component in response to the message event;

[0073] Configure the response component whose correct rate meets the preset requirements as the preferred response component for the corresponding message event.

[0074] In this embodiment, the logical configurations of each response component in the message processing system are the same, but it cannot be guaranteed that the deployment environments of different response components are the same, which may lead to incorrect response results generated by the response components when processing message events. After obtaining the response result and feeding back the response result to the front-end service layer, the front-end service layer realizes the update of message data. After each response result is obtained, it is judged whether the response result is correct. The correctness of the response result can be judged based on the error value between the response result and the expected result. If the error value is within the range of the standard error value, it can be determined that the response result is correct. When multiple different response components obtain determination results for the message event, and then count the determination results, the correct rate of the response component in processing the message event can be counted, which is convenient for maintaining the response component with a too low correct rate due to incorrect response results, thereby improving the maintenance efficiency of the response component.

[0075] In one embodiment, after counting the correct rate of the response component in response to the message event according to the determination result, the following steps are further included:

[0076] Obtain the correct rates of the response results of different response components for different types of message events;

[0077] Configure the response component whose correct rate meets the preset requirements as the preferred response component for the corresponding type of message event.

[0078] In this embodiment, based on the above embodiment where the correct rate of the response component responding to the message event is statistically calculated according to the judgment result, the correct rate of the response results of different response components for different types of message events can be statistically calculated, that is, the correct rate of the response results of different response components for different types of message events is obtained. Then, the response component whose correct rate meets the preset requirements is used as the preferred response component for the corresponding type of message event. When the message event of this type appears subsequently, the preferred response component is controlled to process the message event of this type. In one implementation manner, three response components A, B, and C all process the message event of the X type operation request. Among the judgment results obtained by the three response components A, B, and C, the correct rate of the response component A processing the message event of the X type operation request is higher than that of the response components B and C. The response component A is configured as the preferred response component for the message event of the X type operation request. When the message event of the X type operation request appears subsequently, the response component A is preferentially controlled to respond to the message event, thereby improving the correct rate of responding to the message event.

[0079] In one embodiment, after the service component monitors the response result in the message queue, obtains the response result, and feeds back the response result to the front-end service layer, it further includes:

[0080] Calculating the elapsed time data of the response result;

[0081] Statistically calculating the performance data of the response component responding to the message event according to the elapsed time data;

[0082] Configuring the response component whose performance data meets the preset requirements as the preferred response component for the message event.

[0083] In this embodiment, the logical configurations of each response component in the message processing system are the same, but it cannot be guaranteed that the deployment environments of different response components are the same, which may result in different elapsed time data for the response components to process message events. After obtaining the response result and feeding back the response result to the front-end service layer, the front-end service layer realizes the update of the message data, calculates the elapsed time data of the response result, statistically calculates the performance data of the response component responding to the message event according to the elapsed time data, statistically calculates the performance data of the response component according to multiple elapsed time data, configures the response component whose performance data meets the preset requirements as the preferred response component for the message event, and when the message event appears subsequently, controls the preferred response component to process the message event, and preferentially responds to the message event with the response component having the highest performance data, thereby improving the efficiency of message event processing.

[0084] Referring to Figure 3 , this application also provides an update device for message data, including:

[0085] Message receiving module 10: It is used to receive the data processing request initiated by the service component through the message component, determine the request type of the data processing request, and construct a message queue of the request type;

[0086] Event construction module 20: It is used to construct a message event of the data processing request based on the message component, and send the message event to the message queue corresponding to the request type;

[0087] Execution response module 30: It is used to control the response component to obtain the message event from the message queue and respond to the message event, and return the response result after responding to the message event to the message queue;

[0088] Result feedback module 40: It is used to obtain the response result and feedback the response result to the front-end service layer when the service component monitors the response result in the message queue.

[0089] As described above, it can be understood that each component of the message data update device proposed in this application can implement the step functions of any of the above-mentioned message data update methods.

[0090] In one embodiment, the event construction module 20 further includes performing:

[0091] Obtain the target message events in the message queue in sequence according to the preset caching rule;

[0092] Persistently store the target message events in an external memory.

[0093] In one embodiment, the execution response module 30 further includes performing:

[0094] Obtain the load status of several response components;

[0095] Select the response component with a load status lower than the preset value as the target response component;

[0096] Control the target response component to obtain the message event from the message queue and respond to the message event, and return the response result after responding to the message event to the message queue.

[0097] In one embodiment, the event construction module 20 further includes performing:

[0098] Construct a message event of the data processing request based on the message component, add a corresponding emergency level identifier to the message event, and send the message event with the added emergency level identifier to the message queue corresponding to the request type;

[0099] The execution response module 30 further includes performing:

[0100] The control response component obtains the message event from the message queue according to the emergency level identifier, and responds to the message event.

[0101] In one embodiment, the device further includes:

[0102] The correct rate statistics module: used to judge whether the response result is correct to obtain a judgment result; and statistically calculate the correct rate of the response component in responding to the message event according to the judgment result.

[0103] In one embodiment, the correct rate statistics module further includes performing:

[0104] Obtaining the correct rates of response results of different response components to different types of message events;

[0105] Configuring the response components whose correct rates meet the preset requirements as the preferred response components for the corresponding types of message events.

[0106] In one embodiment, the device further includes:

[0107] The performance data statistics module, which is used to calculate the time-consuming data of the response result; statistically calculate the performance data of the response component in responding to the message event according to the time-consuming data; and configure the response components whose performance data meet the preset requirements as the preferred response components for the corresponding message events.

[0108] Refer to Figure 4 , in the embodiments of the present application, a computer device is further provided. The computer device may be a mobile terminal, and its internal structure may be as Figure 4 shown. The computer device includes a processor, a memory, a network interface, a display device, and an input device connected through a system bus. Among them, the network interface of the computer device is used to communicate with an external terminal through a network connection. The display device of the computer device is used to display an interactive interface. The input device of the computer device is used to receive user input. The processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium. The non-volatile storage medium stores an operating system, a computer program, and a database. When the computer program is executed by the processor, a method for updating message data is implemented.

[0109] The above-mentioned processor executes the above-mentioned method for updating message data, which includes: receiving a data processing request initiated by a service component through a message component, determining the request type of the data processing request, and constructing a message queue for the request type; constructing a message event for the data processing request based on the message component, and sending the message event to the message queue corresponding to the request type; controlling a response component to obtain the message event from the message queue and respond to the message event, and returning the response result after responding to the message event to the message queue; when the service component monitors the response result in the message queue, obtaining the response result and feeding back the response result to the front-end service layer. The computer device can provide a method for implementing distributed message data update by using multiple independent components. By decoupling the front-end service layer of the application from the message processing system, and also decoupling multiple components of the message processing system, the operation of the front-end service layer is obtained through the service component, then the data processing request initiated by the service component is received through the message component, then the request type of the data processing request is determined, and then message queues corresponding to different request types are created. At the same time, the data processing request is constructed as a message event and a message queue, and different types of message events are stored in different message queues, which is convenient for grading different message events. Different response components can respond to different message events in the message queue according to preset rules, especially can give priority to responding to message events with a high emergency level, so as to obtain the response result and feed it back to the message queue, and then the service component obtains the response result from the message queue and feeds it back to the front-end service layer, which can maximize the satisfaction of handling emergency events. At the same time, the operations between different components are no longer coupled, and the work execution between different components does not need to wait for the response of other components before it can be executed. It can quickly process and update a large amount of message data, improve the efficiency of message data processing and update, and at the same time, each component can be flexibly started or stopped, improving the utilization rate of resources.

[0110] The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, a method for updating message data is implemented, including the steps of: receiving a data processing request initiated by a service component through a message component, determining the request type of the data processing request, and constructing a message queue of the request type; constructing a message event of the data processing request based on the message component, and sending the message event to the message queue corresponding to the request type; controlling a response component to obtain the message event from the message queue and respond to the message event, and returning a response result after responding to the message event to the message queue; when the service component monitors the response result in the message queue, obtaining the response result and feeding back the response result to the front-end service layer. The computer device provides a method for implementing distributed message data update by using multiple independent components. By decoupling the front-end service layer of the application from the message processing system, and decoupling multiple components of the message processing system as well. The operation of the front-end service layer is obtained through the service component, then the data processing request initiated by the service component is received through the message component, then the request type of the data processing request is determined, and then message queues corresponding to different request types are created. At the same time, the data processing request is constructed as a message event and a message queue, and different types of message events are stored in different message queues, which is convenient for classifying different message events by level. Different response components can respond to different message events in the message queue according to preset rules, especially can give priority to responding to message events with a high emergency level, so as to obtain a response result and then feedback it to the message queue, and then the service component obtains the response result from the message queue and feeds it back to the front-end service layer, which can maximize the satisfaction of handling emergency events. At the same time, the operations between different components are no longer coupled, and the work execution between different components does not need to wait for the response of other components to execute, and a large amount of message data can be processed and updated quickly, improving the efficiency of message data processing and update. At the same time, each component can be flexibly started or stopped, improving the utilization rate of resources.

[0111] Those of ordinary skill in the art can understand that to implement all or part of the processes in the above method embodiments, it can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium provided in this application and used in the embodiments can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0112] It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, apparatus, article, or method including such element.

[0113] The above are only the preferred embodiments of this application, and do not limit the patent scope of this application. Any equivalent structural or equivalent process transformation made using the specification and drawings of this application, or directly or indirectly applied in other related technical fields, shall equally be included in the patent protection scope of this application.

Claims

1. A method for updating message data, characterized in that include: Receiving data processing requests initiated by business components through message components, determining the request type of the data processing requests, and constructing message queues of the request types; wherein the data processing requests are classified according to the operation behavior on the database to determine whether the data processing requests are read data requests, write data requests, modify data requests, or delete data requests; or the data processing requests are classified according to the source of the data processing requests; and then constructing different message queues according to different request types to classify the data processing requests; Constructing a message event of the data processing request based on the message component, and sending the message event to a message queue corresponding to the request type; Controlling the response component to obtain the message event from the message queue and respond to the message event, and returning the response result after responding to the message event to the message queue, and correspondingly modifying the status of the message event in the message queue, modifying the message event from pending response to responded, and tracking the processing progress of the message event by modifying the status of the message event; When the business component monitors the response result in the message queue, it obtains the response result and feeds the response result back to the front-end business layer; After constructing the message event of the data processing request based on the message component and sending the message event to the message queue corresponding to the request type, the method further includes: Obtain target message events in the message queue in sequence according to preset cache rules; The target message event is persistently stored in an external memory, including sorting the message events according to the time when the message events are added to the message queue, selecting the target message events in sequence at preset time intervals, and then storing the target message events in a memory external to the message processing system, wherein the memory corresponds to the classification of the message event, and according to the classification of different message events, the message events are persistently stored in the external memory of the corresponding classification.

2. The method for updating message data according to claim 1, wherein The control response component obtains the message event from the message queue and responds to the message event, and returns the response result after responding to the message event to the message queue, including: Get the load status of several response components; Selecting a response component whose load state is lower than a preset value as a target response component; The target response component is controlled to obtain the message event from the message queue and respond to the message event, and return the response result after responding to the message event to the message queue.

3. The method for updating message data according to claim 1, wherein, The step of constructing a message event of the data processing request based on the message component and sending the message event to a message queue corresponding to the request type further includes: Constructing a message event of the data processing request based on the message component, adding a corresponding emergency level identifier to the message event, and sending the message event with the added emergency level identifier to the message queue corresponding to the request type; The control response component obtains the message event from the message queue and responds to the message event, including: The control response component obtains the message event from the message queue according to the emergency level identifier and responds to the message event.

4. The method for updating message data according to claim 1, wherein After the service component obtains the response result in the message queue and feeds the response result back to the front-end service layer when it monitors the response result, it further includes: Judging whether the response result is correct to obtain a judgment result; Counting the correct rate of the response component in responding to the message event according to the judgment result.

5. The method for updating message data according to claim 4, wherein After counting the correct rate of the response component in responding to the message event according to the judgment result, it further includes: Obtaining the correct rate of the response results of different response components for different types of message events; Configuring the response components whose correct rate meets the preset requirements as the preferred response components for the corresponding types of message events.

6. The method for updating message data according to claim 1, wherein: After the service component obtains the response result in the message queue and feeds the response result back to the front-end service layer when it monitors the response result, it further includes: Calculating the elapsed time data of the response result; Counting the performance data of the response component in responding to the message event according to the elapsed time data; Configuring the response components whose performance data meets the preset requirements as the preferred response components for the corresponding message events.

7. An update device for message data, which is used to execute the method described in any one of claims 1-6, characterized in that It includes: Message receiving module: used to receive the data processing request initiated by the service component through the message component, determine the request type of the data processing request, and construct a message queue of the request type; Event construction module: used to construct a message event of the data processing request based on the message component and send the message event to the message queue corresponding to the request type; Execution response module: used to control the response component to obtain the message event from the message queue and respond to the message event, and return the response result after responding to the message event to the message queue; Result feedback module: used to obtain the response result and feed the response result back to the front-end service layer when the service component monitors the response result in the message queue.

8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the message data update method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the message data update method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Queue-based service request asynchronous processing method and device

    CN111104235A