Application service management method, system, and computer device and storage medium

By querying the storage partition corresponding to the topic of the application service to be processed in the message middleware, sending it to the consumer and storing it in the cache device, and combining timers and compensation mechanisms, the problem of application service loss in the message middleware under network jitter or queue downtime is solved, thus improving the performance and reliability of the system.

CN117708144BActive Publication Date: 2026-11-27INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311488532.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-09
Publication Date
2026-11-27
Estimated Expiration
2043-11-09

Smart Images

  • Figure CN117708144B_ABST
    Figure CN117708144B_ABST
Patent Text Reader

Abstract

The application relates to an application service management method and system, computer equipment and a storage medium. The method comprises the following steps: in response to receiving an application service processing request sent by a consumer end, the application service processing request comprising a subject of an application service to be processed; querying the application service to be processed stored in a storage partition corresponding to the subject of the application service to be processed, and sending the application service to be processed in the queried storage partition to a corresponding consumer end, so that the consumer end consumes the application service to be processed, and the application service to be processed consumed by the consumer end is deleted from the storage partition; storing the application service to be processed in the storage partition in a first cache area of a cache device; in response to a timing device meeting a preset condition, receiving the application service to be processed stored in the first cache area, and updating the application service of the storage partition; and the method can improve the performance of an application service management system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of application service management technology, and in particular to an application service management method, system, computer device, and storage medium. Background Technology

[0002] Message middleware, as a component for peak shaving and asynchronous processing, has been widely used in various application systems. However, as an independent component separate from application systems and databases, message middleware is susceptible to issues such as loss of sending and processing application services due to network jitter or message queue downtime. This can lead to inconsistencies in business data and technical problems that disrupt application system functionality. Summary of the Invention

[0003] Therefore, it is necessary to provide an application service management method, system, computer equipment, and storage medium that can improve the performance of the management system in response to the above-mentioned technical problems.

[0004] To address the aforementioned technical problems, firstly, an application service management method is provided, the method comprising:

[0005] In response to receiving an application service processing request from the consumer, the application service processing request includes the topic of the application service to be processed;

[0006] Query the application services to be processed stored in the storage partition corresponding to the topic of the application service to be processed, send the application services to be processed in the queried storage partition to the corresponding consumer so that the consumer can consume the application services to be processed, and delete the application services to be processed consumed by the consumer from the storage partition.

[0007] The application services to be processed in the storage partition are stored in the first cache area of ​​the cache device; in response to the timing device meeting the preset conditions, the application services to be processed stored in the first cache area are received, and the application services in the storage partition are updated.

[0008] In one embodiment, the method further includes:

[0009] Obtain the data source, which includes multiple application services;

[0010] Based on the application service processing request, select the application service to be processed corresponding to the topic in the application service processing request from the data source;

[0011] Write the application services to be processed into the message queue, and determine whether the application services to be processed written into the message queue are complete;

[0012] When the pending application services written to the message queue are incomplete, the application service compensation mechanism is triggered to compensate the pending application services in the message queue.

[0013] In one embodiment, the method further includes:

[0014] Store multiple application services from the data source in the second cache area of ​​the cache device;

[0015] Determine whether the application service to be processed stored in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0016] When it is determined that the pending application service stored in the storage partition corresponding to the topic in the application service processing request has been consumed, the pending application service to be consumed is deleted from the storage partition.

[0017] The storage device sends the consumed application services stored in the second cache to the first cache for storage.

[0018] In one embodiment, after sending the application services to be processed in the queried storage partition to the corresponding consumer, the process includes:

[0019] Determine whether the application service to be processed in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0020] When it is determined that the application service to be processed in the storage partition corresponding to the topic in the application service processing request has not been consumed, a mark is added to the application service to be processed in the storage partition that has not been consumed, and the application service to be processed carrying the mark is obtained.

[0021] The pending application service carrying the tag will be resent to the corresponding consumer.

[0022] Once a tagged pending application service is consumed, the consumed tagged pending application service will be deleted from the storage partition.

[0023] The consumed, tagged, pending application services stored in the second cache area of ​​the storage device are sent to the first cache area for storage.

[0024] In one embodiment, in response to the timing device meeting a preset condition, receiving the application service stored in the first cache and updating the application service in the storage partition includes:

[0025] In response to the timing device meeting the preset conditions, the application service stored in the first cache is read and the application service stored in the first cache is encapsulated to obtain the encapsulated application service.

[0026] The encapsulated application service is sent to the server. The server receives the encapsulated application service and persists it to the message queue.

[0027] In one embodiment, the timing device is a timer, and the method further includes:

[0028] The timer includes a timing function, which releases a control signal at regular intervals.

[0029] In response to receiving a control signal, the cache device sends the application services to be processed stored in the first cache area to the storage partition in the message queue for storage, and updates the application services in the storage partition.

[0030] In one embodiment, the timer includes a first timer and a second timer. The first timer includes a timing function. In response to a release signal from the first timer, the second timer receives the release signal, initializes the execution task, and registers the execution period and the callback function corresponding to the execution task in the registry of the second timer.

