Method and device for thermally changing configuration of API (Application Program Interface) gateway

The API gateway configuration changes are initiated through the page-based interface, and the event bus and polling mechanism are used to ensure the success and failure feedback of configuration updates, which solves the problem that grayscale release and small traffic verification cannot be achieved during the hot update of the API gateway configuration, and improves the reliability of user experience and configuration changes.

CN119922079APending Publication Date: 2025-05-02BEIJING BAIJU YIXING TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510076332.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

When configuring hot updates, existing API gateways cannot implement configuration grayscale publishing and small traffic verification, resulting in increased damage caused by incorrect configuration and cannot quickly feedback the configuration changes to users, reducing user experience.

Method used

The configuration change is initiated through the page-based interface, and a notification is issued to the API gateway node to complete the configuration change. The API gateway node sends configuration update instructions to the child process through the event bus to realize the configuration memory write and local version storage, and check the subprocess configuration version by polling. If it succeeds, it will overwrite the local storage configuration file and back up the historical version. If it fails, it will not operate and return the failed result.

Benefits of technology

The thermal changes in API gateway configuration are realized, reducing the damage caused by incorrect configuration, improving user experience, and able to quickly feedback the configuration change results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119922079A_ABST
    Figure CN119922079A_ABST
Patent Text Reader

Abstract

The invention relates to the field of gateway configuration, and discloses a method and a device for configuration hot change of an AP I gateway, which are used for solving the problem that a hot update result cannot be synchronously returned to a user when gateway configuration hot change is carried out, and the method comprises the following steps: initiating configuration change through a page interface, and sending a configuration change completion notification to an API gateway node, and after receiving the configuration change notification, the API gateway node sends a configuration update instruction to each sub-process, performs writing update in the current process of the AP I gateway according to the update instruction, configures a version file after the update is finished, and covers the current configuration file in the local storage if the configuration change is successful, so that the current configuration file in the local storage is not covered. Creating a new configuration file with a version number as a historical version backup; and if the change configuration is judged to be failed, the local storage is not operated, and then the change result of the current time is returned through the interface, so that the risk expansion possibility is effectively reduced, and the user experience is improved at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of gateway configuration, and more specifically to a method and device for hot changing the configuration of an API gateway. Background Art

[0002] Hot configuration change refers to dynamically updating the configuration of an application without stopping or restarting the application so that the new configuration can take effect immediately. This method can adjust the behavior or parameter configuration of the system without interrupting the service to cope with changing business needs or system environment. At present, many companies use API gateways as the only entry point for external access to the company's internal service APIs, and provide API routing, load balancing, API management, API interface configuration information hot update and other functions through API gateways. Among them, hot update of API interface configuration information is the core capability of API gateways, which provides a convenient method for configuration management of API interfaces of large-scale API gateway clusters.

[0003] However, when enterprises use API gateway, since it is the only entry point, a configuration change on the API gateway that contains errors has a huge risk of directly affecting the entire API gateway cluster and even causing the service to be completely unavailable. At the same time, whether the API interface configuration change is effective cannot be directly and quickly fed back to the user, which reduces the configuration and usage experience of the API gateway.

[0004] For example, a Chinese patent with publication number CN108965007A discloses an API gateway interface configuration update method and device, and the implementation steps are as follows: writing the configuration information of the API interface into a distributed configuration center; when the API gateway is started, obtaining the configuration information of each API interface included in the API gateway from the distributed configuration center; when the configuration information of the API interface written in the distributed configuration center is updated, the corresponding API interface obtains the updated configuration information from the distributed configuration center.

[0005] The above patent has the problem raised by this background technology: the update order of nodes in the API gateway is flexible. The core component of API configuration hot update is not the configuration center. When the configuration content is updated to the configuration center, it is impossible to freely control which nodes connected to the configuration center are updated and which are not updated, and it is impossible to realize the gray release of configuration and the small traffic verification of configuration, which increases the possibility of damage expansion caused by wrong configuration; and the results of API configuration hot update cannot be synchronously returned to the user, and the user experience is poor.

[0006] In view of the above problems, the present invention proposes a solution. Summary of the invention

