A configuration decoupling method and system based on distributed microservice architecture

By adopting the configuration decoupling method of distributed microservice architecture in commercial banks, and using configuration creation, export and download microservices, the management and sharing of commercial banking business configuration data is solved, realizing the immediate effectiveness and high availability of configuration items. Reduces coupling and conflict between systems.

CN117793177BActive Publication Date: 2024-11-22JIANGSU SUNING BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311659103.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2024-11-22
Estimated Expiration
2043-12-05

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively manage and share a large amount of business configuration data of commercial banks, resulting in data consistency and performance problems, and there are coupling and contradictions when maintaining personnel of different roles.

Method used

Adopt the configuration decoupling method based on the distributed microservice architecture, create microservices through configuration, export microservices, and download microservices to realize configuration creation, export and download, and use the shared file system to upload and download data to ensure configuration items. instant effectiveness and high availability.

Benefits of technology

It realizes independent maintenance of business configuration items and technical configuration items, solves the problem of immediate effectiveness and high availability of configuration data, reduces the complexity of shared business configurations among multiple systems, and avoids the performance risks brought by timing task synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117793177B_ABST
    Figure CN117793177B_ABST
Patent Text Reader

Abstract

The present invention proposes a configuration decoupling method and system based on a distributed microservice architecture, the method comprising the following steps: respectively designing a configuration creation microservice, a configuration export microservice and a configuration download microservice; calling a server-side interface of the configuration creation microservice, creating a new configuration in an operation interface and modifying the configuration status; the configuration export microservice identifies the configuration status, changes it to needing to be exported, and the client SDK calls a configuration upload interface to upload the exported data to a shared file system, and changes the configuration status to exported after the data upload is completed; calling a server-side interface of the configuration download microservice to query whether there is a configuration file that needs to be updated, and if so, calling a configuration download interface to obtain the latest configuration file data from the shared file system, saving it to a local file and loading it into the JVM memory, and encapsulating it into a Java object. The present invention realizes the decoupling of business configuration managers and operation and maintenance configuration managers, as well as business system code files and configuration files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed microservice technology, and in particular to a configuration decoupling method and system based on a distributed microservice architecture. Background Art

[0002] With the wave of digital transformation of commercial banks, banking business is becoming more and more online, automated and intelligent. The construction of core business systems is the fundamental link in the digital transformation of commercial banks. Only when the core business system is transformed to digitalization can the digital transformation of the bank's overall business be driven. In the development process of banking business systems, configuration items are often used to avoid hard coding in application code. For example, there are some scenarios with bounded parameter sets, such as the configuration of business enumeration value types, business table dictionary configuration, and enterprise organization configuration. For the management of configuration data in applications, the industry has the following solutions:

[0003] Solution 1) Use local configuration files: Use local configuration files, that is, add a configuration file to the application code project, and add configuration items to the configuration file. When the application is running, read the configuration item data in the file. Although this method avoids hard coding to a certain extent, it will couple the application code and configuration files together. Each time the configuration items are modified, the entire project needs to be recompiled, packaged, and deployed for the configuration to take effect. Another way to apply the configuration file is to use an external configuration file, that is, put the configuration file in a fixed directory outside the application code package and decouple it from the code. Although modifying the configuration items in this way does not require recompiling the code, it is not immediately effective and requires restarting the application to take effect.

[0004] Solution 2) Use a distributed configuration center: Using a distributed configuration center to manage application configurations can make configuration items take effect immediately after modification, and there is no need to couple configuration files and code files together. However, a distributed configuration center is generally considered to be a configuration management platform for operation and maintenance personnel, rather than for development or business operation personnel. For example, in a distributed configuration center, system environment configuration data such as database connection information, cache server connection information, and a certain application's request address are generally configured, rather than business configuration data. In addition, a distributed configuration center is not suitable for configuring a large number of configuration items, but only for maintaining a small number of configuration items. If a large amount of business data is configured in a distributed configuration center, it will lead to configuration confusion, poor maintainability, and coupling between different types of personnel, that is, there will be contradictions and conflicts between operation and maintenance personnel, developers, and operations personnel in the configuration and maintenance work. Operation and maintenance personnel cannot understand business configuration data, and operations personnel cannot understand technical configuration data. People with different roles maintain application configuration items at the same time, making the work of configuration item maintenance uncontrollable.

[0005] Solution 3) Use a relational database dictionary table: Using a database dictionary table can avoid configuration modifications being dependent on operation and maintenance personnel. Usually, developers or operators can operate it, which is also a way to decouple configuration. However, this method is strongly dependent on the relational database. Once the database goes down, configuration reading and writing will fail immediately, and it does not have high availability. In addition, the application must access the database every time it reads and writes configuration data, which will increase the performance overhead of the entire program. If you want to make changes to the dictionary table data take effect immediately, you must introduce additional third-party middleware, such as using Redis for caching. Once the Redis server goes down, read and write requests will still penetrate the database layer.