[0031] To address the aforementioned technical problems, a second aspect provides an application service management system, the apparatus comprising:

[0032] Server-side equipment is used to provide data sources and send them to message middleware;

[0033] The message middleware communicates with the server. It receives data sources from the server and application service processing requests from the consumer. It also queries the storage partition corresponding to the topic of the application service to be processed and sends the queryed application services in the storage partition to the corresponding consumer. Finally, it deletes the application services consumed by the consumer from the storage partition.

[0034] The consumer device communicates with the message middleware and is used to receive application services to be processed sent by the message middleware and to consume the application services to be processed.

[0035] A timing device used to perform timed tasks;

[0036] A caching device is used to receive application services to be processed stored in the first cache area and update the application services in the storage partition when the timing device meets preset conditions.

[0037] To address the aforementioned technical problems, a third aspect provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: when the processor executes the computer program, it performs the steps of the method described in the first aspect.

[0038] In order to solve the above-mentioned technical problems, in a fourth aspect, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the first aspect.

[0039] Unlike existing technologies, this invention provides an application service management method comprising: responding to receiving an application service processing request sent by a consumer, the application service processing request including the topic of the application service to be processed; querying the application services to be processed stored in the storage partition corresponding to the topic of the application service to be processed, sending the queryed application services to be processed in the storage partition to the corresponding consumer so that the consumer can consume the application services to be processed, and simultaneously storing the application services to be processed in the storage partition in the first cache area of ​​the cache device; responding to the timing device meeting a preset condition, receiving the application services to be processed stored in the first cache area, and updating the application services in the storage partition. This improves the integrity of application services stored in the message middleware, and enhances the performance of the application service management system. Attached Figure Description

[0040] Figure 1 A schematic diagram of the existing application service management system structure;

[0041] Figure 2 This is a flowchart illustrating the application service management method in one embodiment;

[0042] Figure 3 This is a schematic diagram of the application service management system in another embodiment;

[0043] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0045] like Figure 1As shown, in existing distributed service application architectures, applications are deployed on different servers. These applications require a service management center (management center) for management, essentially a service registration and discovery mechanism. Each application service first registers its service information with the management center. Service consumers store this information in their local memory. When they need to access other services, they locate the corresponding application service by the desired service name and access the service through a remote call.

[0046] However, when the service information of the application service in the management center changes, it is also necessary to push the application service to the service consumer connected to the management center. As described above, the management center can store service registration information registered by clients, clients can retrieve service registration information from the management center, and the management center can push registration information to the server.

[0047] pass Figure 1 The application service management system shown has a similar structure to a message queue (MQ), including service providers (application service providers), a registry to store application services, and service consumers that retrieve application services from the registry. However, in a message queue, after an application service is sent to its server, it is sent based on the consumer's registration information. If a consumer consumes an application service, the message queue deletes that information to prevent duplicate consumption. Therefore, directly using a message queue as the management center makes it difficult to achieve the functionality of a management center.

[0048] To address the aforementioned technical problems, this invention provides an application service management method, such as... Figure 2 As shown, the method specifically includes the following steps:

[0049] Step 201: In response to receiving an application service processing request sent by the consumer, the application service processing request includes the topic of the application service to be processed.

[0050] Step 202: Query the application services to be processed stored in the storage partition corresponding to the topic of the application service to be processed, send the application services to be processed in the queried storage partition to the corresponding consumer so that the consumer can consume the application services to be processed, and delete the application services to be processed consumed by the consumer from the storage partition.

[0051] Specifically, before the message middleware receives the consumption processing request sent by the consumer, it also includes: obtaining the data source, which includes multiple application services; selecting the application service to be processed from the data source based on the application service processing request; and writing the application service to be processed into the message queue.

[0052] Optionally, the data source includes a large amount of data used for subsequent data processing. A single piece of data in the data source can represent an application service, and a data source is also referred to as a business scenario. The data source is not limited to various text data. The data source can be accessed through message queues or by calling external interfaces.

[0053] For example, the server-side device obtains the data source and sends it to the message middleware. The message middleware receives the data source and persists multiple application services from the data source to a specific storage domain in the message queue. Then, it calls the application services stored in that storage domain for subsequent application service processing. The message middleware can be one of JMS, Kafka, RocketMQ, AMQP, RabbitMQ, ActiveMQ, or Pulsar. Preferably, the message middleware used in this invention is RocketMQ. RocketMQ is a low-latency, high-concurrency, high-availability, and highly reliable distributed message middleware donated by Alibaba to Apache. It has withstood the test of Taobao's Double Eleven shopping festival. RocketMQ provides asynchronous decoupling and peak shaving capabilities for distributed application systems, while also possessing the characteristics required for massive application service backlogs, high throughput, and reliable retries required by internet applications.

[0054] It is understood that, and it should be noted, in this embodiment, there are multiple consumer terminals, which may belong to different consumer groups. Consumer terminals in the same consumer group subscribe to the same topic, and each consumer terminal receives a portion of the application services in each topic.