[0007] In order to overcome the above-mentioned defects of the prior art, the present invention provides a method and device for hot configuration change of an API gateway to solve the problems existing in the above-mentioned background technology.

[0008] To achieve the above object, the present invention provides the following technical solutions:

[0009] A method for hot changing the configuration of an API gateway comprises the following steps:

[0010] Step 1: Initiate configuration changes through the page interface to control service execution operations, including configuration verification, configuration version storage, node list acquisition and task creation, configuration push, and result feedback;

[0011] Step 2: Send a configuration change completion notification to the API gateway node, where the content of the notification includes the configuration version to be applied and the specific configuration content;

[0012] Step 3: After receiving the configuration change notification, the API gateway node sends configuration update instructions to each sub-process of the API gateway through the event bus;

[0013] Step 4: According to the update instruction, write updates are performed in the current process of the API gateway, and the write updates include configured memory writes, local version writes, and update status writes;

[0014] Step 5: After writing the update, poll the locally stored sub-process configuration version file to determine whether all sub-processes have been updated to the latest version;

[0015] Step 6: If the configuration change is determined to be successful in step 5, the current configuration file in the local storage is overwritten, and then a new configuration file with a version number is created as a historical version backup; if the configuration change is determined to be a failure, the local storage is not operated, and the change result is returned through the http interface provided by the control system.

[0016] Preferably, after receiving the configuration change notification, the API gateway node sends a configuration update instruction to each sub-process of the API gateway through the event bus:

[0017] The API gateway node receives a configuration change notification from the control service, which includes the configuration version number and configuration content that need to be updated;

[0018] The gateway node parses the received change notification and extracts the new configuration content and version information;

[0019] The gateway node uses the new configuration content as an event message and publishes a configuration update event through the event bus. The event contains the new configuration and version number to be applied.

[0020] Each subprocess of the API gateway listens for configuration update events on the event bus. When a new configuration update event is released, the subprocess receives the event.

[0021] After receiving the configuration update instruction, each child process loads the new configuration into memory to replace the old configuration;

[0022] After successfully applying the new configuration, the child process sends a confirmation message back to the main process;

[0023] The main process collects confirmation information from each subprocess and checks whether all subprocesses have successfully applied the new configuration. If any subprocess fails to update successfully, it tries to push the configuration again.

[0024] After the update process is completed, the master process records the results of the configuration update in the log and feeds back to the system administrator through the management interface.

[0025] Preferably, the step of writing the update in the current process of the API gateway according to the update instruction is:

[0026] After receiving the update instruction, the new API routing, load balancing policy, and security policy configuration data are written into the memory of the current process, and the old configuration in the memory is replaced with the new configuration;

[0027] After the memory is written successfully, the version number and timestamp of the new configuration are recorded in the local version control file, the new configuration content is saved as a file with a version number, and the old version of the configuration is saved as a historical backup;

[0028] After the memory and local storage are updated, the results of the configuration update are recorded in the log;

[0029] If the update is successful, report the success to the management system and attach the version number of the new configuration. If an error occurs during the update process, report the error details.

[0030] Preferably, the step of determining whether all sub-processes are updated to the latest version by polling the sub-process configuration version file stored locally is:

[0031] The main process starts a polling task and defines the polling interval and the total polling timeout;

[0032] During each poll, the main process reads the configuration version file corresponding to each child process from local storage;

[0033] Compare the read subprocess configuration version number with the latest configuration version number. If the version numbers recorded in the version files of all subprocesses are consistent with the latest version number, the configuration change is considered successful. If the version number of a subprocess is inconsistent with the latest version number, the configuration change is considered to have failed, and polling continues until the set polling timeout occurs, in which case the configuration change is considered to have failed.

[0034] If all subprocesses are successfully updated, the update is reported to be successful and the polling ends; if the update fails or times out, the reason for the failure is recorded and the failure information is fed back to the management system.

[0035] Preferably, the steps of overwriting the current configuration file in the local storage and then creating a new configuration file with a version number as a historical version backup are:

[0036] After confirming that the configuration change is successful, prepare the latest configuration data file, which includes configuration data and version information;