[0006] Neither solution 1 nor solution 2 or 3 is suitable for scenarios involving large-scale business configuration and configuration sharing. For example, the configuration management of departmental organizational structure data and employee data of commercial banks. Usually, multiple business systems of a bank need to use the departmental organizational structure data and employee data of the bank. This type of data has the following characteristics: 1) High business relevance. The data type tends to be business data, rather than technical data such as system environment parameters and application startup parameters. Configuration administrators are usually business personnel and operation managers. The data source is usually a business table in the business system database, and the original storage method is stored in the form of a relational database table. 2) Bounded data volume. The data volume is usually not large, and it is a limited data set rather than a growing online transaction data. 3) Low frequency of changes. It does not change frequently, but there are occasional modifications. 4) High real-time requirements. It is usually required that the configuration modification takes effect immediately or within a specified time range. 5) High sharing. Data is usually maintained in one system and used in multiple business systems.

[0007] At present, there are the following solutions to solve the problem of sharing business configuration data, that is, each business system uses a scheduled task to call the interface of the data source system, pull the required data, and store it in the database of its own system. However, this method has the following problems: 1) Data consistency problem. When the interface call is abnormal, the business data stored in the database tables of different systems will be inconsistent. 2) Performance problem. When the amount of configuration data is large, the amount of data transmitted in one interface call is too large, and there is a performance risk. If multiple systems trigger scheduled tasks to obtain data at the same time, it will cause a large number of concurrent requests, causing access pressure on the data provider, and even downtime. Summary of the invention

[0008] In view of the above problems, the present invention provides a configuration decoupling method and system based on a distributed microservice architecture, which solves the problem that the existing technical solutions are not suitable for a large number of business configurations and configuration sharing scenarios.

[0009] To solve the above technical problems, the technical solution adopted by the present invention is: a configuration decoupling method based on a distributed microservice architecture, running on a configuration decoupling system, the configuration decoupling system includes a configuration creation microservice, a configuration export microservice and a configuration download microservice, and the configuration decoupling method includes the following steps: respectively designing the configuration creation microservice, the configuration export microservice and the configuration download microservice; calling the server interface of the configuration creation microservice, creating a new configuration in the operation interface and modifying the configuration status; the configuration export microservice identifies the configuration status, changes the configuration status to need to be exported, and the client SDK calls the configuration upload interface to upload the data exported by the application system to a shared file system, and changes the configuration status to exported after the data upload is completed; calling the server interface of the configuration download microservice to query whether there is a configuration file that needs to be updated, and if so, calling the configuration download interface to obtain the latest configuration file data from the shared file system, saving it to a local file and loading it into the JVM memory, encapsulating it into a Java object for use by each application system.

[0010] As a preferred solution, the configuration creation microservice includes a first server-side data model and a first server-side interface. Then: the first server-side data model is designed, specifically: the first server-side data model is designed based on the data export configuration table, and the data export configuration table includes a configuration id identifier, an application id identifier, an application database name, an application database table name, a configuration export status, and an effective field; the first server-side interface is designed, specifically: the input parameters and output parameters of the first server-side interface are configured, and the input parameters include the application id, the database name, and the data table name, and the output parameters include response information and a response code.

[0011] As a preferred solution, the configuration export microservice includes a second client SDK, a second server interface and a second server data model. Then: the second client SDK is designed, specifically: based on the SDK export tag interface, the method of the interface implementation class is defined and the signature is agreed upon to complete the data query logic; an SDK export tag interface processor is provided, the SDK export tag interface is called, and the Map type data obtained by the query is uploaded to the shared file server.

[0012] As a preferred solution, the working steps of the SDK export tag interface processor include: 1) loading the implementation class of the SDK export tag interface when the application system starts, and obtaining the instance list of the implementation class of the SDK export tag interface according to the instance type through the getBeansOfType method of the Spring container; 2) obtaining the method list of the implementation class of the SDK export tag interface through the Java reflection mechanism, parsing the method name in turn, removing the Export suffix in the method name, and encapsulating it as an ExportInfo object and storing it in a Map collection; 3) starting a scheduled task, calling the second server-side interface of the configuration export microservice in a scheduled manner, and querying the configuration name list that needs to update the data; 4) traversing the configuration name list in turn, and matching it with the Map collection, after matching the ExportInfo object, using the reflection mechanism to execute the method method of the SDK export tag interface to obtain the list data of the Map type; 5) writing the list data of the Map type into a local file in JSON format, and calling the second server-side interface of the configuration export microservice to upload the configuration data in the form of a file and store it on a shared file server.

[0013] As a preferred solution, the second server interface includes a configuration export status modification interface, a configuration update query interface, and a configuration upload interface.

[0014] As a preferred solution, the configuration download microservice includes a third client SDK and a third server interface. Then: the third client SDK is designed, specifically: based on the SDK import tag interface, the method of the interface implementation class is defined and the signature is agreed upon to complete the variable assignment logic; an SDK import tag interface processor is provided to call and pass the business configuration data to the SDK import tag interface to complete the actual assignment.

[0015] As a preferred solution, the working steps of the SDK import tag interface processor include: 1) loading the implementation class of the SDK import tag interface when the application system starts, and obtaining the instance list of the implementation class of the SDK import tag interface according to the instance type through the getBeansOfType method of the Spring container; 2) obtaining the method list of the implementation class of the SDK import tag interface through the Java reflection mechanism, parsing the method name, method parameters, and generic type of the parameters in turn, removing the Import suffix in the method name, and encapsulating it as an ImportInfo object and storing it in a Map collection; 3) starting a scheduled task, calling the third server interface of the configuration import microservice regularly, and querying the updated configuration data list; 4) traversing the configuration data list in turn, calling the third server interface of the configuration import microservice to download the corresponding configuration file, and storing it in the local disk in YAML format; 5) after matching the ImportInfo object according to the configuration name from the Map collection, reading the file stored in the local disk according to the file name, and completing the conversion of the YAML format data to the object list data according to the mappingClass mapping, and finally using the reflection mechanism to execute the method method of the SDK import tag interface to assign the object list data to the global variable.