[0055] Optionally, topics can be partitioned, and each consumer can receive application services from data in each storage partition of each topic. It is important to note that the number of consumers created should not exceed the number of storage partitions in each topic, ensuring that each consumer can consume application services and preventing idle consumers that would waste resources.

[0056] In one embodiment, the present invention further includes determining whether the application service to be processed written in the message queue is complete; when the application service to be processed written in the message queue is incomplete, an application service compensation mechanism is triggered to compensate the application service to be processed in the message queue.

[0057] Because message queue (MQ) systems like RabbitMQ and RocketMQ are used for asynchronous processing, while application services (events) can be persisted to disk and data won't be lost even if the MQ fails, application service data loss can still occur during the sending, transmission, and processing stages of the asynchronous process. Furthermore, no MQ middleware can guarantee 100% availability, and the continuation of the asynchronous process in case of unavailability needs to be considered. Therefore, for asynchronous processing, compensation or a primary / backup active-active process must be considered. Based on this, this invention sets up an application service compensation mechanism. When an application service written to the message queue is incomplete, the application service compensation mechanism is triggered to compensate for the application service written to the message queue. The application service compensation mechanism can resend the application service until it is fully persisted to the message queue. By compensating for the application service persisted to the message queue through the application service compensation mechanism, it is ensured that all application services sent by the receiving server device are stored in the message queue, thereby improving the reliability of the application service management system.

[0058] Once an application service is written into the message queue, the message middleware can receive application service processing requests sent by the consumer. Based on the application service processing requests, it can retrieve the application services that the consumer needs to process from the message queue stored in the message middleware.

[0059] Specifically, the message middleware receives the consumption processing request sent by the consumer, parses the consumption processing request, obtains the topic information of the application service to be processed contained in the consumption processing request, that is, the location information of the application service to be processed stored in the message middleware, queries the message middleware for the application service to be processed stored in the storage partition corresponding to the topic of the application service to be processed, and sends the application service to be processed in the queried storage partition to the corresponding consumer. The consumer device receives the application service to be processed and consumes it.

[0060] For example, when a consumer consumes an application service, it first generates registration information in the message middleware to notify the message middleware that the consumer needs to consume the application service. At this time, after receiving the registration information, the message middleware traverses the message middleware to query the location of the registration information and sends the application service at the location of the registration information to the consumer corresponding to the registration information, so that the consumer can consume the application service.

[0061] In one feasible implementation, the message middleware can also obtain the application service processing format of the consumer corresponding to the consumption processing request, determine whether the application service processing format of the consumer corresponding to the application service processing request is consistent with the application service format of the application service to be processed stored in the message queue corresponding to the application service processing request, and when the application service processing format of the consumer corresponding to the application service processing request is inconsistent with the application service format of the application service to be processed stored in the message queue corresponding to the application service processing request, the application service format of the application service to be processed can be converted so that the application service format of the application service to be processed is consistent with the application service processing format of the consumer.

[0062] For example, the application service processing format of the consumer can be used as the target application service format. Based on the target application service format and the application service format of the application service to be processed, a predefined application service format conversion rule table can be searched to determine the target conversion path of the application service to be processed. Based on the target conversion path, the application service format of the application service to be processed can be converted into the target application service format.

[0063] For example, the application service format of the application service to be processed can be any of the existing JSON format application service protocol types, or it can be a user-defined application service type. This application embodiment does not impose any special limitations on this. An application service may include one or more field types selected from objects, arrays, strings, numbers, and boolean values ​​in JSON format.

[0064] In this context, a field is a variable that represents an object or class. Each field consists of several data items of the same type, divided according to certain boundaries. Each data item contains a data type and data. Data types include objects, arrays, numbers, strings, and booleans. For example, an application service to be processed can be parsed into fields composed of multiple data items. For instance, the application service content of application service A contains fields composed of data items such as objects, arrays, and booleans.

[0065] In this embodiment, a conversion rule can be generated for every two application service formats based on the relationship between them. This can also be understood as a conversion formula. The conversion formula between different application service formats is stored as an application service format conversion rule table.

[0066] In this embodiment, the operator can input the application service to be converted in the output window of the electronic device's display interface. The server can then obtain the user's application service conversion request through the network and extract the field types and field contents of the application service to be converted from the application service conversion request.

[0067] Define the framework (conversion rules) of the target format application service according to the application service processing format of the consumer, and fill in the field types and field contents of the application service to be processed according to the format framework of the target application service. In this way, the application service processing format of the consumer corresponding to the consumption processing request is consistent with the application service format of the application service to be processed stored in the message queue, realizing the conversion of arbitrary application service formats between server devices and consumer devices with different application service processing formats, and achieving decoupling between systems.

[0068] In one feasible implementation, each application service can be assigned a unique tag. In this way, by searching for the unique tag of the application service to be converted, the application service to be converted can be quickly located from multiple application services. The unique tag can be a number, letter, or symbol.

[0069] In one implementation, after the server device successfully sends multiple application services from the data source to the message queue, it can trigger the corresponding application by listening to the application services and store the server's application services in memory. Thus, when access to the server's services is needed, the consumer only needs to read the server's application services from memory and then perform remote access.