[0037] Locate the path of the current configuration file, write the new configuration data to the current configuration file in the local storage, replace the old configuration content, and ensure that the current configuration file contains the latest configuration content and takes effect in the system;

[0038] After successfully overwriting the current configuration file, create a configuration file with a version number as a backup of the historical version, name the new backup file with the current version number, copy the current configuration content just overwritten to the newly created backup file, and store the backup file in the specified backup directory;

[0039] A log recording the configuration overwrite and backup operation, including the operation time, overwritten file name, created backup file name, and version number information.

[0040] Preferably, the step of transmitting the change result this time through the http interface provided by the control system is:

[0041] If the change is successful, prepare data containing the success status, the changed version number, and the change time information; if the change fails, prepare data containing the failure status, error code, error message, and time information;

[0042] Determine the URL of the HTTP interface provided by the control system;

[0043] Construct an HTTP request and use the POST method to send the prepared change result data as the body of the request;

[0044] Send the constructed HTTP request data to the specified URL through the network, wait for and receive the response from the control system, and confirm the change result;

[0045] If the control system returns a successful response code, record the successful operation; if the control system returns an error response code, record the error information and retry according to the situation;

[0046] Record the sent request data, control system response time, response content, and success or failure status information in the log;

[0047] If the feedback is successful, notify the relevant parties that the change has been successfully completed; if the feedback fails, notify the relevant parties for further investigation.

[0048] Preferably, a device for hot-changing the configuration of an API gateway comprises:

[0049] The page interface module is used to provide a user interface to allow users to initiate configuration changes. Users can enter and submit new configuration content through this interface, and the current configuration status and changeable configuration options are displayed. It receives user change requests and submits them to the control service, and is connected to the control service module;

[0050] The control service module is responsible for executing the configuration change request initiated by the user and is connected to the notification management module and the result feedback module;

[0051] The notification management module is used to send configuration change notifications to the API gateway node and is connected to the event bus module;

[0052] The event bus module is used to receive change notifications from the notification management module, broadcast configuration update instructions to each sub-process of the API gateway, and is connected to the process update module;

[0053] The process update module is responsible for applying the new configuration in the current process of the API gateway and is connected to the polling check module and the configuration storage management module;

[0054] The polling check module is used to check the configuration update status of each sub-process through a polling mechanism after the configuration update is completed, and is connected to the process update module and the result feedback module;

[0055] The configuration storage management module is used to write the new configuration to the current configuration file after confirming that the update is successful, create a configuration file with a version number as a backup, and is connected to the process update module and the result feedback module;

[0056] The result feedback module is used to send the change results back to the control system through the HTTP interface, record the feedback log, and is connected to the control service module.

[0057] Technical effects and advantages of the present invention:

[0058] Configuration changes are initiated through the paged interface, and a configuration change completion notification is sent to the API gateway node. After receiving the configuration change notification, the API gateway node sends configuration update instructions to each child process. According to the update instructions, the update is written in the current process of the API gateway. After the update is completed, the configuration version file is configured. If the configuration change is successful, the current configuration file in the local storage is overwritten, and a new configuration file with a version number is created as a historical version backup; if the configuration change is determined to be a failure, the local storage is not operated, and the change result interface is then returned, which effectively reduces the possibility of risk expansion and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 It is the overall flow chart of the present invention.

[0060] Figure 2 It is the overall module structure diagram of the present invention. DETAILED DESCRIPTION

[0061] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the present invention. In addition, the forms of the various structures recorded in the following implementation modes are merely illustrative. The method and device for hot configuration change of an API gateway involved in the present invention are not limited to the various structures recorded in the following implementation modes. All other implementation modes obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0062] The present invention provides a method for hot changing the configuration of an API gateway, comprising the following steps:

[0063] Step 1: Initiate configuration changes through the page interface to control service execution operations, including configuration verification, configuration version storage, node list acquisition and task creation, configuration push, and result feedback;

[0064] The paged interface refers to a method of performing operations through a graphical user interface (GUI) or web page interface, rather than through a command line interface or script. Such an interface usually has a friendly and intuitive design, and users can complete tasks by clicking buttons, selecting menus, filling out forms, etc., without having to enter complex commands or codes.