[0016] As a preferred solution, the third server interface includes a configuration update query interface and a configuration download interface. The third server interface of the timed call configuration import microservice is specifically: calling the configuration update query interface, querying in the database table whether the configuration file corresponding to the identifier has a new version number according to the configuration file identifier uploaded by the client; for the configuration file that the client has downloaded before, comparing the version numbers, and returning the configuration file information corresponding to the client if there is a new version number; for the new configuration dependency that the client has not downloaded, directly returning the configuration file information corresponding to the client.

[0017] The present invention also provides a configuration decoupling system based on a distributed microservice architecture, comprising: a configuration creation microservice, a configuration export microservice, a configuration download microservice and a configuration decoupling system database, as well as a shared file system, an application system and an application system business library, wherein a client SDK is integrated in the application system; the configuration creation microservice is used to provide a user operation interface, allowing users to create, edit and delete configurations in the background, and the configuration is associated with the table name and table fields of the application system business library; the configuration export microservice is used to change the configuration status to need to be exported, and the client SDK calls the configuration upload interface to upload the data exported by the application system to the shared file system, and after the data upload is completed, the configuration status is changed to exported; the configuration download microservice is used to provide a server-side interface for the application system to download the latest configuration data; the configuration decoupling system database is used to store the server-side data of the configuration decoupling system; the shared file system is used to receive and store the uploaded data of the configuration export microservice, and provide it to the configuration download microservice for downloading data; the application system is connected to the configuration export microservice and the configuration download microservice through an HTTP interface to realize data upload and download.

[0018] As a preferred solution, the configuration creation microservice includes a first server data model and a first server interface, and the user calls the first server interface when creating a configuration in the operation interface; the configuration export microservice includes a second client SDK, a second server interface and a second server data model, the second client SDK is integrated in the application system, and is responsible for exporting data from the application system business database table and uploading it to the shared file server; the second server interface is used to provide configuration export status modification function, configuration update query function, and configuration upload function, and the second server data model is a table structure design of the configuration export microservice; the configuration download microservice includes a third client SDK and a third server interface, the third client SDK is integrated in the application system, and is responsible for calling the server interface of the configuration download microservice to query whether there is a configuration file that needs to be updated. If so, the configuration download interface is called to obtain the latest configuration file data and save it to a local file, and load it into the JVM memory, encapsulate it into a Java object, and use it for the application system. The third server interface is used to provide configuration update query function and configuration data download function, and is called by the third client SDK.

[0019] Compared with the prior art, the beneficial effects of the present invention include:

[0020] 1) Create a microservice server interface through configuration, and create a new configuration and modify the configuration status in the operation interface of the configuration decoupling system background, which solves the problem of mutual coupling between business configuration item maintenance and technical configuration item maintenance. It allows business configuration administrators and operation and maintenance configuration administrators to not interfere with each other, and different types of personnel can develop independently.

[0021] 2) The latest configuration file data is obtained by calling the server-side interface of the configuration download microservice, saved to a local file and loaded into the JVM memory, encapsulated into a Java object, and loaded into the JVM memory in real time after the configuration is modified. The configuration item takes effect immediately after the modification, and there is no need to recompile, package, or restart the system, which solves the problem of coupling the business system code files and configuration files together.

[0022] 3) By calling the server interface of the configuration download microservice, the latest configuration file data is obtained and saved to a local file, which solves the problem that the configuration data is strongly dependent on the Redis cache and the Mysql relational database. There is no need to rely on third-party middleware such as Redis cache, and the configuration data remains available when the Mysql database crashes.

[0023] 4) Each application system exports data through the configuration export microservice and uploads it to the shared file system. It also obtains the latest configuration file data from the shared file system through the configuration download microservice interface, saves it to a local file, loads it into the JVM memory, and encapsulates it into a Java object for use by the application system. This solves the problem of sharing business configurations among multiple systems. The business configuration data of each business system is used as a public data asset, which can be used on demand by other business systems. It is no longer necessary for each business system to share public data by using scheduled tasks to synchronize data. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The disclosure of the present invention is described with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. In the accompanying drawings, the same reference numerals are used to refer to the same components. Among them:

[0025] Figure 1 It is a flow chart of a configuration decoupling method based on a distributed microservice architecture according to an embodiment of the present invention;

[0026] Figure 2 The figure is a schematic diagram of the architecture of a configuration decoupling system based on a distributed microservice architecture according to an embodiment of the present invention. DETAILED DESCRIPTION

[0027] It is easy to understand that according to the technical solution of the present invention, without changing the essential spirit of the present invention, a person skilled in the art can propose a variety of interchangeable structural modes and implementation modes. Therefore, the following specific implementation modes and drawings are only exemplary descriptions of the technical solution of the present invention, and should not be regarded as the whole of the present invention or as a limitation or restriction to the technical solution of the present invention.