[0070] In one implementation, before sending the data source to the message middleware, the data source can be stored in a second cache area of ​​a caching device. The caching device can be a server or other device with storage capabilities, and the second cache area can be an application Redis cache area. Backing up the data source to the second cache area of ​​the caching device is to prevent the application service sent to the message queue by the server from being lost. Compared to directly backing up the business application service to the database, Redis caching offers higher read and write efficiency, reduces database transaction waiting time, and thus improves the overall performance of the application system.

[0071] After backing up the data source, multiple application services in the data source can be sent to a message queue for asynchronous processing of subsequent processes. Multiple application services in the data source can be configured to be sent to the message queue only if they are successfully backed up in the second buffer of the caching device. This can prevent the inconsistency of data status caused by application service failure in the data source but application service status showing successful sending.

[0072] In one specific implementation, the application service management method further includes determining whether the application service to be processed stored in the storage partition corresponding to the topic in the application service processing request has been consumed; when it is determined that the application service to be processed stored in the storage partition corresponding to the topic in the application service processing request has been consumed, the consumed application service to be processed is deleted from the storage partition; the storage device obtains the consumed application service to be processed and sends it to the first cache for storage.

[0073] Optionally, the consumption status of pending application services in the message queue can be monitored in real time. Consumption status is divided into two states: successful consumption and failed consumption. Successful consumption means that the pending application service stored in the storage partition corresponding to the topic in the application service processing request has been consumed; failed consumption means that the pending application service stored in the storage partition corresponding to the topic in the application service processing request has not been consumed. It can be understood that the prerequisite for determining the consumption status here is that the message middleware has already sent the pending application service stored in the storage partition corresponding to the topic in the application service processing request to the corresponding consumer.

[0074] If the pending application service is updated to "consumption successful" in the message queue status, the pending application service that has been consumed in the message queue is deleted, and the consumed pending application service is stored in the first cache area of ​​the cache device. The first cache area can be the MQSOL database.

[0075] Because message brokers remove consumed application services from their local storage, they also remove previously consumed application services from their storage partitions. This can lead to a situation where new consumers cannot retrieve previously consumed application services from the message queue, preventing them from receiving complete information from the data source and thus hindering their access to the server. This invention addresses this by storing consumed application services in a first cache area of ​​a caching device. Subsequently, these consumed application services stored in the first cache area can be resent to the message queue and persisted there.

[0076] When the consumption status of a pending application service in the message queue that has already been consumed is updated to consumption failure, a mark is added to the pending application services in the unconsumed storage partition to obtain the pending application services carrying the mark; the pending application services carrying the mark are then resent to the corresponding consumer.

[0077] Once a tagged application service is consumed, it is deleted from the storage partition. The storage device retrieves the consumed tagged application service and sends it to the first cache for storage. The preset tagged information here can be a label, which can record the number of failed consumption attempts for the application service.

[0078] It should be noted that the failure to consume pending application services is a common scenario that may require manual intervention. Therefore, the failed pending application services are backed up to the cache device to facilitate subsequent operation and maintenance such as querying, updating, and retrying.

[0079] When the number of failed consumption attempts displayed on the preset marker reaches a preset threshold, an email alert mechanism can be triggered. It should be noted that when the number of failed consumption attempts for a pending application service reaches the preset threshold, it means that the system's automatic resending of the application service is ineffective. The email alert mechanism needs to be triggered to notify the operations and maintenance personnel of the anomaly of the failed pending application service, thereby ensuring that the failed pending application service can eventually be processed successfully, ensuring the consistency of application system data, and avoiding omissions.

[0080] Step 203: Store the application services to be processed in the storage partition in the first cache area of ​​the cache device; in response to the timing device meeting the preset conditions, receive the application services to be processed stored in the first cache area and update the application services in the storage partition.

[0081] Specifically, in response to the timing device meeting the preset conditions, the message middleware reads the application service stored in the first cache area, encapsulates the application service stored in the first cache area to obtain the encapsulated application service; and sends the encapsulated application service to the server of the message middleware. The server receives the encapsulated application service and persists the encapsulated application service to the application service queue.

[0082] Optionally, a scheduled task can be configured for the timing device. The system determines whether the timing device meets the preset conditions of the scheduled task. The timing device can be a timer, specifically a Quartz timer. Quartz is an open-source task scheduling framework written entirely in Java. It uses triggers to set rules for scheduled job execution and control job execution time. The Quartz cluster provides high availability and scalability to the scheduler through failover and load balancing. It is primarily used to execute scheduled tasks, such as sending information or generating reports on a schedule.

[0083] The preset condition can be a certain time interval, and the duration of the interval can be set according to the actual situation.