[0065] The configuration verification is to verify the validity of the associated application data and routes, as well as the conflicts between the routes and other configurations;

[0066] The configuration version storage is to store the configuration in a versioned manner;

[0067] The node list acquisition and task creation are to acquire the API gateway node list that needs to be changed and create a configuration release task;

[0068] The push configuration is to push new configuration to the API gateway;

[0069] The result is transmitted back to receive the configuration update result of the API gateway and display it to the user.

[0070] Step 2: Send a configuration change completion notification to the API gateway node, where the content of the notification includes the configuration version to be applied and the specific configuration content;

[0071] Step 3: After receiving the configuration change notification, the API gateway node sends configuration update instructions to each sub-process of the API gateway through the event bus;

[0072] In this embodiment, it should be specifically explained that after receiving the configuration change notification, the API gateway node sends the configuration update instruction to each sub-process of the API gateway through the event bus in the following steps:

[0073] The API gateway node receives a configuration change notification from the control service or management interface, which includes the configuration version number and configuration content that need to be updated;

[0074] The gateway node parses the received change notification and extracts the new configuration content and version information, which includes specific configuration items such as routing rules, load balancing settings, and security policies, to ensure that the gateway node accurately obtains the configuration information that needs to be updated;

[0075] The gateway node uses the new configuration content as an event message and publishes a configuration update event through an event bus (such as an internal message queue or bus system). The event contains the new configuration and version number to be applied, so that all child processes can receive the update instruction;

[0076] Each child process of the API gateway listens for configuration update events on the event bus. When a new configuration update event is released, the child process receives the event to ensure that each child process can receive configuration change notifications in a timely manner.

[0077] After receiving the configuration update instruction, each child process loads the new configuration into memory to replace the old configuration;

[0078] After successfully applying the new configuration, the sub-process sends confirmation information (such as the new configuration version number) back to the main process or event bus, indicating that the configuration update of the sub-process is complete, ensuring the transparency and traceability of the configuration update process, and the main process or management system can understand the status of the configuration update in real time;

[0079] The main process or management service collects confirmation information from each sub-process and checks whether all sub-processes have successfully applied the new configuration. If a sub-process fails to update successfully, it records the error or tries to push the configuration again to ensure that all sub-processes are updated synchronously to avoid operation problems caused by inconsistent configurations.

[0080] After the update process is completed, the main process records the result of the configuration update (success or failure) in the log and feeds it back to the operation and maintenance personnel or system administrator through the management interface or console to ensure the traceability of the update process and provide timely feedback to the user.

[0081] In this embodiment, it should be specifically explained that the steps of loading the new configuration into the memory to replace the old configuration are:

[0082] Load new API routing rules;

[0083] Update the load balancing strategy;

[0084] Modify the security policy or traffic control rules.

[0085] Step 4: According to the update instruction, write updates are performed in the current process of the API gateway, and the write updates include configured memory writes, local version writes, and update status writes;

[0086] In this embodiment, it should be specifically explained that the steps of writing and updating in the current process of the API gateway according to the update instruction are:

[0087] After receiving the update instruction, write the new API routing, load balancing policy, security policy and other configuration data into the memory of the current process, replace the old configuration in the memory with the new configuration, ensure that subsequent API requests are processed using the new configuration, make the new configuration take effect immediately in the current process, and ensure that subsequent requests use the latest configuration parameters;

[0088] After the memory is written successfully, the version number and timestamp of the new configuration are recorded in the local version control file, and the new configuration content is saved as a file with a version number. For example, the file name can be "config_v2.0.json", and the old version of the configuration is saved as a historical backup so that it can be rolled back when necessary to ensure the traceability and recoverability of the configuration;

[0089] After the memory and local storage are updated, the success or failure of the configuration update is recorded in the status file or log. If the update is successful, it is recorded as a success status; if it fails, the reason for the failure is recorded; a flag is set in the local storage to indicate which version the current configuration has been updated to for subsequent inspection;

[0090] If the update is successful, report the success to the management system and attach the version number of the new configuration. If an error occurs during the update process, report the error details to facilitate analysis and processing by operation and maintenance personnel, ensuring that the overall process of configuration changes is controllable and transparent.