[0028] According to one embodiment of the present invention, Figure 1A configuration decoupling method based on a distributed microservice architecture is run on a configuration decoupling system. The configuration decoupling system includes a configuration creation microservice, a configuration export microservice, and a configuration download microservice. The configuration decoupling method includes:

[0029] Step S1, designing the configuration creation microservice, the configuration export microservice and the configuration download microservice respectively.

[0030] Step S2, call the server-side interface of the configuration creation microservice, create a new configuration in the operation interface and modify the configuration status.

[0031] Step S3, the configuration export microservice identifies the configuration status, changes the configuration status to need to be exported, and the client SDK calls the configuration upload interface to upload the data exported by the application system to the shared file system. After the data upload is completed, the configuration status is changed to exported.

[0032] Step S4, call the server interface of the configuration download microservice to query whether there is a configuration file that needs to be updated. If so, call the configuration download interface to obtain the latest configuration file data from the shared file system, save it to a local file and load it into the JVM memory, encapsulate it into a Java object, and use it for each application system.

[0033] In an embodiment of the present invention, the above-mentioned configuration creation microservice includes a first server-side data model and a first server-side interface, then: the first server-side data model is designed, specifically: the first server-side data model is designed based on a data export configuration table, and the data export configuration table includes a configuration id identifier, an application id identifier, an application database name, a table name of the application database, a configuration export status, and an effective field.

[0034] Table name: Data export configuration table (t_data_export_config)

[0035] Field Name Field Type Field comments id int Auto-increment primary key config_id int Configuration ID app_id varchar Application ID db_name varchar Application database name table_name varchar Application database table name export_status char Configuration export status (0 = no need to export, 1 = need to export, 2 = exported) enable char Is it effective (0 = disable, 1 = enable)

[0036] The first server interface is designed, specifically: the input parameters and output parameters of the first server interface are configured, the input parameters include application ID, database name, data table name, and the output parameters include response information and response code. The user calls the first server interface when creating a configuration in the operation interface.

[0037] Specifically, the first server interface design code is as follows:

[0038]

[0039] In an embodiment of the present invention, the above-mentioned configuration export microservice includes a second client SDK, a second server interface and a second server data model. Therefore, the second client SDK is designed, specifically: based on the SDK export tag interface, the method of the interface implementation class is defined and the signature is agreed upon to complete the data query logic; an SDK export tag interface processor is provided, the SDK export tag interface is called, and the Map type data obtained by the query is uploaded to the shared file server.

[0040] Specifically, the second client SDK provides the SDK export tag interface, and the application system implements this interface to export data after integrating the SDK. The SDK export tag interface is designed as:

[0041] interface ConfigExportListener{}

[0042] The method signature convention of the implementation class of the exported marker interface of the SDK is:

[0043] List <map>xxxExport(){};

[0044] xxx is a prefix identifier, which corresponds to the camel case form of the database table name.

[0045] For example, if the database table to export configuration data is t_user_type, the method of the above interface implementation class is defined as:

[0046] List <map>userTypeExport(){ / / business code}.

[0047] The logic of the business code is to query the database corresponding to the application, query the table t_user_type, and encapsulate the retrieved data into a List <map>return.

[0048] An example of a complete application system interface implementation class is as follows:

[0049] public class UserConfigExport implements ConfigExportListener{

[0050] List <map>userTypeExport(){ / / Export user type data from business system database table t_user_type}

[0051] List <map>userLevelExport(){ / / Export business system database table t_user_level member level enumeration data}

[0052] }

[0053] In the above case, after the application system integrates the configuration export SDK, the configuration export interface is implemented. The logic of the interface implementation class is to query the tables t_user_type and t_user_level of the application's own database to export the user type configuration and member level enumeration configuration data.

[0054] The implementation class of the above SDK export tag interface only completes the logic of data query. There needs to be an entry to call this interface and pass the query to the List <map>The data of this type is uploaded to the shared file server. Therefore, the SDK also needs to provide a marker interface processor to complete the above functions.

[0055] The working steps of the SDK export marker interface processor include:

[0056] 1) When the application system starts, the implementation class of the SDK export marker interface (ConfigExportListener) is loaded, and the instance list of the implementation class of the SDK export marker interface is obtained according to the instance type through the getBeansOfType method of the Spring container.

[0057] 2) Obtain the method list of the implementation class of the SDK export tag interface through the Java reflection mechanism, parse the method names one by one, remove the Export suffix in the method name, and encapsulate it as an ExportInfo object and store it in the Map<String,ExportInfo> In collection.

[0058] The ExportInfo object is defined as follows:

[0059] class ExportInfo{

[0060] Object configExportListener; / / Configure the export markup interface implementation class instance itself

[0061] Method method; / / Method in the implementation class

[0062] String configName; / / Configuration name, camel case representation of table name, such as: userType

[0063] }

[0064] The key of the Map collection is the camel case form of the table name. For example, the key corresponding to the membership level table t_user_level is userLevel.

[0065] The ExportInfo object is used to call back the method of the implementation class of ConfigExportListener through the reflection mechanism when the configuration is updated to execute the business logic of data export.

[0066] 3) Start the scheduled task, call the second server interface 2.2.2 of the configuration export microservice regularly, and query the list of configuration names that need to update data (re-export).