[0084] For example, the preset condition could be a time interval of every minute or every half minute. When the preset condition is met, the message middleware will retrieve the application services stored in the first cache area of ​​the caching device and encapsulate the application services stored in the first cache area. The application services here include information such as the access address of the application services. The encapsulated application services are then sent to the server side of the message middleware. Here, the server side of the message middleware acts as a server-side device. The server side receives the encapsulated application services sent by the server side of the message middleware and sends them to the receiving end of the message middleware. The receiving end receives the encapsulated application services sent by the server side of the message middleware, parses the encapsulated application services, and persists the parsed application services to the application service queue.

[0085] In one embodiment, the timer of this application may include a first timer and a second timer. A function is registered in the first timer. In response to the release signal of the first timer, the second timer is initialized to execute a task upon receiving the release signal. The execution period and the callback function corresponding to the execution task are registered in the registry of the second timer.

[0086] In practical applications, if there is only one timer and it is frequently invoked, the timer's accuracy will decrease. By setting a second timer, the task executed by the second timer is initialized, and the application service, timing period, and corresponding callback function information of the timer task are registered in the second timer's registry. When the second timer acquires a semaphore released by the first timer, the semaphore triggers the second timer. The second timer then queries the registry of its own timer to check the requirements for executing the timer task and determines whether the preset conditions are met. If the preset conditions are met, the corresponding callback function of the task is invoked.

[0087] In one feasible implementation, when initializing the tasks to be executed by the second timer, to ensure the normal operation of the first timer, the priority of the tasks to be executed by the second timer can be set to be lower than the priority of the tasks to be executed by the first timer. If the first timer is implemented by a task, then when starting the task of the second timer, a lower priority is set for its implementation. This not only ensures the execution of high-priority tasks, but also ensures that no matter how many times the second timer is called or used, or even if it crashes, the accuracy of the first timer will not be affected. Therefore, this priority setting is more conducive to ensuring the normal operation of the first timer.

[0088] To address the data loss issue in application service management, this invention incorporates a timer device. This timer device can read consumed application services from the first buffer of the caching device and, as the service provider, send these consumed application services to the message middleware receiver. Upon receiving the consumed application services, the message middleware persists them to the message queue and sends them as new tasks to the corresponding consumer, thus ensuring that the consumer receives the latest application services.

[0089] It should be noted that the message middleware in this application can achieve the functions of a "registration center", that is, it can be responsible for service registration and discovery. When a service starts, it registers an information node in the message middleware. This information node can include the node address (service IP address, port information, etc.) and periodically sends heartbeats to the registration center. When other services need to call this service, they can obtain the service information by querying the message middleware, thereby realizing service invocation and discovery.

[0090] Specifically, the message middleware in this application allows other applications to register information nodes on the message middleware. When a client needs to obtain information from any application, it can access that application's information by retrieving the application's registered information node on the message middleware. For example, the server first registers at least one information node on the message middleware. Each information node includes a node address (service IP address, port information, etc.). When a consumer needs information from the server, the message middleware iterates through the registered information nodes in the message middleware and directly accesses the local server's information through the node address corresponding to the registered node information. After the server completes the registration of information nodes, it maintains a heartbeat; that is, the server periodically sends REST requests to the message middleware to inform it that the server is available. This periodic heartbeat sending function can be implemented by a timing device.

[0091] In other words, the message middleware in this application can be equivalent to a registry center or a control hub. By registering the information of the server on the message middleware, the client (consumer) can retrieve the corresponding registration information and then access the server corresponding to the registration information. This application uses the characteristics of the message middleware to realize the function of the registry center. Systems that apply the method provided in this application do not need to set up an additional registry center, which simplifies system architecture updates and saves costs.

[0092] It should be understood that, although Figure 2The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order in which these steps are executed, and they can be performed in other orders. Furthermore, Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0093] In one embodiment, such as Figure 3 As shown, an application service management system is provided, including: a server-side device (P), a message queue (MQ), a consumer-side device (C), a timing device, and a cache device (DB), wherein:

[0094] A server-side device (P) is used to provide a data source and send the data source to a message middleware;

[0095] Message Queuing (MQ) is a communication connection between the message queue and the server. The message queue is used to receive data sources sent by the server device, receive application service processing requests sent by the consumer device, query the storage partition corresponding to the topic of the application service to be processed, and send the application service to be processed in the queried storage partition to the corresponding consumer.

[0096] Consumer device (C) is connected to the message middleware and is used to receive application services to be processed sent by the message middleware and to consume the application services to be processed.

[0097] A timing device used to perform timed tasks;

[0098] A cache device (DB) is used to receive the application services to be processed stored in the first cache area and update the application services of the storage partition when the timing device meets the preset conditions.

[0099] Please continue reading. Figure 3 To better illustrate the application service management method of this application, the following specific embodiments of the application service management method are provided as examples:

[0100] S1: The message middleware used is RocketMQ. This middleware can push application services and provides a client connection package for easy application service integration. The message middleware is deployed on a service, and the corresponding parameters are configured for the application service middleware to push the application services to be processed to the consumer devices.

[0101] S2: The server device (P) needs to load the RocketMQ client into its program and specify the RocketMQ service address within the program. It also needs to send pending application services to a message queue (e.g., Topic01 queue). When the server device (P) application starts, it sends the application's service information to the message queue of the RocketMQ receiver via the RocketMQ server.