[0091] Step 5: After writing the update, poll the locally stored sub-process configuration version file to determine whether all sub-processes have been updated to the latest version;

[0092] In this embodiment, it should be specifically explained that the step of determining whether all sub-processes are updated to the latest version by polling the sub-process configuration version file stored locally is as follows:

[0093] The main process starts a polling task, defines the polling interval, such as checking every few seconds, and defines the total polling timeout to avoid unlimited waiting. For example, set the total polling time to 5 minutes;

[0094] The polling task is a timed check mechanism started by the main process, which is responsible for regularly reading the configuration version files of each subprocess to confirm whether all subprocesses have successfully applied the latest configuration version. If the configuration versions of all subprocesses match the target version within the set polling time, the configuration update is considered successful; otherwise, the polling task will continue to run until it times out or a failure is detected.

[0095] During each poll, the main process reads the configuration version file corresponding to each child process from local storage;

[0096] Compare the read subprocess configuration version number with the latest configuration version number. If the version numbers recorded in the version files of all subprocesses are consistent with the latest version number, the configuration change is considered successful. If the version number of a subprocess is inconsistent with the latest version number, the configuration change is considered to have failed, and polling continues until the set polling timeout, in which case the configuration change is considered to have failed.

[0097] If all child processes are successfully updated, the update is reported to be successful and the polling ends. If the update fails or times out, the reason for the failure is recorded and the failure information is fed back to the management system, which may require triggering a rollback or manual intervention.

[0098] Step 6: If the configuration change is determined to be successful in step 5, the current configuration file in the local storage is overwritten, and then a new configuration file with a version number is created as a historical version backup; if the configuration change is determined to be a failure, the local storage is not operated, and the change result is returned through the http interface provided by the control system.

[0099] In this embodiment, it should be specifically explained that the steps of overwriting the current configuration file in the local storage and then creating a new configuration file with a version number as a historical version backup are:

[0100] After confirming that the configuration change is successful, prepare the latest configuration data file, which includes configuration data and version information;

[0101] Locate the path of the current configuration file, write the new configuration data to the current configuration file in the local storage, replace the old configuration content, and ensure that the current configuration file contains the latest configuration content and takes effect in the system;

[0102] After successfully overwriting the current configuration file, create a configuration file with a version number as a backup of the historical version, name the new backup file with the current version number, copy the current configuration content just overwritten to the newly created backup file, and store the backup file in the specified backup directory to facilitate future version rollback or historical record query;

[0103] Record the log of the configuration overwrite and backup operation to ensure the operation process is transparent and traceable. The log includes information such as operation time, overwritten file name, created backup file name and version number to facilitate subsequent auditing and troubleshooting.

[0104] In this embodiment, it should be specifically explained that the step of transmitting the change result this time through the http interface provided by the control system is:

[0105] If the change is successful, prepare data containing information such as the success status, the changed version number, and the change time; if the change fails, prepare data containing information such as the failure status, error code, error message, and time;

[0106] Determine the URL of the HTTP interface provided by the control system, which is usually a fixed interface address for receiving change results;

[0107] Construct an HTTP request and use the POST method to send the prepared change result data as the body of the request (usually in JSON format);

[0108] Send the constructed HTTP request data to the specified URL through the network, wait for and receive the response of the control system, and confirm whether the change result is successfully submitted;

[0109] If the control system returns a successful response code (such as 200OK), record the operation successfully; if the control system returns an error response code, record the error information and decide whether to retry or trigger an alarm according to the situation;

[0110] Record the request data sent, the control system's response time, the response content, and the success or failure status in the log for subsequent tracking and auditing;

[0111] If the feedback is successful, the relevant parties are notified that the change has been successfully completed; if the feedback fails, the relevant parties are notified and manual intervention or further investigation may be required.

[0112] In this embodiment, it is necessary to specifically explain a device for hot configuration change of an API gateway, the device comprising:

[0113] The page interface module is used to provide a user-friendly interface, allowing users to initiate configuration changes. Users enter and submit new configuration content through this interface, and display the current configuration status and changeable configuration options. It receives user change requests and submits them to the control service, and is connected to the control service module;