[0067] 4) Traverse the configuration name list in turn and match it with the Map collection. After matching the ExportInfo object, use the reflection mechanism to execute the method of the SDK export tag interface to obtain the list data of the Map type.

[0068] The specific logic of the method is to query the database table of this system. The table name is the agreed prefix of the marker interface method, such as the method signature List <map>userLevelExport(); The corresponding logic is to query the data of t_user_level and return a list data of Map type, which will be uploaded to the shared file server in the next step.

[0069] 5) Write the list data of the Map type into a local file in JSON format, and call the second server-side interface of the configuration export microservice to upload the configuration data in the form of a file and store it on a shared file server.

[0070] In the embodiment of the present invention, the second server interface of the configuration export microservice includes a configuration export status modification interface, a configuration update query interface, and a configuration upload interface. The second server provides an http interface for the client SDK and the backend web page to call.

[0071] The interface for modifying the configuration export status is designed as follows: the input parameters of this interface include application ID, database name, data table name, and configuration export status; the output parameters include response information and response code. The specific code is as follows:

[0072]

[0073] The default state of the newly created configuration in the configuration creation microservice is that it does not need to be exported. The user can select "Export" on the background operation page. At this time, the state changes to need to be exported, and the configuration export state modification interface is called. The configuration export state modification interface also assumes the function of export notification. After the user modifies the data of the corresponding database table on the background management page of the application system, in order to take effect immediately, the application system needs to call this interface to change the configuration state to need to be exported.

[0074] The configuration update query interface is designed as follows: the input parameters of this interface include the application ID and database name; the output parameters include the configuration name to be updated, response information and response code. The specific code is as follows:

[0075]

[0076]

[0077] The export tag interface processor of the client SDK calls the configuration update query interface, which returns a list of configuration names that need to be updated (re-exported). The client SDK calls this interface to query the key of the configuration that needs to be updated, and then searches the collection Map according to the key.<String,ExportInfo> Find the corresponding ExportInfo in the ExportInfo object. Finally, call the method stored in the ExportInfo object through reflection, query the application business database in the method method, and obtain the data of the specified table.

[0078] The configuration upload interface is designed as follows: the input parameters of this interface include application ID, database name, configuration name, and file body; the output parameters include response information and response code. The specific code is as follows:

[0079]

[0080] The export tag interface processor of the client SDK calls the configuration upload interface, which receives parameters in the form form. The client SDK uploads the exported configuration data file by calling this interface. After receiving the file upload request, the server reads the file stream and writes it to the shared file system. The updated configuration is recorded in the database table t_config_version.

[0081] The second server-side data model of the configuration export microservice is composed of the database table t_config_version, which contains the configuration id, application database name, data table name, and file version number. The specific table structure is as follows:

[0082] Field Name Field Type Field comments id int Auto-increment primary key config_id int Configuration id (configuration file identifier) db_name varchar Application database name table_name varchar Application database table name version_name varchar Configure the version number of the exported file

[0083] The version_name records the version number of the configuration file. The configuration download microservice will filter whether there is a new configuration file to download based on this version number. After the configuration data is exported, it is uploaded to the shared file server by calling the file upload interface. This process needs to be recorded in the database table so that the configuration download microservice can query the updated configuration.

[0084] In an embodiment of the present invention, the above-mentioned configuration download microservice includes a third client SDK and a third server interface. Therefore, the third client SDK is designed, specifically: based on the SDK import tag interface, the method of the interface implementation class is defined and the signature is agreed upon to complete the variable assignment logic; an SDK import tag interface processor is provided to call and pass the business configuration data to the SDK import tag interface to complete the actual assignment.

[0085] Specifically, the third client SDK provides the SDK import tag interface, and the application system implements this interface to download configuration data after integrating the SDK. The SDK import tag interface is designed as:

[0086] interface ConfigImportListener{}

[0087] The method signature convention of the implementation class of this interface is:

[0088] void xxxImport(List <xxx>data){this.data = data;};

[0089] xxx is a prefix identifier, which corresponds to the camel case form of the database table name.

[0090] For example, if the database table of the configuration data to be downloaded is t_user_type, the method of the above interface implementation class is defined as:

[0091] Void userTypeImport(List <usertype>data){this.userTypeData=data;}.

[0092] The logic of the business code is to assign the data passed in by the method parameter to the variable userTypeData, which is an instance variable defined in the ConfigImportListener implementation class.

[0093] An example of a complete application system interface implementation class is as follows:

[0094] public class UserConfigImport implements ConfigImportListener{

[0095] public static volatile userTypeData;

[0096] public static volatile userLevelData;

[0097] void userTypeImport(List <usertype>data){this.userTypeData=data;}

[0098] void userLevelImport(List <userlevel>data){this.userLevelData=data;}

[0099] }

[0100] In the above case, after the application system integrated configuration and imported the SDK, the configuration import interface was implemented. The logic of the interface implementation class is to import the user type configuration of the table t_user_type and the member level enumeration configuration data of the table t_user_level. Business data are all modified with the volatile keyword, so the real-time updated data can be instantly obtained by any thread of the business system.