[0102] S3: The consumer device (C) also needs to load the message middleware (RocketMQ) server into the program, specify the message middleware (RocketMQ) service address in the program, and register the consumption information to the application service queue. The program listens to the application services stored in this message queue, parses the data after receiving the application service, and saves it to the second cache area (server memory) of the current cache device.

[0103] S4: After receiving the application service in the second cache of the cache device, the application service is parsed and stored in the first cache of the cache device for data persistence. The first cache of the cache device can be a MySQL database.

[0104] S5: Deploy a timer. You can choose a Quartz timer to implement the timer and start a scheduled task, which can be executed every 30 seconds. The scheduled task first reads the persistent pending application services that failed to be consumed from the first cache area of ​​the cache device. After encapsulating the failed pending application services, it sends them to the message queue of the message middleware (RocketMQ) receiver via the message middleware (RocketMQ) server.

[0105] S6: If the server device disconnects from the message middleware, the application services stored in the message middleware need to be sent to the first cache area of ​​the caching device upon disconnection. After the received application services are marked accordingly, the disconnected service information will be marked and deleted when the scheduled task is sent. The server device will also delete the consumption task of the application service in memory according to the mark. This ensures timely synchronization of service information.

[0106] In one embodiment, another implementation of the application service management method that the above-mentioned apparatus can achieve includes the following specific steps:

[0107] Obtain the data source, which includes multiple application services;

[0108] Based on the application service processing request, select the application service to be processed corresponding to the topic in the application service processing request from the data source;

[0109] Write the application services to be processed into the message queue, and determine whether the application services to be processed written into the message queue are complete;

[0110] When the pending application services written to the message queue are incomplete, the application service compensation mechanism is triggered to compensate the pending application services in the message queue.

[0111] In one embodiment, another implementation of the application service management method that the above-mentioned apparatus can achieve includes the following specific steps:

[0112] Store multiple application services from the data source in the second cache area of ​​the cache device;

[0113] Determine whether the application service to be processed stored in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0114] When it is determined that the pending application service stored in the storage partition corresponding to the topic in the application service processing request has been consumed, the pending application service to be consumed is deleted from the storage partition.

[0115] The storage device sends the consumed application services stored in the second cache to the first cache for storage.

[0116] In one embodiment, another implementation of the application service management method that the above-mentioned apparatus can achieve includes the following specific steps:

[0117] Determine whether the application service to be processed in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0118] When it is determined that the application service to be processed in the storage partition corresponding to the topic in the application service processing request has not been consumed, a mark is added to the application service to be processed in the storage partition that has not been consumed, and the application service to be processed carrying the mark is obtained.

[0119] The pending application service carrying the tag will be resent to the corresponding consumer.

[0120] Once a tagged pending application service is consumed, the consumed tagged pending application service will be deleted from the storage partition.

[0121] The consumed, tagged, pending application services stored in the second cache area of ​​the storage device are sent to the first cache area for storage.

[0122] In one embodiment, another implementation of the application service management method that the above-mentioned apparatus can achieve includes the following specific steps:

[0123] In response to the timing device meeting preset conditions, the application service stored in the first buffer is received, and the application service in the storage partition is updated, including:

[0124] In response to the timing device meeting the preset conditions, the application service stored in the first cache is read and the application service stored in the first cache is encapsulated to obtain the encapsulated application service.

[0125] The encapsulated application service is sent to the server. The server receives the encapsulated application service and persists it to the application service queue.

[0126] In one embodiment, another implementation of the application service management method that the above-mentioned apparatus can achieve includes the following specific steps:

[0127] The timing device is a timer, and the method also includes:

[0128] The timer includes a timing function, which releases a control signal at regular intervals.

[0129] In response to receiving a control signal, the cache device sends the application services to be processed stored in the first cache area to the storage partition in the message queue for storage, and updates the application services in the storage partition.

[0130] In one embodiment, another implementation of the application service management method that the above-mentioned apparatus can achieve includes the following specific steps:

[0131] The timer includes a first timer and a second timer. The first timer includes a timing function. In response to the release signal of the first timer, the second timer receives the release signal, initializes the execution task, and registers the execution cycle and the callback function corresponding to the execution task in the registry of the second timer.

[0132] For specific limitations regarding the application service management system, please refer to the limitations on application service management methods described above, which will not be repeated here. Each module in the aforementioned application service management system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0133] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data required for application service management methods. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements an application service management method.

[0134] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0135] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0136] Step 201: In response to receiving an application service processing request sent by the consumer, the application service processing request includes the topic of the application service to be processed.

[0137] Step 202: Query the application services to be processed stored in the storage partition corresponding to the topic of the application service to be processed, send the application services to be processed in the queried storage partition to the corresponding consumer so that the consumer can consume the application services to be processed, and delete the application services to be processed consumed by the consumer from the storage partition.

[0138] Step 203: Store the application services to be processed in the storage partition in the first cache area of ​​the cache device; in response to the timing device meeting the preset conditions, receive the application services to be processed stored in the first cache area and update the application services in the storage partition.