[0114] The control service module is responsible for executing the configuration change request initiated by the user, ensuring the validity and consistency of the configuration, and is connected to the notification management module and the result feedback module;

[0115] The notification management module is used to send configuration change notifications to the API gateway nodes to ensure that each node can receive the latest configuration version and is connected to the event bus module;

[0116] The event bus module is used to receive change notifications from the notification management module, broadcast configuration update instructions to each sub-process of the API gateway, and is connected to the process update module;

[0117] The process update module is responsible for applying the new configuration in the current process of the API gateway, ensuring that the new configuration can take effect in the memory and be stored in a versioned manner. It is connected to the polling check module and the configuration storage management module.

[0118] The polling check module is used to check the configuration update status of each sub-process through the polling mechanism after the configuration update is completed to ensure that all sub-processes have been updated to the latest version. It is connected to the process update module and the result feedback module;

[0119] The configuration storage management module is used to write the new configuration to the current configuration file after confirming that the update is successful, and create a configuration file with a version number as a backup to facilitate rollback or historical record query, and is connected to the process update module and the result feedback module;

[0120] The result feedback module is used to send the successful or failed change results back to the control system through the HTTP interface, record the feedback log for subsequent audit and analysis, and is connected to the control service module.

[0121] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0122] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for hot configuration change of an API gateway, characterized in that: The following steps are involved: Step 1: Initiate configuration changes through the page interface to control service execution operations, including configuration verification, configuration version storage, node list acquisition and task creation, configuration push, and result feedback; Step 2: Send a configuration change completion notification to the API gateway node, where the content of the notification includes the configuration version to be applied and the specific configuration content; Step 3: After receiving the configuration change notification, the API gateway node sends configuration update instructions to each sub-process of the API gateway through the event bus; Step 4: According to the update instruction, write updates are performed in the current process of the API gateway, and the write updates include configured memory writes, local version writes, and update status writes; Step 5: After writing the update, poll the locally stored sub-process configuration version file to determine whether all sub-processes have been updated to the latest version; Step 6: If the configuration change is successful in step 5, the current configuration file in the local storage is overwritten, and then a new configuration file with a version number is created as a historical version backup; If the configuration change is determined to be a failure, the local storage is not operated, and the result of this change is then transmitted back through the http interface provided by the control system.

2. According to claim 1, a method for hot configuration change of an API gateway is characterized in that: After receiving the configuration change notification, the API gateway node sends the configuration update instruction to each sub-process of the API gateway through the event bus: The API gateway node receives a configuration change notification from the control service, which includes the configuration version number and configuration content that need to be updated; The gateway node parses the received change notification and extracts the new configuration content and version information; The gateway node uses the new configuration content as an event message and publishes a configuration update event through the event bus. The event contains the new configuration and version number to be applied. Each subprocess of the API gateway listens for configuration update events on the event bus. When a new configuration update event is released, the subprocess receives the event. After receiving the configuration update instruction, each child process loads the new configuration into memory to replace the old configuration; After successfully applying the new configuration, the child process sends a confirmation message back to the main process; The main process collects confirmation information from each subprocess and checks whether all subprocesses have successfully applied the new configuration. If any subprocess fails to update successfully, it tries to push the configuration again. After the update process is completed, the master process records the results of the configuration update in the log and feeds back to the system administrator through the management interface.

3. According to claim 1, a method for hot configuration change of an API gateway is characterized in that: According to the update instruction, the steps of writing and updating in the current process of the API gateway are: After receiving the update instruction, the new API routing, load balancing policy, and security policy configuration data are written into the memory of the current process, and the old configuration in the memory is replaced with the new configuration; After the memory is written successfully, the version number and timestamp of the new configuration are recorded in the local version control file, the new configuration content is saved as a file with a version number, and the old version of the configuration is saved as a historical backup; After the memory and local storage are updated, the results of the configuration update are recorded in the log; If the update is successful, report the success to the management system and attach the version number of the new configuration. If an error occurs during the update process, report the error details.