[0101] The implementation class of the tag interface imported by the above SDK only implements the variable assignment logic. There needs to be an entry to call this interface and pass the business configuration data to this interface to complete the actual assignment. Therefore, the SDK also needs to provide a tag interface processor to complete the above functions.

[0102] The steps to import the tag interface processor into the SDK include:

[0103] 1) When the application system starts, the implementation class of the SDK import tag interface ConfigImportListener is loaded, and the instance list of the implementation class of the SDK import tag interface is obtained according to the instance type through the getBeansOfType method of the Spring container.

[0104] 2) Obtain the method list of the implementation class of the SDK import tag interface through the Java reflection mechanism, parse the method name, method parameters, and generic type of the parameters in turn, remove the Import suffix in the method name, and encapsulate it as an ImportInfo object and store it in the Map<String,ImportInfo> In collection.

[0105] The definition of the ImportInfo object is as follows:

[0106] class ImportInfo{

[0107] Object configImportListener; / / Configure the import tag interface implementation class instance itself

[0108] Method method; / / Method in the implementation class

[0109] Class paramClass; / / method parameter type

[0110] Class mappingClass; / / Entity class type to be converted

[0111] String configName; / / Configuration name, camel case representation of table name, such as: userType

[0112] }

[0113] The key of the Map collection is the camel case form of the table name. For example, the key corresponding to the membership level table t_user_level is userLevel.

[0114] When the ImportInfo object is used for configuration update, the method of the ConfigImportListener implementation class is called back through the reflection mechanism to assign the configuration exported data to the volatile-modified variable of the configuration import marker interface implementation class.

[0115] 3) Start the scheduled task, call the third server interface 3.2.1 of the configuration import microservice regularly, and query the updated configuration data list. Before querying, read the list of configuration files and their version numbers stored locally. When calling interface 3.2.1, pass in the list of configuration files and their versions that have been saved locally, as well as the list of full configuration files that are most recently referenced in the current business system.

[0116] 4) Traverse the configuration data list in turn, call the third server interface 3.2.2 of the configuration import microservice to download the corresponding configuration file, and store it in the local disk in YAML format.

[0117] 5) After matching the ImportInfo object according to the configuration name from the Map collection, read the file stored in the local disk according to the file name, and complete the conversion of YAML format data to object list data according to the mappingClass mapping. Finally, use the reflection mechanism to execute the method of the SDK import tag interface to assign the object list data to the global variable.

[0118] In this way, the business system can read the latest configuration data in real time by accessing the volatile-modified variables during operation. At this time, the configuration data has been automatically converted into object instances, perfectly mapping the database table model and the object model in the program.

[0119] In the embodiment of the present invention, the third server-side interface of the configuration download microservice mainly provides an http interface for the client SDK to call, thereby realizing the configuration update query function and the configuration data download function.

[0120] The third server-side interface includes a configuration update query interface and a configuration download interface, and the third server-side interface of the configuration import microservice is called periodically, specifically:

[0121] 1) Call the configuration update query interface, and query whether the configuration file corresponding to the identifier uploaded by the client has a new version number in the database table;

[0122] 2) For the configuration files that the client has downloaded before, compare the version numbers. If there is a new version number, return the configuration file information corresponding to the client;

[0123] 3) For new configuration dependencies that the client has not downloaded, the corresponding configuration file information of the client is directly returned.

[0124] The configuration update query interface is designed as follows: the input parameters of this interface include application ID, full configuration file list name, and downloaded file list; the output parameters include response information, response code, and configuration list to be downloaded. The specific code is as follows:

[0125]

[0126] The function of the configuration download interface is to download the corresponding file and return it to the client according to the file information passed by the client. After the client SDK downloads the data, it takes out the file content and converts the configuration data into a Java object according to the import tag interface processor and loads it into the JVM for use by the CCP application.

[0127] The configuration download interface is designed as follows: the input parameters of this interface include the application ID and the file information to be downloaded; the output parameters include the response information, response code and file content. The specific code is as follows:

[0128]

[0129]

[0130] See also Figure 2 The present invention also provides a configuration decoupling system based on a distributed microservice architecture, including: a configuration creation microservice, a configuration export microservice, a configuration download microservice and a configuration decoupling system database, as well as a shared file system, an application system and an application system business library, wherein a client SDK is integrated in the application system; the configuration creation microservice is used to provide a user operation interface, allowing the user to create, edit and delete configurations in the background, and configure the table name and table fields of the associated application system business library; the configuration export microservice is used to change the configuration status to need to be exported, and the client SDK calls the configuration upload interface to upload the data exported by the application system to the shared file system, and changes the configuration status to exported after the data upload is completed; the configuration download microservice is used to provide a server-side interface for the application system to download the latest configuration data; the configuration decoupling system database is used to store the server-side data of the configuration decoupling system; the shared file system is used to receive and store the uploaded data of the configuration export microservice, and provide it to the configuration download microservice for downloading data; the application system is connected to the configuration export microservice and the configuration download microservice through the HTTP interface to realize data upload and download.