[0139] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0140] Obtain the data source, which includes multiple application services;

[0141] Based on the application service processing request, select the application service to be processed corresponding to the topic in the application service processing request from the data source;

[0142] Write the application services to be processed into the message queue, and determine whether the application services to be processed written into the message queue are complete;

[0143] When the pending application services written to the message queue are incomplete, the application service compensation mechanism is triggered to compensate the pending application services in the message queue.

[0144] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0145] Store multiple application services from the data source in the second cache area of ​​the cache device;

[0146] Determine whether the application service to be processed stored in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0147] When it is determined that the pending application service stored in the storage partition corresponding to the topic in the application service processing request has been consumed, the pending application service to be consumed is deleted from the storage partition.

[0148] The storage device sends the consumed application services stored in the second cache to the first cache for storage.

[0149] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0150] After sending the application services to be processed in the retrieved storage partitions to the corresponding consumer, the following steps are included:

[0151] Determine whether the application service to be processed in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0152] When it is determined that the application service to be processed in the storage partition corresponding to the topic in the application service processing request has not been consumed, a mark is added to the application service to be processed in the storage partition that has not been consumed, and the application service to be processed carrying the mark is obtained.

[0153] The pending application service carrying the tag will be resent to the corresponding consumer.

[0154] Once a tagged pending application service is consumed, the consumed tagged pending application service will be deleted from the storage partition.

[0155] The consumed, tagged, pending application services stored in the second cache area of ​​the storage device are sent to the first cache area for storage.

[0156] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0157] In response to the timing device meeting preset conditions, the application service stored in the first cache is received, and the application service in the storage partition is updated, including:

[0158] In response to the timing device meeting the preset conditions, the application service stored in the first cache is read and the application service stored in the first cache is encapsulated to obtain the encapsulated application service.

[0159] The encapsulated application service is sent to the server. The server receives the encapsulated application service and persists it to the application service queue.

[0160] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0161] The timing device is a timer, and the method also includes:

[0162] The timer includes a timing function, which releases a control signal at regular intervals.

[0163] In response to receiving a control signal, the cache device sends the application services to be processed stored in the first cache area to the storage partition in the message queue for storage, and updates the application services in the storage partition.

[0164] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0165] The timer includes a first timer and a second timer. The first timer includes a timing function. In response to the release signal of the first timer, the second timer receives the release signal, initializes the execution task, and registers the execution cycle and the callback function corresponding to the execution task in the registry of the second timer.

[0166] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0167] Step 201: In response to receiving an application service processing request sent by the consumer, the application service processing request includes the topic of the application service to be processed.

[0168] Step 202: Query the application services to be processed stored in the storage partition corresponding to the topic of the application service to be processed, send the application services to be processed in the queried storage partition to the corresponding consumer so that the consumer can consume the application services to be processed, and delete the application services to be processed consumed by the consumer from the storage partition.

[0169] Step 203: Store the application services to be processed in the storage partition in the first cache area of ​​the cache device; in response to the timing device meeting the preset conditions, receive the application services to be processed stored in the first cache area and update the application services in the storage partition.

[0170] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0171] Obtain the data source, which includes multiple application services;

[0172] Based on the application service processing request, select the application service to be processed corresponding to the topic in the application service processing request from the data source;

[0173] Write the application services to be processed into the message queue, and determine whether the application services to be processed written into the message queue are complete;

[0174] When the pending application services written to the message queue are incomplete, the application service compensation mechanism is triggered to compensate the pending application services in the message queue.

[0175] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0176] Store multiple application services from the data source in the second cache area of ​​the cache device;

[0177] Determine whether the application service to be processed stored in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0178] When it is determined that the pending application service stored in the storage partition corresponding to the topic in the application service processing request has been consumed, the pending application service to be consumed is deleted from the storage partition.

[0179] The storage device sends the consumed application services stored in the second cache to the first cache for storage.

[0180] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0181] After sending the pending application services from the retrieved storage partitions to the corresponding consumer, the process includes:

[0182] Determine whether the application service to be processed in the storage partition corresponding to the topic in the application service processing request has been consumed;

[0183] When it is determined that the application service to be processed in the storage partition corresponding to the topic in the application service processing request has not been consumed, a mark is added to the application service to be processed in the storage partition that has not been consumed, and the application service to be processed carrying the mark is obtained.

[0184] The pending application service carrying the tag will be resent to the corresponding consumer.

[0185] Once a tagged pending application service is consumed, the consumed tagged pending application service will be deleted from the storage partition.

[0186] The consumed, tagged, pending application services stored in the second cache area of ​​the storage device are sent to the first cache area for storage.

[0187] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:

[0188] In response to the timing device meeting preset conditions, the application service stored in the first cache is received, and the application service in the storage partition is updated, including:

[0189] In response to the timing device meeting the preset conditions, the application service stored in the first cache is read and the application service stored in the first cache is encapsulated to obtain the encapsulated application service.

[0190] The encapsulated application service is sent to the server. The server receives the encapsulated application service and persists it to the application service queue.

