Implementation Method and Device for a Data Interface Based on Dynamic Configuration
Through the dynamically configured data interface development system, the problem of large workload and maintenance difficulties in the traditional interface development mode is solved, low-code development and intelligent routing are realized, and the management efficiency and business stability of external data sources are improved.
Patent Information
- Application Number
- CN202211250575.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-10
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-10-10
AI Technical Summary
The traditional external data source interface development model has a lot of workload and difficulty in maintaining it, and lacks unified management, monitoring and abnormal recovery mechanisms, which affects business stability.
Using a dynamically configured data interface development and management system, we use Json format files to persist data by defining interface and data source configuration pages, combining intelligent routing and caching mechanisms to achieve low-code development and unified management of external data sources.
It greatly improves the efficiency of interface development, reduces the workload of system development, testing and deployment, realizes unified management and intelligent routing of external data sources, and reduces the risk of business abnormalities.
Smart Images

Figure CN115543280B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial risk control big data applications, and particularly to a method and device for implementing a data interface based on dynamic configuration. Technical Background
[0002] In the fields of financial risk control and precision marketing scenarios, external credit data sources are extremely important and are widely used in systems such as marketing models and risk control decision engines. With the continuous increase in business volume, the phenomenon of business interruption caused by the instability of external data sources has become increasingly obvious, which not only seriously affects the customer experience but also leads to a large amount of business volume loss. The traditional mode of developing external data source interfaces not only has a large workload, is difficult to maintain, but also lacks a unified management, monitoring, and rapid exception recovery mechanism. If we can develop a set of data interface management systems, this problem can be solved. It reduces the workload of requirements analysis, design, development, testing, and deployment, greatly improves the development efficiency of interfaces through configurable methods, achieves low-code development, uniformly manages external data sources, realizes intelligent routing of interfaces, views the data source call monitoring report in real time, and uniformly manages the prices of each data source.
[0003] In summary, in the face of numerous external data source interface requirements today, there are many deficiencies in traditional interface development, so it is necessary to make improvements. Summary of the Invention
[0004] The problem to be solved by the present invention is to provide a system and method for developing and managing a data interface with dynamic configuration, which greatly improves the development efficiency of the interface, reduces the workload of system development, testing, and deployment, achieves low-code development and intelligent routing, and uniformly manages external data sources.
[0005] The present invention solves the above technical problems through the following solutions:
[0006] A method for implementing a data interface based on dynamic configuration, comprising the following steps:
[0007] Step 1: Define the interface Api configuration page: The page includes an Api basic information module, an Api input parameter module, an Api output parameter module, and an Api result code module;
[0008] On the front-end page, through text boxes, drop-down box components, and form forms, fields such as interface name, interface address, request method, interface status, whether to enable caching, and caching duration in the Api basic information module are displayed on the front-end page;
[0009] Then, parameter name, parameter description, data type, whether it is required, and whether it is used as a cached field in the Api input parameter module are displayed in the Api input variable module on the front-end page;
[0010] It also includes an API output parameter module: with output field name, field description, and field type;
[0011] API result code module: has two fields, result code and whether to charge, used to judge for the caller whether the interface call is successful, and for the system internally to judge whether this call is charged;
[0012] Parse the data of the above four modules into a Json format file, which contains the association relationships of the data of the four modules, and finally persist the json file to the database to obtain the interface API information;
[0013] Step 2: Define a data source configuration page, the page includes a data source basic information module, a data source input parameter module, and a data source parameter mapping module, and parse the data of the data source basic information module, the data source input parameter module, and the data source parameter mapping module into a Json format file to obtain the configuration information of the data source;
[0014] Step 3: Export a general interface processor java class template according to the processor type in the data source basic information module in Step 2;
[0015] Step 4: Create an intelligent routing, which includes two methods. The first is the priority strategy, and the second is the shunt strategy;
[0016] Step 5: Interface call. When calling, the system will look for the json files corresponding to the interface API information and the data source configuration information generated in Steps 1 and 2 in the tables of the redis and mysql databases according to the interface url of the current request;
[0017] Step 6: Call a third-party data source. After the interface call in Step 5 is initiated and before calling the third-party data source, first the system will determine the way to call the third-party data source according to the processor type selected in Step 3, and then the system will query whether the interface has a caching function enabled. If not, it will directly call the third-party data source to return the result. If it is enabled, the system will verify whether there is a cache in redis according to the called interface and input parameters. If there is a cache, it will directly obtain the result from the redis cache and return it directly to the caller. If there is no cache, it will call the third-party data source, and then if the intelligent routing in Step 4 is configured, it will call the third-party data source according to the corresponding routing rules, then parse and return it to the caller, and then store the call result in the redis cache;
[0018] Step 7: Invoke record storage. After the data source invocation is completed, the message result is sent to the storage service through the Kafka middleware, and then processed by the storage service to store the message in the MySQL database, completing an interface call.
[0019] In the above technical solution, step 2 specifically includes the following steps:
[0020] On the front-end page, through text boxes, drop-down box components, and form forms, display the data source name, processing class, supplier, data type, data source status, data source address, request method, processor type, corresponding API, whether it is form submission, whether there is a data source of the same type, timeout time, and other fields in the data source basic information module, as well as the data in the data source parameter module and data source parameter mapping module on the front-end data source configuration page, and parse the data in the data source basic information module, data source input parameter module, and data source parameter mapping module into a Json format file. The file contains the association relationships of the data in these 3 modules. Finally, persist the json file to the database to obtain the configuration information of the data source.
[0021] In the above technical solution, the implementation of step 3 includes the following steps:
[0022] If the standard RestFul type is selected, directly use the well-encapsulated method in Java open source to directly request the third-party data source and obtain the returned message;
[0023] If the custom processor type is selected, manually export a general interface processor java class template, and then rewrite the following 3 methods of this java class:
[0024] First: The callDataSource method, which is used to request the third-party data source. When some data sources have various encryption requirements, this method can be rewritten to call the third-party data source. There are 2 attributes in the callDataSource method, context and dataSourceParams, which respectively obtain the parameters of the interface and the data source;
[0025] Second: The isBilling method, which is used to judge whether the data source call is charged. Rewrite the isBilling method according to the charging logic of the third-party interface;
[0026] Third: The convertToResultData method, which is used to parse the message derivative variable fields. Developers can develop fields according to business requirements.
[0027] The present invention also provides an implementation device for a data interface based on dynamic configuration, including the following modules:
[0028] Define the interface API configuration page module: The page includes the API basic information module, API input parameter module, API output parameter module, and API result code module;
[0029] On the front-end page, through text boxes, dropdown components, and form forms, display fields such as interface name, interface address, request method, interface status, whether to enable caching, and cache duration in the API basic information module on the front-end page;
[0030] Then display parameter name, parameter description, data type, whether it is required, and whether it is used as a cache field in the API input parameter module in the API input variable module on the front-end page;
[0031] It also includes the API output parameter module: there are output field names, field descriptions, and field types;
[0032] The API result code module: has two fields, result code and whether it is chargeable, used to judge for the caller whether the interface call is successful, and for the system internally to judge whether this call is chargeable;
[0033] Parse the data of the above four modules into a Json format file, which contains the association relationship of the data of the 4 modules, and finally persist the json file to the database to obtain the interface API information;
[0034] Define the data source configuration page module: The page includes the data source basic information module, data source input parameter module, and data source parameter mapping module, and parse the data of the data source basic information module, data source input parameter module, and data source parameter mapping module into a Json format file to obtain the data source configuration information;
[0035] Interface processor module: According to the processor type in the data source basic information module, export a general interface processor java class template;
[0036] Intelligent routing module: Intelligent routing includes two methods. The first is the priority strategy, and the second is the traffic splitting strategy;
[0037] Interface call module: When calling, the system will look up the corresponding json files of the interface API information and data source configuration information generated in steps 1 and 2 in the redis and mysql database tables according to the interface url of the current request;
[0038] Invoke the third-party data source module: After the interface call is initiated and before the third-party data source is called, first, the system will determine the way to call the third-party data source according to the processor type selected in the interface processor module. Then, the system will query whether the cache function is enabled for this interface. If not, it will directly call the third-party data source to return the result. If it is enabled, the system will verify whether there is a cache in Redis based on the called interface and input parameters. If there is a cache, it will directly obtain the result from the Redis cache and return it directly to the caller. If there is no cache, it will call the third-party data source. Then, if the intelligent routing in the intelligent routing module is configured, it will call the third-party data source according to the corresponding routing rules, then parse and return it to the caller, and then store the call result in the Redis cache;
[0039] Warehousing module: Record the call for warehousing. After the data source call is completed, the message result is sent to the warehousing service through the Kafka middleware, and then processed by the warehousing service to store the message in the MySQL database, completing an interface call.
[0040] In the above device, defining the data source configuration page module includes the following steps:
[0041] On the front-end page, through text boxes, dropdown components, and form forms, display the data source name, processing class, supplier, data type, data source status, data source address, request method, processor type, corresponding API, whether it is a form submission, whether there is a same-type data source, timeout time and other fields in the data source basic information module, as well as the data in the data source parameter module and the data source parameter mapping module on the front-end data source configuration page, and parse the data in the data source basic information module, the data source input parameter module, and the data source parameter mapping module into a Json format file. The file contains the association relationship of the data in these 3 modules. Finally, persist the json file to the database to obtain the configuration information of the data source.
[0042] In the above device, the implementation of the interface processor module includes the following steps:
[0043] If the standard RestFul type is selected, directly use the well-encapsulated method in the Java open source to directly request the third-party data source and obtain the returned message;
[0044] If the custom processor type is selected, manually export a general interface processor java class template, and then rewrite the following 3 methods of this java class:
[0045] First: The callDataSource method is used to request a third-party data source. When some data sources have various encryption requirements, this method can be rewritten to call the third-party data source. There are two attributes in the callDataSource method, context and dataSourceParams, which obtain the parameters of the interface and the data source respectively;
[0046] Second: The isBilling method is used to determine whether the data source call is charged, and the isBilling method is rewritten according to the billing logic of the third-party interface;
[0047] Third: The convertToResultData method is used to parse the message derivative variable fields, and developers can develop fields according to business requirements.
[0048] A storage medium, when a processor executes a program in the storage medium, implements a method for implementing a data interface based on dynamic configuration.
[0049] Since the invention adopts the above technical solution, it has the following beneficial effects:
[0050] The present invention can use a graphical interface to perform conventional interface development work, improving the usability and friendliness of the system, greatly reducing the workload of code development. Only some simple configuration work is required to complete the development and call of an interface. The entire system can also monitor the call situation of all external data sources, configure the priority and routing of third-party data sources, configure the price of data sources, view the daily call volume and cost distribution of external data. The present invention can dynamically combine similar data sources for primary and standby switching according to different requirements of developers, realize intelligent routing, and greatly reduce the risk of business exceptions caused by external data source exceptions. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 It is a configuration flowchart;
[0052] Figure 2 It is an interface call flowchart. DETAILED DESCRIPTION OF THE INVENTION
[0053] Example 1
[0054] The present invention provides a data interface development and management system and method based on dynamic configuration, which includes the following steps:
[0055] Step 1: Define the Api configuration page. The page includes four modules: Api basic information, Api input parameters, Api output parameters, and Api result codes.
[0056] The front - end page uses UI components such as text boxes, dropdown boxes, and form forms to achieve the page effect. The basic information of the API includes fields such as interface name, interface address, request method, interface status, whether to enable caching, and cache duration;
[0057] The input parameters of the API include fields such as parameter name, parameter description, data type, whether it is required, and whether it is used as a cache; the output parameters of the API have fields such as output field name, field description, field type, and default value of the output field; the result code part of the API has two fields, result code and whether it is chargeable, which are used for the calling party to judge whether the interface call is successful and for the system to internally judge whether this call is chargeable.
[0058] Parse the data of these four modules into a Json - formatted file, which contains the association relationships of the data of the four modules, and finally persist the json file into the database.
[0059] Step 2: Define the data source configuration page. The page includes the basic information of the data source, the input parameters of the data source, and the data source parameter mapping.
[0060] On the front - end page, through text boxes, dropdown boxes, and form forms, display the data source name, processing class, supplier, data type, data source status, data source address, request method, processor type, corresponding API, whether it is a form submission, whether there is a data source of the same type, timeout time and other fields in the basic information module of the data source, as well as the data of the data source parameter and data source parameter mapping modules on the front - end data source configuration page. Parse the data of these several data source modules into a Json - formatted file, which contains the association relationships of the data of the three modules, and finally persist the json file into the database.
[0061] Step 3: According to the processor type in the basic information module of the data source in Step 2, export a general interface processor java class template.
[0062] If the standard RestFul type is selected, no additional code development is required, and the Java - open - sourced and encapsulated methods can be directly used to request the third - party data source to obtain the returned message;
[0063] If the interfaces of the third - party are relatively complex and involve encryption or signature, a custom processor can be selected. After selecting the custom processor, a general interface processor java class template can be manually exported, and then the following three methods of the.java class can be rewritten:
[0064] First: The callDataSource method is used to request a third-party data source. When there are various encryption requirements for some data sources, this method can be rewritten to call the third-party data source. There are two attributes in this method, context and dataSourceParams, which can be used to obtain the parameters of the interface and the data source respectively, which is quite convenient.
[0065] Second: The isBilling method is used to determine whether the data source call is charged. Developers can rewrite this method according to the billing logic of the third-party interface.
[0066] Third: The convertToResultData method is used to parse the message derivative variable fields. Developers can develop the fields by themselves according to the business requirements.
[0067] Step 4: Create intelligent routing. There are two ways of intelligent routing. The first is the priority strategy, and the second is the shunt strategy.
[0068] The priority strategy is to first call the data source with a high priority. If this data source is abnormal, the next-level data source will be called in sequence. After configuring the information of the priority strategy on the front-end page, it is submitted to the back-end through a form, and the priority data corresponding to multiple manufacturers of the data source is stored in the priority strategy table.
[0069] The shunt strategy can configure the call ratio of different data source interfaces of the same type. The shunt strategy adopts an algorithm of proportional distribution based on weights, and the total ratio of multiple data sources adds up to 100%. If there is only one data source of a certain type, this step can be skipped.
[0070] The data of the two routing modes will be stored in the priority strategy table and the shunt strategy table. When the interface is called, we will query these two tables to check whether the routing rules are configured for the data source, and then perform corresponding routing according to the configured rules when the interface is called.
[0071] Step 5: Interface call. When calling, the system will match the interface API information generated in Step 1 and Step 2 and the configuration information JSON data file of the data source in the redis and mysql database tables according to the interface url of the current request.
[0072] Step 6: Invoke the third-party data source. After the interface call in Step 5 is initiated and before the third-party data source is invoked, first, the system determines the way to invoke the third-party data source according to the processor type selected in Step 3. Then, the system checks whether the cache function of this interface is enabled. If not, it directly invokes the third-party data source to return the result. If it is enabled, the system checks whether there is a cache in redis based on the invoked interface and input parameters. If there is a cache, the result is directly obtained from the redis cache and returned to the caller. If there is no cache, the third-party data source will be invoked. Then, if the routing rules in Step 4 are configured, the third-party data source will be invoked according to the corresponding routing rules, and then the result will be parsed and returned to the caller. After that, the call result will be stored in the redis cache.
[0073] Step 7: Record the call into the database. After the data source call is completed, we send the message result to the service for storage through the kafka middleware, and then the service for storage processes it and stores the message in the mysql database, thus completing a call.
[0074] Embodiment 2
[0075] The present invention also provides an implementation device for a data interface based on dynamic configuration, including the following modules:
[0076] Define the interface Api configuration page module: The page includes an Api basic information module, an Api input parameter module, an Api output parameter module, and an Api result code module;
[0077] On the front-end page, through text boxes, drop-down box components, and form forms, fields such as the interface name, interface address, request method, interface status, whether to enable caching, and cache duration in the Api basic information module are displayed on the front-end page;
[0078] Then, the parameter name, parameter description, data type, whether it is required, and whether it is used as a cache field in the Api input parameter module are displayed in the Api input variable module on the front-end page;
[0079] It also includes an Api output parameter module: There are output field names, field descriptions, and field types;
[0080] Api result code module: There are two fields, the result code and whether it is chargeable, which are used for the caller to determine whether the interface call is successful and for the system to internally determine whether this call is chargeable;
[0081] Parse the data of the above four modules into a Json format file, which contains the association relationship of the data of the four modules. Finally, persist the json file to the database to obtain the interface API information;
[0082] Define the data source configuration page module: The page includes the basic information module of the data source, the input parameter module of the data source, and the parameter mapping module of the data source, and parses the data of the basic information module of the data source, the input parameter module of the data source, and the parameter mapping module of the data source into a Json format file to obtain the configuration information of the data source;
[0083] Interface processor module: Export a general interface processor java class template according to the processor type of the basic information module of the data source;
[0084] Intelligent routing module: Intelligent routing includes two methods. The first is the priority policy, and the second is the shunt policy;
[0085] Interface call module: When calling, the system will look up the interface Api information generated in steps 1 and 2 and the json file corresponding to the configuration information of the data source in the tables of the redis and mysql databases according to the interface url of the current request;
[0086] Call the third-party data source module: After the interface call is initiated, before calling the third-party data source, first the system will determine the way to call the third-party data source according to the processor type selected in the interface processor module, and then the system will query whether the interface has a caching function enabled. If not, it will directly call the third-party data source to return the result. If it is enabled, the system will check whether there is a cache in redis according to the called interface and input parameters. If there is a cache, it will directly obtain the result from the redis cache and return it directly to the caller. If there is no cache, it will call the third-party data source, and then if the intelligent routing in the intelligent routing module is configured, it will call the third-party data source according to the corresponding routing rules, then parse and return it to the caller, and then store the call result in the redis cache;
[0087] Warehousing module: Record the call into the warehouse. After the data source call is completed, the message result is sent to the warehousing service through the kafka middleware, and then processed by the warehousing service to store the message in the mysql database to complete an interface call.
[0088] In the above device, the step of defining the data source configuration page module includes the following steps:
[0089] On the front-end page, through text boxes, drop-down box components, and form forms, display the data source name, processing class, supplier, data type, data source status, data source address, request method, processor type, corresponding API, whether it is form submission, whether there is a data source of the same type, timeout time, and other fields in the data source basic information module, as well as the data in the data source parameter module and the data source parameter mapping module on the front-end data source configuration page. Parse the data in the data source basic information module, the data source input parameter module, and the data source parameter mapping module into a Json format file, which contains the association relationships of the data in these three modules. Finally, persist the json file to the database to obtain the configuration information of the data source.
[0090] In the above device, the implementation of the interface processor module includes the following steps:
[0091] If the standard RestFul type is selected, directly use the well-packaged method in Java open source to directly request the third-party data source and obtain the return message;
[0092] If the custom processor type is selected, manually export a general interface processor java class template, and then rewrite the following three methods of the.java class:
[0093] First: The callDataSource method, which is used to request the third-party data source. When some data sources have various encryption requirements, this method can be rewritten to call the third-party data source. There are two attributes in the callDataSource method, context and dataSourceParams, which respectively obtain the parameters of the interface and the data source;
[0094] Second: The isBilling method, which is used to determine whether the data source call is billed, and rewrite the isBilling method according to the billing logic of the third-party interface;
[0095] Third: The convertToResultData method, which is used to parse the derived variable fields of the message. Developers can develop fields according to business requirements.
[0096] Embodiment 3
[0097] When a processor executes a program in a storage medium, it implements a method for implementing a data interface based on dynamic configuration as described in Embodiment 1.
Claims
1. An implementation method of a data interface based on dynamic configuration, characterized in that: Step 1: Define the interface Api configuration page: The page includes an Api basic information module, an Api input parameter module, an Api output parameter module, and an Api result code module; On the front-end page, through text boxes, drop-down box components, and form forms, display fields such as interface name, interface address, request method, interface status, whether to enable caching, and caching duration in the Api basic information module on the front-end page; Then display parameter name, parameter description, data type, whether it is required, and whether it is used as a cached field in the Api input parameter module in the Api input variable module on the front-end page; It also includes an Api output parameter module: there are output field names, field descriptions, and field types; Api result code module: There are two fields, result code and whether it is chargeable, used to judge for the caller whether the interface call is successful, and for the system internally to judge whether this call is chargeable; Parse the data of the Api basic information module, Api input parameter module, Api output parameter module, and Api result code module included in the page into a Json format file. The file contains the association relationships of the data of the four modules, and finally persist the json file into the database to obtain the interface API information; Step 2: Define the data source configuration page. The page includes a data source basic information module, a data source input parameter module, and a data source parameter mapping module, and parse the data of the data source basic information module, data source input parameter module, and data source parameter mapping module into a Json format file to obtain the configuration information of the data source; Step 3: Export a general interface processor java class template according to the processor type in the data source basic information module in Step 2; Step 4: Create an intelligent route. The intelligent route includes two methods. The first is the priority strategy, and the second is the shunt strategy; Step 5: Interface call. When calling, the system will search for the json files corresponding to the interface Api information and the data source configuration information generated in Steps 1 and 2 in the tables of the redis and mysql databases according to the interface url of the current request; Step 6: Call the third-party data source. After the interface call in Step 5 is initiated and before calling the third-party data source, first the system will determine the way to call the third-party data source according to the processor type selected in Step 3. Then the system will query whether the interface has the caching function enabled. If not, it will directly call the third-party data source to return the result. If it is enabled, the system will verify whether there is a cache in redis according to the called interface and input parameters. If there is a cache, it will directly obtain the result from the redis cache and return it directly to the caller. If there is no cache, it will call the third-party data source. Then if the intelligent route in Step 4 is configured, it will call the third-party data source according to the corresponding routing rules, then parse and return it to the caller, and then store the call result in the redis cache; Step 7: Invoke record storage. After the data source invocation is completed, the message result is sent to the storage service through the Kafka middleware, and then processed by the storage service to store the message in the MySQL database, completing an interface invocation.
2. The implementation method of a data interface based on dynamic configuration according to claim 1, wherein: Step 2 specifically includes the following steps: On the front-end page, through text boxes, dropdown components, and form forms, display the data source name, processing class, supplier, data type, data source status, data source address, request method, processor type, corresponding API, whether it is a form submission, whether there is a data source of the same type, timeout time, and other fields in the data source basic information module, as well as the data in the data source parameter module and the data source parameter mapping module on the front-end data source configuration page. Then, parse the data in the data source basic information module, the data source input parameter module, and the data source parameter mapping module into a Json format file, which contains the association relationships of the data in these 3 modules. Finally, persist the json file to the database to obtain the configuration information of the data source.
3. The implementation method of a data interface based on dynamic configuration according to claim 1, characterized in that: The implementation of Step 3 includes the following steps: If the standard RestFul type is selected, directly use the well-encapsulated methods in Java open source to directly request the third-party data source and obtain the returned message. If the custom processor type is selected, manually export a general interface processor java class template, and then rewrite the following 3 methods of this java class: First: The callDataSource method, which is used to request the third-party data source. When there are various encryption requirements for some data sources, this method can be rewritten to call the third-party data source. There are 2 attributes in the callDataSource method, context and dataSourceParams, which respectively obtain the parameters of the interface and the data source. Second: The isBilling method, which is used to determine whether the data source invocation is billed, and rewrite the isBilling method according to the billing logic of the third-party interface. Third: The convertToResultData method, which is used to parse the derived variable fields of the message. Developers can develop fields according to business requirements.
4. An implementation device for a data interface based on dynamic configuration, characterized in that: Define an interface Api configuration page module, and the page includes an Api basic information module, an Api input parameter module, an Api output parameter module, and an Api result code module; On the front-end page, through text boxes, dropdown components, and form forms, display the interface name, interface address, request method, interface status, whether to enable caching, cache duration, and other fields in the Api basic information module on the front-end page; Then display the parameter name, parameter description, data type, whether it is required, and whether it is used as a cached field in the Api input parameter module on the front-end Api input variable module; It also includes an Api output parameter module: with output field name, field description, and field type; The Api result code module: has 2 fields, result code and whether it is billed, which are used to judge whether the interface call is successful for the calling party, and whether the call is billed within the system. Parse the data of the API basic information module, API input parameter module, API output parameter module, and API result code module included in the page into a Json format file. The file contains the association relationships of the data of the 4 modules. Finally, persist the json file to the database to obtain the interface API information; Define the data source configuration page module: The page includes the data source basic information module, data source input parameter module, and data source parameter mapping module, and parse the data of the data source basic information module, data source input parameter module, and data source parameter mapping module into a Json format file to obtain the configuration information of the data source; Interface processor module: Export a general interface processor java class template according to the processor type of the data source basic information module; Intelligent routing module: Intelligent routing includes 2 methods. The first is the priority strategy, and the second is the shunt strategy; Interface call module: When calling, the system will search for the json files corresponding to the interface API information and the data source configuration information generated in steps 1 and 2 in the tables of the redis and mysql databases according to the interface url of the current request; Call the third-party data source module: After the interface call is initiated and before calling the third-party data source, first the system will determine the way to call the third-party data source according to the processor type selected in the interface processor module. Then the system will query whether the interface has the cache function enabled. If not, it will directly call the third-party data source to return the result. If it is enabled, the system will verify whether there is a cache in redis according to the called interface and input parameters. If there is a cache, then directly obtain the result from the redis cache and return it directly to the caller. If there is no cache, then it will call the third-party data source. Then if the intelligent routing in the intelligent routing module is configured, it will call the third-party data source according to the corresponding routing rules, then parse and return it to the caller, and then store the call result in the redis cache; Warehousing module: Record the call into the warehouse. After the data source call is completed, send the message result to the warehousing service through the kafka middleware, and then the warehousing service will process it and store the message in the mysql database to complete an interface call.
5. The implementation device of a data interface based on dynamic configuration according to claim 4, wherein: The definition of the data source configuration page module includes the following steps: On the front-end page, through text boxes, drop-down box components, and form forms, display the fields such as the data source name, processing class, supplier, data type, data source status, data source address, request method, processor type, corresponding API, whether it is a form submission, whether there is a same-type data source, timeout in the data source basic information module, as well as the data of the data source parameter module and the data source parameter mapping module on the front-end data source configuration page, and parse the data of the data source basic information module, data source input parameter module, and data source parameter mapping module into a Json format file. The file contains the association relationships of the data of these 3 modules. Finally, persist the json file to the database to obtain the configuration information of the data source.
6. The implementation device of a data interface based on dynamic configuration according to claim 4, wherein: The implementation of the interface processor module includes the following steps: If the standard RestFul type is selected, directly use the encapsulated method of Java open source to directly request the third-party data source and obtain the returned message; If the custom processor type is selected, manually export a general interface processor Java class template, and then rewrite the following three methods of this Java class: First: The callDataSource method is used to request the third-party data source. When there are various encryption requirements for some data sources, this method can be rewritten to call the third-party data source. There are two attributes in the callDataSource method, context and dataSourceParams, which respectively obtain the parameters of the interface and the data source; Second: The isBilling method is used to determine whether the data source call is charged, and rewrite the isBilling method according to the billing logic of the third-party interface; Third: The convertToResultData method is used to parse the derived variable fields of the message. Developers can develop fields according to business requirements.
7. A storage medium, characterized in that, When the processor executes the program in the storage medium, it implements a method for implementing a data interface based on dynamic configuration as described in any one of claims 1-3.
Citation Information
Patent Citations
Development method and device for data warehouse access interface, equipment and medium
CN117251498A