[0131] Furthermore, the above-mentioned configuration creation microservice includes a first server-side data model and a first server-side interface. The user calls the first server-side interface when creating a configuration in the operation interface; the configuration export microservice includes a second client SDK, a second server-side interface and a second server-side data model. The second client SDK is integrated in the application system and is responsible for exporting data from the application system business database table and uploading it to the shared file server; the second server-side interface is used to provide configuration export status modification function, configuration update query function, and configuration upload function. The second server-side data model is the table structure design of the configuration export microservice; the configuration download microservice includes a third client SDK and a third server-side interface. The third client SDK is integrated in the application system and is responsible for calling the server-side interface of the configuration download microservice to query whether there is a configuration file that needs to be updated. If so, the configuration download interface is called to obtain the latest configuration file data and save it to a local file, and load it into the JVM memory, encapsulate it into a Java object, and use it for the application system. The third server-side interface is used to provide configuration update query function and configuration data download function, and is called by the third client SDK.

[0132] In summary, the present invention completes the design of the configuration decoupling system by designing the configuration creation microservice, the configuration export microservice and the configuration download microservice respectively. The configuration creation microservice is used to provide a user operation interface, allowing users to create, edit and delete configurations in the background; the configuration export microservice is used to change the configuration status to need to be exported, and the client SDK calls the configuration upload interface to upload the data exported by the application system to the shared file system, and changes the configuration status to exported after the data upload is completed; the configuration download microservice is used to provide a server-side interface for the application system to download the latest configuration data.

[0133] In view of the construction needs of commercial banks' core business systems, the existing configuration management methods can no longer fully meet the requirements and have many defects. Whether it is the bank's self-developed configuration management system or the industry's open source distributed configuration solutions, such as Ctrip's Apollo and Alibaba's Nacos, they are currently unable to decouple business configuration managers from operation and maintenance configuration managers, do not support sharing of business configurations between multiple systems, and cannot seamlessly map business configuration data to business entity objects in the JVM. In view of the current status of commercial bank business systems and the future digital transformation path, a configuration decoupling system based on a distributed microservice architecture was invented.

[0134] The present invention has the following advantages:

[0135] 1) Create a microservice server interface through configuration, and create a new configuration and modify the configuration status in the operation interface of the configuration decoupling system background, which solves the problem of mutual coupling between business configuration item maintenance and technical configuration item maintenance. It allows business configuration administrators and operation and maintenance configuration administrators to not interfere with each other, and different types of personnel can develop independently.

[0136] 2) The latest configuration file data is obtained by calling the server-side interface of the configuration download microservice, saved to a local file and loaded into the JVM memory, encapsulated into a Java object, and loaded into the JVM memory in real time after the configuration is modified. The configuration item takes effect immediately after the modification, and there is no need to recompile, package, or restart the system, which solves the problem of coupling the business system code files and configuration files together.

[0137] 3) By calling the server interface of the configuration download microservice, the latest configuration file data is obtained and saved to a local file, which solves the problem that the configuration data is strongly dependent on the Redis cache and the Mysql relational database. There is no need to rely on third-party middleware such as Redis cache, and the configuration data remains available when the Mysql database crashes.

[0138] 4) Each application system exports data through the configuration export microservice and uploads it to the shared file system. It also obtains the latest configuration file data from the shared file system through the configuration download microservice interface, saves it to a local file, loads it into the JVM memory, and encapsulates it into a Java object for use by the application system. This solves the problem of sharing business configurations among multiple systems. The business configuration data of each business system is used as a public data asset, which can be used on demand by other business systems. It is no longer necessary for each business system to share public data by using scheduled tasks to synchronize data.

[0139] It should be understood that if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0140] The technical scope of the present invention is not limited to the contents in the above description. Those skilled in the art can make various deformations and modifications to the above embodiments without departing from the technical idea of ​​the present invention, and these deformations and modifications should all fall within the protection scope of the present invention.< / userlevel> < / usertype> < / usertype> < / xxx> < / map> < / map> < / map> < / map> < / map> < / map> < / map>

Claims

1. A configuration decoupling method based on a distributed microservice architecture, running on a configuration decoupling system, characterized in that: The configuration decoupling system includes a configuration creation microservice, a configuration export microservice, and a configuration download microservice. The configuration decoupling method includes the following steps: Design the configuration creation microservice, the configuration export microservice, and the configuration download microservice respectively; The configuration creates a microservice including a first server data model and a first server interface, then: The first server-side data model is designed, specifically: the first server-side data model is designed based on a data export configuration table, wherein the data export configuration table includes a configuration ID, an application ID, an application database name, a table name of the application database, a configuration export status, and a field indicating whether the configuration is effective; The first server interface is designed, specifically: input parameters and output parameters of the first server interface are configured, the input parameters include application ID, database name, data table name, and the output parameters include response information and response code; The configuration export microservice includes a second client SDK, a second server interface, and a second server data model. Then: The second client SDK is designed, specifically: based on the SDK export tag interface, the method of the interface implementation class is defined and the signature is agreed upon to complete the data query logic; an SDK export tag interface processor is provided, the SDK export tag interface is called, and the Map type data obtained by the query is uploaded to the shared file server; The configuration download microservice includes a third client SDK and a third server interface, then: The third client SDK is designed, specifically: based on the SDK import tag interface, the method of the interface implementation class is defined and the signature is agreed upon to complete the variable assignment logic; the SDK import tag interface processor is provided, and the business configuration data is called and passed to the SDK import tag interface to complete the actual assignment; Call the configuration to create the server-side interface of the microservice, create a new configuration in the operation interface and modify the configuration status; The configuration export microservice identifies the configuration status, changes the configuration status to need to be exported, and the client SDK calls the configuration upload interface to upload the data exported by the application system to the shared file system. After the data upload is completed, the configuration status is changed to exported; Call the server-side interface of the configuration download microservice to query whether there is a configuration file that needs to be updated. If so, call the configuration download interface to obtain the latest configuration file data from the shared file system, save it to a local file and load it into the JVM memory, encapsulate it into a Java object, and use it for various application systems.