[0191] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0192] The timing device is a timer, and the method also includes:

[0193] The timer includes a timing function, which releases a control signal at regular intervals.

[0194] In response to receiving a control signal, the cache device sends the application services to be processed stored in the first cache area to the storage partition in the message queue for storage, and updates the application services in the storage partition.

[0195] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0196] The timer includes a first timer and a second timer. The first timer includes a timing function. In response to the release signal of the first timer, the second timer receives the release signal, initializes the execution task, and registers the execution cycle and the callback function corresponding to the execution task in the registry of the second timer.

[0197] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory 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), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0198] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0199] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. An application service management method, characterized in that, The method is applied to a message middleware, which serves as a registry center for application services. Server-side devices register information nodes on the message middleware. Each information node includes a node address, which in turn includes the service's IP address and port information. The method includes: In response to receiving an application service processing request sent by a consumer, the application service processing request includes the topic of the application service to be processed; querying the application services to be processed stored in the storage partition corresponding to the topic of the application service to be processed, and sending the application services to be processed in the queried storage partition to the corresponding consumer so that the consumer can consume the application services to be processed; Determine whether the application service to be processed in the storage partition has been consumed; When it is determined that the application service to be processed has been consumed, the consumed application service to be processed is deleted from the storage partition and stored in the first cache area of ​​the cache device. When it is determined that the application service to be processed has not been consumed, a mark is added to the unconsumed application service to be processed to obtain the application service to be processed with the mark, and the application service to be processed with the mark is resent to the corresponding consumer; when the application service to be processed with the mark is consumed, the consumed application service to be processed with the mark is deleted from the storage partition, and the consumed application service to be processed with the mark is stored in the first cache area. In response to the timing device meeting preset conditions, the application service to be processed stored in the first cache is received, and the application service in the storage partition is updated.

2. The method according to claim 1, characterized in that, The method further includes: Obtain a data source, which includes multiple application services; Based on the application service processing request, select the application service to be processed corresponding to the topic in the application service processing request from the data source; Write the application services to be processed into the message queue, and determine whether the application services to be processed written into the message queue are complete; When the pending application services written to the message queue are incomplete, the application service compensation mechanism is triggered to compensate the pending application services in the message queue.

3. The method according to claim 1, characterized in that, The method further includes: Store multiple application services from the data source in the second cache area of ​​the cache device; Determine whether the application service to be processed stored in the storage partition corresponding to the topic in the application service processing request has been consumed; When it is determined that the pending application service stored in the storage partition corresponding to the topic in the application service processing request has been consumed, the pending application service to be consumed is deleted from the storage partition. The storage device sends the consumed application services stored in the second cache to the first cache for storage.

4. The method according to claim 1, characterized in that, The step of responding to the timing device meeting a preset condition, receiving the application service stored in the first cache, and updating the application service in the storage partition includes: In response to the timing device meeting the preset conditions, the application service stored in the first cache is read and the application service stored in the first cache is encapsulated to obtain the encapsulated application service. The encapsulated application service is sent to the server. The server receives the encapsulated application service and persists it to the message queue.

5. The method according to claim 1, characterized in that, The timing device is a timer, and the method further includes: The timer includes a timing function that periodically releases a control signal. In response to receiving a control signal, the cache device sends the application services to be processed stored in the first cache area to the storage partition in the message queue for storage, and updates the application services in the storage partition.

6. The method according to claim 5, characterized in that, The timer includes a first timer and a second timer. The first timer includes a timing function. In response to the release signal of the first timer, the second timer receives the release signal, initializes the execution task, and registers the execution cycle and the callback function corresponding to the execution task in the registry of the second timer.

7. An application service management system, characterized in that, The system includes: A server-side device is used to provide a data source and send the data source to a message middleware; A message middleware, communicating with server devices, acts as a registry center for application services, storing application service information nodes registered by each server device. Each information node includes a node address, which contains the service's IP address and port information. The message middleware receives data sources from server devices, receives application service processing requests from consumer devices, queries the storage partition corresponding to the topic of the application service to be processed, and sends the retrieved application services from the storage partition to the corresponding consumer. It then determines whether the application service in the storage partition has been consumed. When it is determined that the application service to be processed has been consumed, the consumed application service to be processed is deleted from the storage partition. When it is determined that the application service to be processed has not been consumed, a mark is added to the unconsumed application service to be processed to obtain the application service to be processed with the mark. The application service to be processed with the mark is resent to the corresponding consumer. When the application service to be processed with the mark is consumed, the consumed application service to be processed with the mark is deleted from the storage partition. In response to the timing device meeting the preset condition, the application service to be processed stored in the first buffer is received and the application service in the storage partition is updated. The consumer device is communicatively connected to the message middleware. The consumer device is used to receive application services to be processed sent by the message middleware and to consume the application services to be processed. A timing device used to perform timed tasks; A caching device is used to send the application service to be processed stored in the first cache to the message middleware when the timing device meets the preset conditions.

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

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

Citation Information

Patent Citations

  • Message subscription processing device, system and method

    CN106657349A