Resource management method, device and computer equipment
Patent Information
- Application Number
- CN202511832358.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-12-05
AI Technical Summary
[0004]然而,传统技术中,由于客户端按照资源顺序轮询资源是否发生变更,在客户端存在大量资源的情况下,轮询一遍资源会耗费大量的时间,进而导致资源同步存在较长的时延
[0066]The aforementioned resource management method, apparatus, computer equipment, computer-readable storage medium, and computer program product acquire a resource change instruction, encapsulate the change type and target resource carried in the resource change instruction to obtain a resource change event; determine the resource to be changed corresponding to the target resource, and select a target listener from among the listeners to listen to the resource to be changed; update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener. By encapsulating the change type and target resource into a resource change event and determining the target listener corresponding to the resource to be changed, this method can quickly synchronize the resource change event to the target client through the target listener when the resource to be changed can be changed, saving the time of polling resources and reducing the latency of resource synchronization.
Smart Images

Figure CN121691022B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of service governance technology, and in particular to a resource management method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] In service governance projects, the service governance platform needs to synchronize resources such as API (Application Programming Interface) configuration information, subscription relationships, and traffic management policies to each client through resource management methods, so as to ensure that the client can execute business based on the latest resources.
[0003] In traditional technology, the client contains various resources. The client constructs resource query requests for each resource one by one according to a preset access order and sends these requests to the service governance platform. Based on the resource query requests, the service governance platform returns the resource information to the client. If the returned resource information differs from the client's resource information, the service governance platform pushes its own resource to the client.
[0004] However, in traditional technologies, since the client polls for changes to resources in order, polling all resources once can take a lot of time when the client has a large number of resources, resulting in a long delay in resource synchronization. Summary of the Invention
[0005] Therefore, it is necessary to provide a resource management method, apparatus, computer equipment, computer-readable storage medium, and computer program product to address the aforementioned technical problems.
[0006] Firstly, this application provides a resource management method, which is applied to a service governance platform, and the method includes:
[0007] Obtain a resource change instruction, encapsulate the change type and the target resource carried by the resource change instruction to obtain a resource change event;
[0008] Identify the resource to be changed corresponding to the target resource, and filter the target listeners that listen to the resource to be changed from among the listeners;
[0009] Update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
[0010] In one embodiment, before obtaining the resource change instruction, the method further includes:
[0011] Receive listening requests sent by each client, and parse each listening request to obtain listening parameters;
[0012] Based on the listening parameters, determine the resource to be bound among the resources, and bind the listener to the resource to be bound according to the listening request.
[0013] In one embodiment, the step of determining the resource to be bound among the resources based on the listening parameters, and binding a listener to the resource to be bound according to the listening request, includes:
[0014] Based on the resource namespace and resource type in the monitoring parameters, determine the resource to be bound among each resource;
[0015] A listening object is constructed based on the node identifier corresponding to the client, the resource namespace, resource type, and resource version of the resource to be bound.
[0016] Based on the listener being bound to the resource to be bound, the listener is updated to the listener list.
[0017] In one embodiment, after determining the resource to be changed corresponding to the target resource, the method further includes:
[0018] Save the target resource in the resource change instruction and archive the resource to be changed in a versioned manner;
[0019] Trigger the listener corresponding to the resource to be changed, and start processing the event of the change of the resource to be changed.
[0020] In one embodiment, after synchronizing the resource change event to the target client corresponding to the target listener via the target listener, the method further includes:
[0021] Receive synchronization confirmation information for the resource change event returned by the target client;
[0022] If the synchronization confirmation information indicates that the target resource update has failed, then the synchronization count of the target resource is updated.
[0023] The step of synchronizing the resource change event to the target client corresponding to the target listener through the target listener is performed until the number of synchronizations after the update exceeds the preset number of synchronizations threshold or the target resource is successfully updated.
[0024] Secondly, this application provides a resource management method, which is applied to a target client, and the method includes:
[0025] Receive resource update events; the resource update event is obtained by the service governance platform from the resource change instruction, encapsulating the change type and the target resource carried by the resource change instruction to obtain the resource change event; determine the resource to be changed corresponding to the target resource, and select the target listener to listen to the resource to be changed from among the listeners; update the resource to be changed according to the target resource, and synchronize the resource change event through the target listener;
[0026] Based on the target resource carried by the resource update event, the resource to be updated is determined in the target client, and the resource to be updated is updated according to the target resource to obtain the update result;
[0027] Based on the update result, a synchronization confirmation message is generated and returned to the service governance platform.
[0028] In one embodiment, the target client contains resources of various resource types to be monitored, and before receiving the resource update event, the method further includes:
[0029] For each type of resource to be monitored, monitoring parameters for the resource to be monitored are constructed based on the node identifier of the node where the target client is located, the resource namespace, resource type, resource name, and resource version of the resource to be monitored.
[0030] Based on the monitoring parameters, a monitoring request for the resource to be monitored is sent to the service governance platform.
[0031] In one embodiment, generating synchronization confirmation information based on the update result and returning the synchronization confirmation information to the service governance platform includes:
[0032] A unique identifier is generated based on the update result, and a synchronization confirmation message is generated based on the unique identifier and the resource information of the target resource.
[0033] Based on the target listener, the synchronization confirmation information is sent to the service governance platform.
[0034] Thirdly, this application also provides a resource management device, which is applied to a service governance platform and includes:
[0035] The acquisition module is used to acquire resource change instructions, encapsulate the change type and the target resource carried by the resource change instructions to obtain resource change events.
[0036] The filtering module is used to determine the resource to be changed corresponding to the target resource, and to filter the target listeners that listen to the resource to be changed from among the listeners.
[0037] The synchronization module is used to update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
[0038] Fourthly, this application also provides a resource management device, which is applied to a target client and includes:
[0039] The receiving module is used to receive resource update events. These events are generated when the service governance platform obtains a resource change instruction, encapsulates the change type and target resource carried in the instruction, and obtains the resource change event. The module then determines the resource to be changed corresponding to the target resource and filters out target listeners that listen to the resource to be changed from among the listeners. Finally, the module updates the resource to be changed according to the target resource and synchronizes the resource change event through the target listener.
[0040] The determination module is used to determine the resource to be updated in the target client based on the target resource carried by the resource update event, and update the resource to be updated based on the target resource to obtain the update result;
[0041] The feedback module is used to generate synchronization confirmation information based on the update result and return the synchronization confirmation information to the service governance platform.
[0042] Fifthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0043] Obtain a resource change instruction, encapsulate the change type and the target resource carried by the resource change instruction to obtain a resource change event;
[0044] Identify the resource to be changed corresponding to the target resource, and filter the target listeners that listen to the resource to be changed from among the listeners;
[0045] Update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
[0046] Sixthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0047] Receive resource update events; the resource update event is obtained by the service governance platform from the resource change instruction, encapsulating the change type and the target resource carried by the resource change instruction to obtain the resource change event; determine the resource to be changed corresponding to the target resource, and select the target listener to listen to the resource to be changed from among the listeners; update the resource to be changed according to the target resource, and synchronize the resource change event through the target listener;
[0048] Based on the target resource carried by the resource update event, the resource to be updated is determined in the target client, and the resource to be updated is updated according to the target resource to obtain the update result;
[0049] Based on the update result, a synchronization confirmation message is generated and returned to the service governance platform.
[0050] Seventhly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0051] Obtain a resource change instruction, encapsulate the change type and the target resource carried by the resource change instruction to obtain a resource change event;
[0052] Identify the resource to be changed corresponding to the target resource, and filter the target listeners that listen to the resource to be changed from among the listeners;
[0053] Update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
[0054] Eighthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0055] Receive resource update events; the resource update event is obtained by the service governance platform from the resource change instruction, encapsulating the change type and the target resource carried by the resource change instruction to obtain the resource change event; determine the resource to be changed corresponding to the target resource, and select the target listener to listen to the resource to be changed from among the listeners; update the resource to be changed according to the target resource, and synchronize the resource change event through the target listener;
[0056] Based on the target resource carried by the resource update event, the resource to be updated is determined in the target client, and the resource to be updated is updated according to the target resource to obtain the update result;
[0057] Based on the update result, a synchronization confirmation message is generated and returned to the service governance platform.
[0058] Ninthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0059] Obtain a resource change instruction, encapsulate the change type and the target resource carried by the resource change instruction to obtain a resource change event;
[0060] Identify the resource to be changed corresponding to the target resource, and filter the target listeners that listen to the resource to be changed from among the listeners;
[0061] Update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
[0062] In a tenth aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0063] Receive resource update events; the resource update event is obtained by the service governance platform from the resource change instruction, encapsulating the change type and the target resource carried by the resource change instruction to obtain the resource change event; determine the resource to be changed corresponding to the target resource, and select the target listener to listen to the resource to be changed from among the listeners; update the resource to be changed according to the target resource, and synchronize the resource change event through the target listener;
[0064] Based on the target resource carried by the resource update event, the resource to be updated is determined in the target client, and the resource to be updated is updated according to the target resource to obtain the update result;
[0065] Based on the update result, a synchronization confirmation message is generated and returned to the service governance platform.
[0066] The aforementioned resource management method, apparatus, computer equipment, computer-readable storage medium, and computer program product acquire a resource change instruction, encapsulate the change type and target resource carried in the resource change instruction to obtain a resource change event; determine the resource to be changed corresponding to the target resource, and select a target listener from among the listeners to listen to the resource to be changed; update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener. By encapsulating the change type and target resource into a resource change event and determining the target listener corresponding to the resource to be changed, this method can quickly synchronize the resource change event to the target client through the target listener when the resource to be changed can be changed, saving the time of polling resources and reducing the latency of resource synchronization. Attached Figure Description
[0067] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0068] Figure 1 This is a diagram illustrating the application environment of a resource management method in one embodiment;
[0069] Figure 2 This is a flowchart illustrating a resource management method in one embodiment;
[0070] Figure 3 This is a flowchart illustrating the process of binding a listener in one embodiment;
[0071] Figure 4 This is a schematic diagram of the process of determining and binding resources and binding listeners in one embodiment;
[0072] Figure 5 This is a flowchart illustrating the process of initiating an event to change the resource to be modified in one embodiment.
[0073] Figure 6 This is a schematic diagram of the process of receiving synchronization confirmation information in one embodiment;
[0074] Figure 7 This is a flowchart illustrating the resource management method in another embodiment;
[0075] Figure 8 This is a schematic diagram of the process of sending a listening request in one embodiment;
[0076] Figure 9This is a schematic diagram of the process of sending synchronization confirmation information in one embodiment;
[0077] Figure 10 This is a swimlane diagram of a resource query method in an exemplary embodiment;
[0078] Figure 11 This is a swimlane diagram of a resource management method in an exemplary embodiment;
[0079] Figure 12 This is a structural block diagram of a resource management device in one embodiment;
[0080] Figure 13 This is a structural block diagram of the resource management device in another embodiment;
[0081] Figure 14 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0082] 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.
[0083] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0084] The resource management method provided in this application embodiment can be applied to, for example, Figure 1 The resource management system 100 shown includes a service governance platform 110 (also called a service governance control plane) and various clients 120. Each client includes a target client 121, which is the client 120 that needs resource updates. Clients 120 communicate with the service governance platform 110 via a network. A data storage system can store the data that clients 120 need to process. The data storage system can be integrated on the client 120 or located in the cloud or on other network servers. The service governance platform 110 can be, but is not limited to, personal computers, laptops, smartphones, tablets, or servers. Clients 120 can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing cloud computing services.
[0085] In one exemplary embodiment, such as Figure 2 As shown, a resource management method is provided, which can be applied to... Figure 1 The following explanation uses the service governance platform 110 (hereinafter referred to as the service governance platform) as an example, including the following steps 202 to 206. Among them:
[0086] Step 202: Obtain the resource change instruction, encapsulate the change type and target resource carried by the resource change instruction to obtain the resource change event.
[0087] The resource change instruction includes the target resource and the change type.
[0088] During implementation, the service governance platform obtains resource change instructions. The service governance platform encapsulates the change type and target resource in the resource change instructions to obtain the resource change event.
[0089] Specifically, change types include add, delete, and update. When the change type is add or update, the resource change instruction carries the target resource to be added or updated. When the change type is delete, the resource change instruction carries information about the target resource to be deleted. When a user needs to manage resources in various clients, the user sends a resource change instruction to the service governance platform through the user terminal. The service governance platform receives the resource change instruction sent by the user terminal and constructs a resource change event based on the change type and target resource in the resource change instruction.
[0090] In an exemplary embodiment, when a user needs to manage resources in a target client, the user terminal constructs a resource change instruction based on the target resource to be managed and the change type. The user terminal sends the resource change instruction to the service governance platform through the service governance platform's interface. The service instruction platform receives the resource change instruction, parses it to obtain the target resource and the resource change type, and encapsulates the target resource and the resource change type to obtain a resource change event.
[0091] In one optional embodiment, users publish resources through an interface provided by the service governance control plane, and only published resources are available externally. If the service governance platform is a cluster, the service governance platform broadcasts the resource change event to the internal cluster.
[0092] Optionally, the resources may be, but are not limited to, new versions of the application; this application embodiment does not limit the resources.
[0093] Step 204: Determine the resource to be changed corresponding to the target resource, and select the target listener to listen to the resource to be changed from among the listeners.
[0094] During implementation, the service governance platform determines the resource to be changed based on the target resource information. Then, the service governance platform selects the target listeners from among the listeners to listen for the resource to be changed.
[0095] Specifically, the target resource information includes the resource name, resource version, and resource tag. The service governance platform determines the name of the target resource as the name of the resource to be changed, and determines the resource tag as the tag of the resource to be changed. Then, the service governance platform queries the resources to be changed among all resources based on the tag and name of the resource to be changed. Then, the service governance platform matches and queries the target listeners that are listening to the resource to be changed based on the resource namespace, resource type, resource tag, and / or resource name of the resource to be changed. The target listeners are bound to the resource to be changed.
[0096] In one exemplary embodiment, the computer device queries each listening object for a target listening object that contains the resource name and resource namespace of the resource to be changed, and determines the listener associated with the target listening object as the target listener.
[0097] In an optional embodiment, the computer device queries each listening object for a target listening object that contains the resource name, resource namespace, and resource version of the resource to be changed, and identifies the listener associated with the target listening object as the target listener.
[0098] In one exemplary embodiment, the change types are categorized as addition, update, and deletion. If the change type is deletion or update, the service governance platform queries the resource to be changed based on the target resource's information and determines the target listener for that resource based on the target resource's information. If the change type is addition, the service governance platform determines the target listener based on the target resource's information.
[0099] In one exemplary embodiment, since the resource to be modified exists on multiple target clients, and each target client binds a listener to the resource to be modified on the service governance platform, the resource to be modified will be bound to multiple target listeners. That is, the service governance platform will select the target listeners that listen to the resource to be modified from among the listeners. The target listeners establish the association between the resource to be modified and the target clients. Once the resource to be modified changes, the target listeners will synchronize the changes to the target clients.
[0100] Step 206: Update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
[0101] In implementation, the service governance platform updates the resource to be changed to the target resource. Then, the service governance platform synchronizes the resource change event to the target client corresponding to the target listener through the target listener. The target client changes the resource to be changed to the target resource according to the resource change event, obtaining the update result. The target client generates a synchronization confirmation message based on the update result and sends the synchronization confirmation message back to the service governance platform. The service governance platform confirms whether the target client's resource to be changed has been successfully updated based on the synchronization confirmation message.
[0102] Specifically, the service governance platform updates the resource to be changed to the target resource. The target listener establishes a target connection between the service governance platform and the target client. This connection uses HTTP / 2.0 (Hypertext Transfer Protocol) and protobuff (a data description language used for serializing structured data, supporting cross-platform and cross-language data storage and communication protocols). HTTP / 2.0 and protobuff protocols compress resource change events. The service governance platform then transmits the compressed resource change events to the target client through the target connection. Transmitting compressed resource change events improves event synchronization efficiency, thereby improving resource management efficiency. Furthermore, since the target listener is only bound to the target client, the service governance platform can accurately push resource changes to the target client managing the updated resource, avoiding the network overhead of global broadcasting and improving resource utilization.
[0103] In the above resource management method, by encapsulating the change type and target resource as a resource change event and determining the target listener corresponding to the resource to be changed, the resource change event can be quickly synchronized to the target client through the target listener when the resource to be changed is available, saving the time of polling resources and reducing the latency of resource synchronization.
[0104] In one exemplary embodiment, a listener needs to be bound to the resource to be bound before obtaining the resource change instruction. For example... Figure 3 As shown, before step 202 is executed, the specific processing procedure of this resource management method further includes steps 302 to 304. Wherein:
[0105] Step 302: Receive listening requests sent by each client and parse each listening request to obtain listening parameters.
[0106] In implementation, the service governance platform receives listening requests from each client. Then, the platform parses each listening request to obtain the listening parameters. These parameters contain resource information about the resource to be bound.
[0107] Specifically, when a client needs to listen to a resource to be bound, the client assembles the information of the resource to be bound and constructs a listening request based on this information. Then, the client sends the listening request to the service governance platform. The service governance platform receives each client's listening request and parses and processes it to obtain listening parameters. These parameters include the resource information of the resource to be bound, which includes the node ID (node identifier) of the client's node, the resource namespace, resource type, resource name, and resource version.
[0108] Step 304: Determine the resource to be bound in each resource according to the listening parameters, and bind the listener to the resource to be bound according to the listening request.
[0109] In implementation, the service governance platform queries the resources to be bound among various resources using listening parameters. Then, the service governance platform binds a listener to this resource. This listener is a resource change listener, and it establishes a connection between the resource to be bound and the client that sent the listening parameters. When the resource to be bound changes, the changed resource is synchronized to the client through this listener.
[0110] In one exemplary embodiment, the listening parameters include the node ID (node identifier) of the node where the client resides, the resource namespace, resource type, resource name, and resource version of the resource to be monitored. The service governance platform queries the resources to be bound based on their name and version. Then, the service governance platform binds the listener used to monitor resource changes to the resource to be bound.
[0111] In this embodiment, by binding a listener to the resource to be monitored, when the resource to be monitored changes, the change information of the resource to be monitored can be quickly transmitted to the client corresponding to the listener, saving resource polling events and reducing the latency of resource synchronization.
[0112] In one exemplary embodiment, such as Figure 4 As shown, the specific processing procedure of step 304 includes steps 402 to 406. Wherein:
[0113] Step 402: Based on the resource namespace and resource type in the listening parameters, determine the resource to be bound among the various resources.
[0114] The listening parameters include the resource namespace and resource type.
[0115] In implementation, for each resource, the computer device determines whether its resource namespace is the same as the resource namespace in the monitoring parameters. If the resource namespace is the same, the computer device then determines whether the resource type is the same as the resource type in the monitoring parameters. If the resource type is the same, the computer device identifies the resource as a resource to be bound.
[0116] In an optional embodiment, if the client needs to listen to a resource with a specific name and version, the listening parameters also include the resource version. If the resource type and the resource type of the listening parameters are the same, and the resource namespace and the resource namespace of the listening parameters are the same, the computer device determines whether the resource version of the resource is the same as the resource version in the listening parameters. If the resource version of the resource is the same as the resource version in the listening parameters, the computer device identifies the resource as a resource to be bound.
[0117] Step 404: Construct a listener object based on the node identifier corresponding to the client, the resource namespace of the resource to be bound, the resource type, and the resource version.
[0118] In implementation, the computer device obtains the node identifier of the node where the client is located. Then, the computer device combines this node identifier, the resource namespace of the resource to be bound, the resource type, and the resource version together to obtain a listening object. This listening object is used to associate the resource to be monitored with the client.
[0119] In an optional embodiment, if it is necessary to monitor the resources of each version under the resource type, the computer device obtains the node identifier of the node where the client is located, and combines the node identifier, resource namespace and resource type to obtain the monitoring object.
[0120] In an optional embodiment, the process of the client sending a listening request to the computer device is also a process of reporting the version of the resource to be bound that the client owns to the computer device. The computer device can determine the resource version of the resource to be bound owned by the client based on the resource version in the listening object, and selectively pushes either the full version of the resource or a different version of the resource to the client. The different version is determined based on the resource version in the listening object and the resource version currently owned by the computer device.
[0121] Step 406: Bind a listener to the resource to be bound based on the listener object, and update the listener object to the listener list.
[0122] In implementation, the computer device binds a listener to the resource to be monitored and establishes an association between the listener and the monitored object, enabling the client to listen to the resource to be bound. Then, the computer device adds the monitored object to the listener list.
[0123] In this embodiment, by constructing a listener object, the resource to be bound and the listener can be associated. This facilitates the quick locating of the listener during subsequent resource management, improving the efficiency of the resource management method. Furthermore, the listener object can assist the service governance platform in performing full version updates and differential version updates of resources, enabling flexible resource updates.
[0124] In an exemplary embodiment, after determining the resource to be changed corresponding to the target resource, it is necessary to save the version of the resource to be changed. For example... Figure 5 As shown, after determining the resource to be changed corresponding to the target resource in step 204, the specific processing procedure of this resource management method further includes steps 502 to 504. Wherein:
[0125] Step 502: Save the target resource in the resource change instruction and archive the versioned resource to be changed.
[0126] In implementation, the service governance platform saves the target resource in the resource change command to the staging area within the service governance platform. Then, the service governance platform commits the changes from the staging area to the local repository and adds meaningful commit information, thereby achieving versioned archiving of the resource to be changed.
[0127] In one exemplary embodiment, the service governance platform includes a staging area. The service governance platform saves the target resource from the resource change instruction to the staging area and commits the resource to be changed to the local repository. Then, the service governance platform deletes the resource to be changed from the staging area and adds meaningful commit information, thereby achieving versioned archiving of the resource to be changed.
[0128] Step 504: Trigger the listener corresponding to the resource to be changed and start processing the event of the change of the resource to be changed.
[0129] During implementation, the resource to be modified changes. Therefore, the service governance platform triggers the target listener corresponding to the resource to be modified, and initiates the processing of the event related to the change of the resource through the target listener.
[0130] In this embodiment, by saving the target resources and archiving the resources to be changed in a versioned manner, the local resource update of the service governance platform is completed, which facilitates the subsequent synchronization of resources.
[0131] In one exemplary embodiment, after synchronizing the resource change event to the target client, it is also necessary to determine whether the target resource has been successfully updated based on the synchronization confirmation information. For example... Figure 6 As shown, after step 206 is executed, the specific processing procedure of this resource management method further includes steps 602 to 606. Wherein:
[0132] Step 602: Receive synchronization confirmation information for resource change events returned by the target client.
[0133] In implementation, the service governance platform receives synchronization confirmation information for resource change events returned by the target client, and parses the confirmation information to obtain a unique identifier and the resource information of the target resource. The service governance platform determines whether the unique identifier indicates that the target resource update was successful. If the unique identifier indicates that the target resource update was successful, the service governance platform does not perform any further processing. If the unique identifier indicates that the target resource update failed, the service governance platform executes step 604 below.
[0134] In one exemplary embodiment, the client updates the resource to be updated in the client based on a resource change event, obtaining an update result. Then, the client generates a unique identifier based on the update result; the value of this unique identifier indicates whether the resource to be updated was successful. The client generates synchronization confirmation information based on the unique identifier and the resource information of the target resource, and returns this synchronization confirmation information to the service governance platform via a network connection. The service governance platform receives the synchronization confirmation information, parses it, and obtains the unique identifier and the resource information of the target resource.
[0135] Step 604: If the synchronization confirmation information indicates that the target resource update has failed, then update the synchronization count of the target resource.
[0136] During implementation, if the unique identifier in the synchronization confirmation information indicates that the target resource update has failed, the service governance platform determines the number of synchronization attempts for the target resource based on its resource information. Then, the service governance platform updates the number of synchronization attempts for the target resource.
[0137] In one exemplary embodiment, the service governance platform pre-sets the synchronization count for a target resource. This synchronization count is pre-set to 0. If the unique identifier in the synchronization confirmation information indicates that the target resource update has failed, the service governance platform queries the synchronization count of the target resource in each synchronization count based on the resource name of the target resource in the synchronization confirmation information. Then, the service governance platform increments the synchronization count of the target resource by 1 to obtain the updated synchronization count of the target resource.
[0138] Step 606: Execute the step of synchronizing the resource change event to the target client corresponding to the target listener through the target listener, until the number of synchronizations after the update exceeds the preset number of synchronizations threshold or the target resource is successfully updated.
[0139] In implementation, a synchronization count threshold is pre-set in the service governance platform. The service governance platform executes step 206 above until the updated synchronization count exceeds the synchronization count threshold or the target resource is successfully updated. The specific processing procedure of step 206 has been described in detail in the above embodiments, and will not be repeated here.
[0140] In an optional embodiment, if the number of synchronizations after the update exceeds a preset synchronization threshold and the target resource update fails, the service governance platform determines that the resource to be updated has failed to update and sends the information that the resource to be updated has failed to update to the user's terminal.
[0141] In this embodiment, by receiving the synchronization confirmation information sent by the client and continuing to send the resource change event in the event of a resource change failure, the update of the resource to be updated can be guaranteed to be successful (ensuring that the resource change takes effect atomically), thus improving the success rate of resource updates.
[0142] In one exemplary embodiment, such as Figure 7 As shown, a resource management method is provided, which can be applied to... Figure 1 Taking target client 121 (hereinafter referred to as target client) as an example, the explanation includes the following steps 702 to 706. Wherein:
[0143] Step 702: Receive resource update event.
[0144] Among them, the resource update event is obtained by the service governance platform from the resource change instruction, the change type in the resource change instruction and the target resource carried by the resource change instruction, the resource change event is obtained by encapsulating the change type in the resource change instruction and the target listener for the target resource is selected from the listeners; the target resource is updated according to the target resource, and the resource change event is synchronized through the target listener.
[0145] In practice, the client receives resource update events sent by the service governance platform through the target listener.
[0146] Step 704: Based on the target resource carried by the resource update event, determine the resource to be updated in the target client, and update the resource to be updated according to the target resource to obtain the update result.
[0147] The resource update event includes the resource information and change type of the target resource.
[0148] In implementation, the target client queries its local resources for the resource to be updated based on the resource information of the target resource. Then, the target client updates the resource to be updated according to the change type and the target resource, thus obtaining the update result.
[0149] Specifically, the target resource information includes the target resource's name, version, and tags. The target client identifies the target resource's name as the name of the resource to be changed and identifies its tags as the tags of the resource to be changed. Then, the target client searches for the resource to be changed among various resources based on its tags and labels. If the change type is deletion, the target client deletes the resource to be changed from its local storage. If the change type is addition, the target client saves the target resource to its local storage. If the change type is update, the target client saves the target resource and archives the updated resource as a version. The target client refreshes the resource and determines the update result based on the refreshed resource.
[0150] Step 706: Generate synchronization confirmation information based on the update results and return the synchronization confirmation information to the service governance platform.
[0151] In implementation, the target client pre-configures a mapping between update results and unique identifiers. The target client generates a unique identifier based on this mapping and the update result, and then generates a synchronization confirmation message based on the unique identifier. The target client then sends this synchronization confirmation message to the service governance platform to confirm whether the update was successful and to proceed with further processing.
[0152] Specifically, the correspondence between the update result and the unique identifier is that the update result corresponds to the value of the unique identifier. For example, if the update result is successful, the target client determines that the value of the unique identifier is 1. If the update result fails, the target client determines that the value of the unique identifier is 0. Then, the target client generates synchronization confirmation information based on the resource information and unique identifier of the target resource, and returns the synchronization confirmation information to the service governance platform. During the transmission of the synchronization confirmation message returned by the target client, a strong consistency protocol for versioned caching and bidirectional ACK (Acknowledgment) is used. This synchronization confirmation information is a response information, and the following is the structure of the response information in an exemplary embodiment:
[0153] response:
[0154] message Response {
[0155] / / Actual resource configuration
[0156] repeated Resource resources = 1;
[0157] / / Resource type
[0158] string type_url = 2;
[0159] / / Unique identifier used to confirm the response
[0160] string nonce = 3;
[0161] }
[0162] message Resource {
[0163] / / Resource Name
[0164] string name = 1;
[0165] / / Resource alias
[0166] repeated string aliases = 2;
[0167] / / Resource Version
[0168] string version = 3;
[0169] / / Resource Content
[0170] bytes resource = 4;
[0171] }
[0172] In this embodiment, the service governance platform can quickly synchronize resource change events to the target client through the target listener, enabling the target client to quickly update the resources to be updated, saving the time of polling resources and reducing the latency of resource synchronization.
[0173] In an exemplary embodiment, before receiving a resource update event, it is necessary to send a listening request for the resource to be monitored to the service governance platform, thereby binding a listener to the resource to be monitored, and also to determine whether the target resource has been successfully updated based on the synchronization confirmation information. Figure 8 As shown, before step 702 is executed, the specific processing procedure of this resource management method further includes steps 802 to 804. Wherein:
[0174] Step 802: For each type of resource to be monitored, construct the monitoring parameters of the resource to be monitored based on the node identifier of the node where the target client is located, the resource namespace, resource type, resource name, and resource version.
[0175] In implementation, the target client stores various types of resources to be monitored. To ensure that all resources in the target client are updated in a timely manner, listeners need to be bound to each resource. For each type of resource to be monitored, the target client constructs the monitoring parameters based on the node identifier of the node where the target client is located, the resource namespace, resource type, resource name, and resource version.
[0176] In an optional embodiment, if it is not necessary to monitor a specific version of the resource to be monitored, the target client constructs the monitoring parameters for each type of resource to be monitored based on the node identifier of the node where the target client is located, the resource namespace, resource type, and resource name of the resource to be monitored.
[0177] Step 804: Based on the listening parameters, send a listening request for the resource to be monitored to the service governance platform.
[0178] In implementation, the target client generates a listening request for the resource to be monitored based on the listening parameters and sends the listening request to the service governance platform. The service governance platform receives the listening request and binds a listener to the resource to be monitored in the service governance platform according to the listening request. Since the service governance platform receives multiple listening requests, it forms a listener data structure like [listener 1, listener 2, ..., listener n], where n is a natural number greater than 0.
[0179] Specifically, during the process of sending a listening request, versioned caching and a two-way ACK strong consistency protocol are used. The following is an example of a listening request:
[0180] message Request {
[0181] / / Node information that sent the request
[0182] Node node = 1;
[0183] / / Request Scope
[0184] enum Scope {
[0185] / / Retrieve by resource type
[0186] KIND = 0;
[0187] / / Retrieve by specified resource name
[0188] RESOURCE = 1;
[0189] }
[0190] Scope scope = 2;
[0191] / / Resource type
[0192] string type_url = 3;
[0193] / / Resource Tags
[0194] map<string, string> labels = 4;
[0195] / / key is the resource name, value is the version information
[0196] map<string, string> resource_name_versions = 5;
[0197] / / Resource namespace
[0198] string namespace = 6;
[0199] / / Resource group name
[0200] string group = 7;
[0201] / / ACK / NACK specific response
[0202] string response_nonce = 8;
[0203] / / Proxy configuration loading failed (while processing the previous configuration), ACK is empty.
[0204] google.rpc.Status error_detail = 9;
[0205] / / Whether to store the associated resources together with the current resource and return the result.
[0206] bool with_referenced_annotation = 10;
[0207] enum Method {
[0208] / / Push
[0209] PUSH = 0;
[0210] / / Pull
[0211] PULL = 1;
[0212] }
[0213] Method method = 11;
[0214] }
[0215] In this embodiment, the target client sends a monitoring request for each resource to be monitored to the service governance platform. This monitoring request includes the resource to be monitored (local cached resource) and its version number. When the monitored resource changes, incremental fetching is triggered through version comparison, reducing redundant transmission. Furthermore, the service governance platform can automatically select between full push or differential patching based on the resource snapshot version difference reported by the target client.
[0216] In one exemplary embodiment, such as Figure 9 As shown, the specific processing procedure of step 706 also includes steps 902 to 904. Wherein:
[0217] Step 902: Generate a unique identifier based on the update result, and generate synchronization confirmation information based on the unique identifier and the resource information of the target resource.
[0218] In implementation, the target client has a pre-defined mapping between update results and unique identifiers. The target client generates a unique identifier based on this mapping and the mapping between update results and unique identifiers. Then, the target client generates synchronization confirmation information based on the unique identifier and the resource information of the target resource.
[0219] Step 904: Based on the target listener, send a synchronization confirmation message to the service governance platform.
[0220] During implementation, the target client sends synchronization confirmation information to the service governance platform through the target listener and the network.
[0221] In this embodiment, a two-way confirmation mechanism (request ACK + push ACK) between the server (service governance platform) and the client (target client) ensures that resource changes take effect atomically and are synchronized in real time.
[0222] In one exemplary embodiment, Figure 10 This is a swimlane diagram of a resource query method in an exemplary embodiment. For example... Figure 10 As shown, the execution entities of this resource query method are the client and the service governance platform. The service governance platform includes Delivery (resource delivery) service, Snapshot caching, and resource management service. The specific processing flow of this resource query method includes:
[0223] Step 1001: The client assembles the query parameters and initiates a resource query service. The query parameters include the current node ID, resource namespace, and type. If a resource with a specific name and version needs to be queried, the resource name and version must also be specified.
[0224] Step 1002: The client checks if the corresponding resource exists in the local disaster recovery directory. If the resource exists, it is returned directly; otherwise, step 1003 is executed. The client possesses disaster recovery capabilities. When the server is unavailable, it can read the resource file from the local disaster recovery directory and return it first, ensuring the ability to handle resource changes.
[0225] Step 1003: The client initiates a resource query request to the service governance platform.
[0226] Step 1004: The resource delivery service sends a resource query request to the Snapshot cache. To improve resource response speed, the server caches the version (i.e., Snapshot) of the specified resource.
[0227] Step 1005: Check if the specified version of the resource exists in the Snapshot cache. If the specified version of the resource exists, the Snapshot cache returns the resource directly; if the specified version of the resource does not exist, proceed to step 1006 below.
[0228] Step 1006: The resource management service retrieves the specified version of the resource from the database.
[0229] Step 1007: The resource management service synchronizes the resources with the specified names and versions found on the server to the delivery service.
[0230] Step 1008: The Delivery service responds to the client's request and synchronizes the resource with the specified name and version to the target client.
[0231] Both steps 1003 and 1008 above involve a versioned caching and bidirectional ACK strong consistency protocol. The request structure for step 1003 is shown below:
[0232] message Request {
[0233] / / Node information that sent the request
[0234] Node node = 1;
[0235] / / Request Scope
[0236] enum Scope {
[0237] / / Retrieve by resource type
[0238] KIND = 0;
[0239] / / Retrieve by specified resource name
[0240] RESOURCE = 1;
[0241] }
[0242] Scope scope = 2;
[0243] / / Resource type
[0244] string type_url = 3;
[0245] / / Resource Tags
[0246] map<string, string> labels = 4;
[0247] / / key is the resource name, value is the version information
[0248] map<string, string> resource_name_versions = 5;
[0249] / / Resource namespace
[0250] string namespace = 6;
[0251] / / Resource group name
[0252] string group = 7;
[0253] / / ACK / NACK specific response
[0254] string response_nonce = 8;
[0255] / / Proxy configuration loading failed (while processing the previous configuration), ACK is empty.
[0256] google.rpc.Status error_detail = 9;
[0257] / / Whether to store the associated resources together with the current resource and return the result.
[0258] bool with_referenced_annotation = 10;
[0259] enum Method {
[0260] / / Push
[0261] PUSH = 0;
[0262] / / Pull
[0263] PULL = 1;
[0264] }
[0265] Method method = 11;
[0266] }
[0267] The information structure of step 1008 is as follows:
[0268] message Response {
[0269] / / Actual resource configuration
[0270] repeated Resource resources = 1;
[0271] / / Resource type
[0272] string type_url = 2;
[0273] / / Unique identifier used to confirm the response
[0274] string nonce = 3;
[0275] }
[0276] message Resource {
[0277] / / Resource Name
[0278] string name = 1;
[0279] / / Resource alias
[0280] repeated string aliases = 2;
[0281] / / Resource Version
[0282] string version = 3;
[0283] / / Resource Content
[0284] bytes resource = 4;
[0285] }
[0286] In one exemplary embodiment, Figure 11 This is a swimlane diagram of a resource management method in an exemplary embodiment. For example... Figure 11 As shown, the execution entities of this resource management method are the client and the service governance platform. The service governance platform includes Delivery (resource delivery) service, Snapshot caching, and resource management service. The user is the user terminal. The specific processing flow of this resource management method includes:
[0287] Step 1101: The client assembles the parameters of the resource to be monitored and sends a monitoring request containing these parameters to the service governance platform. The parameters of the resource to be monitored include the current node ID, resource namespace and type, and the name and version of the locally cached resource. If a resource with a specific name and version needs to be monitored, the resource name and version must be explicitly specified.
[0288] Step 1102: In response to the listening request, the service governance platform binds a watch listener to the local resource to be monitored on the service governance platform.
[0289] Step 1103: The user terminal publishes the target resource to the resource management service. The user terminal publishes the resource through the interface provided by the service governance plane; only the published resource is available to external users.
[0290] Step 1104: The resource management service saves the target resource and archives the historical resources corresponding to the target resource in a versioned manner.
[0291] Step 1105: The resource management service asynchronously triggers the resource change listener, which then starts processing resource change events.
[0292] Step 1106: The Snapshot cache encapsulates the resource as a change event and broadcasts the change event of the resource to the internal cluster.
[0293] Step 1107: Snapshot cache matches the watch listener (target listener) corresponding to the historical resource by resource namespace, type, tag, or resource name.
[0294] Step 1108: Snapshot cache responds to resource changes and refreshes the cache.
[0295] Step 1109: The Delivery service synchronizes resource change events to the client. These change types include addition, modification, deletion, and degradation.
[0296] Step 1110: The client processes resource change events. Specifically, if it's a delete event, the resource is deleted from the local cache; if it's an add or modify event, the local cache is refreshed.
[0297] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0298] Based on the same inventive concept, this application also provides a resource management device for implementing the resource management method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more resource management device embodiments provided below can be found in the limitations of the resource management method described above, and will not be repeated here.
[0299] In one exemplary embodiment, such as Figure 12 As shown, a resource management device 1200 is provided, including: an acquisition module 1201, a filtering module 1202, and a synchronization module 1203, wherein:
[0300] The acquisition module 1201 is used to acquire resource change instructions, encapsulate the change type and target resource carried in the resource change instructions, and obtain resource change events.
[0301] The filtering module 1202 is used to determine the resource to be changed corresponding to the target resource, and to filter the target listeners that listen to the resource to be changed among the listeners.
[0302] The synchronization module 1203 is used to update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
[0303] In one exemplary embodiment, the resource management device 1200 further includes:
[0304] The first parsing module is used to receive listening requests sent by each client and parse each listening request to obtain the listening parameters.
[0305] The binding module is used to determine the resources to be bound in each resource based on the listening parameters, and to bind the listener to the resources to be bound according to the listening request.
[0306] In an exemplary embodiment, the binding module is specifically used to determine the resource to be bound among the resources based on the resource namespace and resource type in the listening parameters; construct a listening object based on the node identifier corresponding to the client, the resource namespace, resource type and resource version of the resource to be bound; bind a listener to the resource to be bound based on the listening object, and update the listening object to the listening list.
[0307] In one exemplary embodiment, the resource management device 1200 further includes:
[0308] The save module is used to save the target resource in the resource change instruction and to version the resource to be changed.
[0309] The startup module is used to trigger the listener corresponding to the resource to be changed, and to start processing the event of the change of the resource.
[0310] In one exemplary embodiment, the resource management device 1200 further includes:
[0311] The first receiving module is used to receive synchronization confirmation information for resource change events returned by the target client.
[0312] The first update module is used to update the number of synchronization attempts for the target resource if the synchronization confirmation information indicates that the target resource update has failed.
[0313] The second execution module is used to execute the steps of synchronizing resource change events to the target client corresponding to the target listener through the target listener, until the number of synchronizations after the update exceeds the preset number of synchronizations threshold or the target resource is successfully updated.
[0314] In one exemplary embodiment, such as Figure 13 As shown, a resource management device 1300 is provided, including: a receiving module 1301, a determining module 1302, and a feedback module 1303, wherein:
[0315] The receiving module 1301 is used to receive resource update events. The resource update event is obtained by the service governance platform from the resource change instruction, which encapsulates the change type and target resource carried in the resource change instruction to obtain the resource change event; determines the resource to be changed corresponding to the target resource, and selects the target listener to listen to the resource to be changed from among the listeners; updates the resource to be changed according to the target resource, and synchronizes the resource change event through the target listener.
[0316] The determination module 1302 is used to determine the resource to be updated in the target client based on the target resource carried by the resource update event, and update the resource to be updated based on the target resource to obtain the update result.
[0317] Feedback module 1303 is used to generate synchronization confirmation information based on the update results and return the synchronization confirmation information to the service governance platform.
[0318] In one exemplary embodiment, the resource management device 1300 further includes:
[0319] The building module is used to construct the listening parameters for each type of resource to be monitored, based on the node identifier of the node where the target client is located, the resource namespace, resource type, resource name, and resource version.
[0320] The sending module is used to send listening requests for the resources to be monitored to the service governance platform based on the listening parameters.
[0321] In one exemplary embodiment, the feedback module 1303 includes:
[0322] The generation submodule is used to generate a unique identifier based on the update result, and to generate synchronization confirmation information based on the unique identifier and the resource information of the target resource.
[0323] The sending submodule is used to send synchronization confirmation information to the service governance platform based on the target listener.
[0324] Each module in the aforementioned resource management device 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 operations corresponding to each module.
[0325] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 14As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational 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 a 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 used for resource management methods. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a resource management method.
[0326] Those skilled in the art will understand that Figure 14 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.
[0327] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0328] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0329] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0330] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0331] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0332] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A resource management method, characterized in that, The method is applied to a service governance platform, and the method includes: Obtain a resource change instruction, encapsulate the change type and the target resource carried by the resource change instruction to obtain a resource change event; Identify the resource to be changed corresponding to the target resource, and filter the target listeners that listen to the resource to be changed from among the listeners; the resource to be changed is a new version of the application; Determine the resource version currently held by the target client corresponding to the target listener, compare the resource version with the current version of the resource to be changed, and choose to push the full version of the resource or the differentiated version of the resource to the target client; Update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
2. The method according to claim 1, characterized in that, Before obtaining the resource change instruction, the method further includes: Receive listening requests sent by each client, and parse each listening request to obtain listening parameters; Based on the listening parameters, determine the resource to be bound among the resources, and bind the listener to the resource to be bound according to the listening request.
3. The method according to claim 2, characterized in that, The step of determining the resource to be bound among the resources according to the listening parameters, and binding the listener to the resource to be bound according to the listening request, includes: Based on the resource namespace and resource type in the monitoring parameters, determine the resource to be bound among each resource; A listening object is constructed based on the node identifier corresponding to the client, the resource namespace, resource type, and resource version of the resource to be bound. Based on the listener being bound to the resource to be bound, the listener is updated to the listener list.
4. The method according to claim 1, characterized in that, After determining the resource to be changed corresponding to the target resource, the method further includes: Save the target resource in the resource change instruction and archive the resource to be changed in a versioned manner; Trigger the listener corresponding to the resource to be changed, and start processing the event of the change of the resource to be changed.
5. The method according to claim 1, characterized in that, After synchronizing the resource change event to the target client corresponding to the target listener through the target listener, the method further includes: Receive synchronization confirmation information for the resource change event returned by the target client; If the synchronization confirmation information indicates that the target resource update has failed, then the synchronization count of the target resource is updated. The step of synchronizing the resource change event to the target client corresponding to the target listener through the target listener is performed until the number of synchronizations after the update exceeds the preset number of synchronizations threshold or the target resource is successfully updated.
6. A resource management method, characterized in that, The method is applied to the target client, and the method includes: The system receives resource update events. These events occur when the service governance platform receives a resource change instruction, encapsulates the change type and target resource carried in the instruction, and obtains the resource change event. It then determines the resource to be changed corresponding to the target resource and selects a listener to listen to it. The resource to be changed is a new version of the application. The system determines the current resource version held by the target client corresponding to the target listener and compares it with the current version of the resource to be changed. It then selects to push either the full version or a different version of the resource to the target client. Finally, it updates the resource to be changed according to the target resource and synchronizes the resource change event through the target listener. Based on the target resource carried by the resource update event, the resource to be updated is determined in the target client, and the resource to be updated is updated according to the target resource to obtain the update result; Based on the update result, a synchronization confirmation message is generated and returned to the service governance platform.
7. The method according to claim 6, characterized in that, The target client contains resources of various resource types to be monitored. Before receiving resource update events, the method further includes: For each type of resource to be monitored, monitoring parameters for the resource to be monitored are constructed based on the node identifier of the node where the target client is located, the resource namespace, resource type, resource name, and resource version of the resource to be monitored. Based on the monitoring parameters, a monitoring request for the resource to be monitored is sent to the service governance platform.
8. The method according to claim 6, characterized in that, The step of generating synchronization confirmation information based on the update result and returning the synchronization confirmation information to the service governance platform includes: A unique identifier is generated based on the update result, and a synchronization confirmation message is generated based on the unique identifier and the resource information of the target resource. Based on the target listener, the synchronization confirmation information is sent to the service governance platform.
9. A resource management device, characterized in that, The device is used in a service governance platform, and the device includes: The acquisition module is used to acquire resource change instructions, encapsulate the change type and the target resource carried by the resource change instructions to obtain resource change events. The filtering module is used to determine the resource to be changed corresponding to the target resource, and filter the target listeners listening to the resource to be changed from among the listeners; determine the resource version currently held by the target client corresponding to the target listener, compare the resource version with the current version of the resource to be changed; and select to push the full version of the resource or the differentiated version of the resource to the target client; the resource to be changed is a new version of the application; The synchronization module is used to update the resource to be changed according to the target resource, and synchronize the resource change event to the target client corresponding to the target listener through the target listener.
10. A resource management device, characterized in that, The device is used in a server, and the device includes: A receiving module is used to receive resource update events. These events occur when the service governance platform receives a resource change instruction, encapsulates the change type and target resource carried in the instruction, and obtains the resource change event. The module then determines the resource to be changed corresponding to the target resource and selects a listener to listen to it. The resource to be changed is a new version of the application. The module further determines the current resource version held by the target client corresponding to the target listener, compares this version with the current version of the resource to be changed, and selects to push either a full version or a different version of the resource to the target client. Finally, the module updates the resource to be changed according to the target resource and synchronizes the resource change event through the target listener. The determination module is used to determine the resource to be updated in the target client based on the target resource carried by the resource update event, and update the resource to be updated based on the target resource to obtain the update result; The feedback module is used to generate synchronization confirmation information based on the update result and return the synchronization confirmation information to the service governance platform.