2. According to claim 1, the configuration decoupling method based on distributed microservice architecture is characterized in that: The SDK exports the working steps of the tag interface processor, including: 1) When the application system starts, the implementation class of the SDK export marker interface is loaded, and the instance list of the implementation class of the SDK export marker interface is obtained according to the instance type through the getBeansOfType method of the Spring container; 2) Obtain the method list of the implementation class of the SDK export tag interface through the Java reflection mechanism, parse the method names in turn, remove the Export suffix in the method names, and encapsulate them into ExportInfo objects and store them in the Map collection; 3) Start the scheduled task, call the second server interface of the configuration export microservice regularly, and query the list of configuration names that need to be updated; 4) Traverse the configuration name list in turn and match it with the Map collection. After matching the ExportInfo object, use the reflection mechanism to execute the method of the SDK export tag interface to obtain the list data of the Map type; 5) Write the list data of the Map type into a local file in JSON format, and call the second server-side interface of the configuration export microservice to upload the configuration data in the form of a file and store it on the shared file server.

3. According to claim 2, the configuration decoupling method based on distributed microservice architecture is characterized in that: The second server interface includes a configuration export status modification interface, a configuration update query interface, and a configuration upload interface.

4. According to claim 1, the configuration decoupling method based on distributed microservice architecture is characterized in that: The steps of importing the tag interface processor into the SDK include: 1) When the application system starts, the implementation class of the SDK import tag interface is loaded, and the instance list of the implementation class of the SDK import tag interface is obtained according to the instance type through the getBeansOfType method of the Spring container; 2) Obtain the method list of the implementation class of the SDK import tag interface through the Java reflection mechanism, parse the method name, method parameters, and generic type of the parameters in turn, remove the Import suffix in the method name, and encapsulate it as an ImportInfo object and store it in the Map collection; 3) Start the scheduled task, regularly call the third server interface of the configuration import microservice, and query the updated configuration data list; 4) Traverse the configuration data list in sequence, call the third server interface of the configuration import microservice to download the corresponding configuration file, and store it in the local disk in YAML format; 5) After matching the ImportInfo object according to the configuration name from the Map collection, read the file stored in the local disk according to the file name, and complete the conversion of YAML format data to object list data according to mappingClass mapping, and finally use the reflection mechanism to execute the method of the sdk import tag interface to assign the object list data to the global variable.

5. According to claim 4, the configuration decoupling method based on distributed microservice architecture is characterized in that: The third server interface includes a configuration update query interface and a configuration download interface. The third server interface of the timed call configuration import microservice is specifically as follows: calling the configuration update query interface, querying in the database table whether the configuration file corresponding to the identifier has a new version number according to the configuration file identifier uploaded by the client; for the configuration file that the client has downloaded before, comparing the version numbers, and returning the configuration file information corresponding to the client if there is a new version number; for the new configuration dependency that the client has not downloaded, directly returning the configuration file information corresponding to the client.

6. A configuration decoupling system based on a distributed microservice architecture, characterized in that: include: Configure creation microservices, export microservices, download microservices, and decoupled system databases, as well as shared file systems, application systems, and application system business libraries. The application system is integrated with a client SDK. The configuration creation microservice is used to provide a user operation interface, allowing users to create, edit, and delete configurations in the background. The configuration is associated with the table name and table fields of the application system business library; The configuration export microservice is used to change the configuration status to need to be exported, and the client SDK calls the configuration upload interface to upload the data exported by the application system to the shared file system. After the data upload is completed, the configuration status is changed to exported; The configuration download microservice is used to provide a service-side interface to download the latest configuration data to the application system; The configuration decoupling system database is used to store the server-side data of the configuration decoupling system; The shared file system is used to receive and store the uploaded data of the configuration export microservice, and provide the downloaded data to the configuration download microservice; The application system is connected to the configuration export microservice and the configuration download microservice through the HTTP interface to upload and download data; The configuration creation microservice includes a first server data model and a first server interface, and the user calls the first server interface when creating a configuration in the operation interface; The configuration export microservice includes a second client SDK, a second server interface and a second server data model. The second client SDK is integrated in the application system and is responsible for exporting data from the application system business database table and uploading it to the shared file server. The second server-side interface is used to provide a configuration export status modification function, a configuration update query function, and a configuration upload function, and the second server-side data model is a table structure design of a configuration export microservice; The configuration download microservice includes a third client SDK and a third server interface. The third client SDK is integrated in the application system and is responsible for calling the server interface of the configuration download microservice to query whether there is a configuration file that needs to be updated. If so, the configuration download interface is called to obtain the latest configuration file data and save it to a local file, and load it into the JVM memory, encapsulate it into a Java object, and supply it to the application system. The third server interface is used to provide configuration update query function and configuration data download function, and is called by the third client SDK.