4. According to claim 1, a method for hot configuration change of an API gateway is characterized in that: The steps of polling the locally stored sub-process configuration version file to determine whether all sub-processes are updated to the latest version are: The main process starts a polling task and defines the polling interval and the total polling timeout; During each poll, the main process reads the configuration version file corresponding to each child process from local storage; Compare the read subprocess configuration version number with the latest configuration version number. If the version numbers recorded in the version files of all subprocesses are consistent with the latest version number, the configuration change is considered successful. If the version number of a subprocess is inconsistent with the latest version number, the configuration change is considered to have failed, and polling continues until the set polling timeout occurs, in which case the configuration change is considered to have failed. If all subprocesses are successfully updated, the update is reported to be successful and the polling ends; if the update fails or times out, the reason for the failure is recorded and the failure information is fed back to the management system.

5. According to claim 1, a method for hot changing the configuration of an API gateway is characterized in that: The steps of overwriting the current configuration file in the local storage and then creating a new configuration file with a version number as a historical version backup are as follows: After confirming that the configuration change is successful, prepare the latest configuration data file, which includes configuration data and version information; Locate the path of the current configuration file, write the new configuration data to the current configuration file in the local storage, replace the old configuration content, and ensure that the current configuration file contains the latest configuration content and takes effect in the system; After successfully overwriting the current configuration file, create a configuration file with a version number as a backup of the historical version, name the new backup file with the current version number, copy the current configuration content just overwritten to the newly created backup file, and store the backup file in the specified backup directory; A log recording the configuration overwrite and backup operation, including the operation time, overwritten file name, created backup file name, and version number information.

6. According to claim 1, a method for hot configuration change of an API gateway is characterized in that: The steps of transmitting the change result through the http interface provided by the control system are as follows: If the change is successful, prepare data containing the success status, the changed version number, and the change time information; If the change fails, prepare data including the failure status, error code, error message, and time information; Determine the URL of the HTTP interface provided by the control system; Construct an HTTP request and use the POST method to send the prepared change result data as the body of the request; Send the constructed HTTP request data to the specified URL through the network, wait for and receive the response from the control system, and confirm the change result; If the control system returns a successful response code, record the successful operation; if the control system returns an error response code, record the error information and retry according to the situation; Record the sent request data, control system response time, response content, and success or failure status information in the log; If the feedback is successful, notify the relevant parties that the change has been successfully completed; if the feedback fails, notify the relevant parties for further investigation.

7. A device for hot configuration change of an API gateway, used to implement the method for hot configuration change of an API gateway as claimed in claims 1 to 6, characterized in that: The device comprises: The page interface module is used to provide a user interface to allow users to initiate configuration changes. Users can enter and submit new configuration content through this interface, and the current configuration status and changeable configuration options are displayed. It receives user change requests and submits them to the control service, and is connected to the control service module; The control service module is responsible for executing the configuration change request initiated by the user and is connected to the notification management module and the result feedback module; The notification management module is used to send configuration change notifications to the API gateway node and is connected to the event bus module; The event bus module is used to receive change notifications from the notification management module, broadcast configuration update instructions to each sub-process of the API gateway, and is connected to the process update module; The process update module is responsible for applying the new configuration in the current process of the API gateway and is connected to the polling check module and the configuration storage management module; The polling check module is used to check the configuration update status of each sub-process through a polling mechanism after the configuration update is completed, and is connected to the process update module and the result feedback module; The configuration storage management module is used to write the new configuration to the current configuration file after confirming that the update is successful, create a configuration file with a version number as a backup, and is connected to the process update module and the result feedback module; The result feedback module is used to send the change results back to the control system through the HTTP interface, record the feedback log, and is connected to the control service module.

Citation Information

Patent Citations

  • API (Application Programming Interface) gateway interface configuration updating method and device

    CN108965007A

  • Multi-tenant service gray release method and device, computer equipment and storage medium

    CN112118565A

  • Gray release method and device, equipment and storage medium

    CN113242281A

  • Method, device and equipment for realizing configuration data consistency and readable medium

    CN115756304A

  • Method and device for realizing gray release based on API (Application Program Interface) gateway

    CN117650985A