Micro-service system with flexible interface

By designing a flexible interface microservice system, the problem that traditional microservice architectures are difficult to respond quickly to changes in user needs is solved, the system flexibility and scalability is achieved, and configuration conflicts and maintenance costs are reduced.

CN120066491APending Publication Date: 2025-05-30GUANGZHOU DATASTORY INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411916809.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

Traditional microservice architectures are difficult to respond quickly to changes in user needs, resulting in insufficient system flexibility and scalability, many configuration conflicts, and low maintenance efficiency.

Method used

Design a microservice system with flexible interfaces, and realizes decoupling of responsibilities, protocol formulation, and permission configuration through the combination of system display modules, service gateway modules, interface business modules, domain modules, unified configuration modules, dynamic routing modules, infrastructure modules and business data warehouse modules, and supports dynamic configuration at the interface level.

Benefits of technology

It significantly improves the flexibility and scalability of the system, reduces project configuration conflicts, optimizes the dependency structure, improves maintenance efficiency, can quickly respond to changes in user needs, and reduces development cycle and debugging costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066491A_ABST
    Figure CN120066491A_ABST
Patent Text Reader

Abstract

The invention discloses an interface-flexible micro-service system, which can significantly improve the flexibility and expandability of the system by introducing an interface-flexible scheme based on a micro-service architecture. And the unified configuration module effectively reduces the configuration conflict of the project, optimizes the dependency structure and improves the maintenance efficiency of the project. The dynamic routing module supports dynamic configuration of a user interface level, so that interface calling is more flexible and efficient, and user demand changes can be quickly responded. Through a parameter standard protocol and a dynamic parameter module, parameter communication between the front end and the rear end becomes smoother, the front end can flexibly adjust screening conditions according to user requirements, and the development cycle and the debugging cost are reduced. The hierarchical design of the interface service module and the field module promotes code reuse, the maintainability of the system is improved, and meanwhile the adaptability of the system is improved through a dynamic selection mechanism of the infrastructure module. On the whole, compared with the traditional technology, the method has higher flexibility, efficiency and expandability in the system construction and maintenance process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software engineering, and more specifically, to a microservice system with elastic interfaces. Background Art

[0002] In the traditional microservice architecture, all common content is placed under a common package, resulting in bloated dependencies for other projects; for each interface in the front-end and back-end docking, it is necessary to communicate and dock parameters and formats, and it is difficult to achieve dynamic parameter meanings according to users; the traditional project also has a three-layer architecture, namely the interface layer, the application layer, and the data layer. Among them, the application layer has too many responsibilities. It not only assembles data, orchestrates processes but also implements specific process logics. An application method will not only become huge and difficult to maintain but also the functions are scattered in various methods, and the code reusability is not high; in projects with different basic data backgrounds and multiple data sources, it is impossible to route to the specified process in a configurable manner, making it impossible to quickly respond to changes in user requirements. Summary of the Invention

[0003] The present invention provides a microservice system with elastic interfaces to solve the technical problem that the traditional microservice architecture cannot quickly respond to changes in user requirements.

[0004] To solve the above technical problems, the technical solution of the present invention is as follows:

[0005] The present invention provides a microservice system with elastic interfaces, including:

[0006] A system display module, which provides a display interface and receives interaction requests through the display interface;

[0007] A service gateway module, which receives the interaction request and forwards the interaction request to different application services in the interface service module according to the business differentiation of the interaction request;

[0008] An interface service module, which includes different application services;

[0009] A domain module, which encapsulates business logic codes corresponding to different application services;

[0010] A unified configuration module, which abstracts the common processing codes of the interface service module and the domain module, as well as the infrastructure module configuration, and is used for the dynamic routing module to interact with the infrastructure module for requests;

[0011] A dynamic routing module, which is used to configure the data storage engine in the infrastructure module that different application services in the interface service module need to access;

[0012] An infrastructure module, which provides query and computing capabilities for different data storage engines;

[0013] A business data warehouse module includes different data storage media for data storage and query by the infrastructure module.

[0014] In the above technical means, by fully decoupling the responsibilities of each link, formulating the protocols between links and highly configurable authority points, the communication between the front-end and back-end parameters is liberated, the unified management configuration is imported on demand, and different business interfaces can be used as they please by simply determining their respective fields, without paying attention to the implementation of the infrastructure layer. In addition, the same set of interfaces can be allocated to different users according to the configuration, receive different parameters, and point to different data source data fields. A high degree of code reuse and rapid construction of business interfaces are achieved.

[0015] Furthermore, it also includes a user authentication module, which performs identity authentication and authority check on the user after the service gateway module receives the interaction request.

[0016] Furthermore, the unified configuration module includes a commons code submodule and a config code submodule, wherein:

[0017] The commons code submodule includes common Java classes;

[0018] The config code submodule includes mysql, es, redis, nacos and kafka, and is imported in the form of @Import.

[0019] Furthermore, the dynamic routing module is used to configure the data storage engine in the infrastructure module that needs to be accessed by different application services in the interface business module, including:

[0020] The dynamic routing module obtains configuration information from a preset data table in the unified configuration data warehouse layer, including routing rules and data source connection information. The data source connection information is used for the interface business module and the domain module, and the routing rules are used for the infrastructure module. The configuration information is stored in an InheritableThreadLocal object, which acts on the entire life cycle of the interaction request.

[0021] Furthermore, the data tables preset in the unified configuration data warehouse layer include:

[0022] The unified configuration data warehouse layer is preset with a first data table, a second data table and a third data table, and the first data table, the second data table and the third data table are MySQL tables, wherein:

[0023] The first data table is a user table, which is used to control the granularity of routing permissions;

[0024] The second data table is a data source configuration information table, which is used to record the corresponding routing rules, including the data source, table name, and field routing rules;

[0025] The third data table is a data source connection information table, which is used for the basic connection information of the data source.

[0026] Furthermore, the dynamic routing module obtains configuration information from the preset data tables in the unified configuration data warehouse layer, including:

[0027] When the dynamic routing module receives the interaction request, which includes user information and the user request path, it obtains the data source routing indx in the first data table according to the user request path and the enterprise ID and user ID in the user information, and then finds the data source configuration in the second data table and the connection information of the third data table according to the indx.

[0028] Furthermore, different configurations of the indx data source routing allow users or enterprises to route to different data sources according to the request path; the entire data source routing adopts a tree - like structure chain - call design, selects the next - hop data source according to the routing policy of the current data source, and at the same time adopts a virtual - real design. When the data source is a virtual data source, it serves as the policy entry for routing to one or more real data sources. When the data source is a real data source, and the real data source can be further combined by multiple real data sources, the dynamic routing module can route to a single real data source according to different conditions in the request; it supports routing to the metric library and can also route to the specified metric library according to the business path.

[0029] Furthermore, the domain module adopts a factory - plus - strategy model design:

[0030] There is a general interface class, and there are as many implementation classes as there are data source types. Then a factory class is provided, and the factory class can call the implementation class methods of the corresponding data source type according to the InheritableThreadLocal object generated by the dynamic routing module.

[0031] Furthermore, the infrastructure module constructs the DSL or SQL statement corresponding to the data source and queries the result, and confirms the specific data source in the business data warehouse layer accessed by the DSL or SQL statement through the data source configuration - related information in the InheritableThreadLocal object generated by the dynamic routing module.

[0032] Furthermore, the business data warehouse module also includes data cleaning, transfer, and aggregation functions.

[0033] Compared with the prior art, the beneficial effects of the technical solution of the present invention are as follows:

[0034] By introducing an interface elasticity solution based on the microservice architecture, the present invention can significantly improve the flexibility and scalability of the system. The unified configuration module effectively reduces configuration conflicts in the project, optimizes the dependency structure, and improves the maintenance efficiency of the project. The dynamic routing module supports dynamic configuration at the user interface level, making interface calls more flexible and efficient, and can quickly respond to changes in user requirements. Through the parameter standard protocol and the dynamic parameter module, the parameter communication between the front end and the back end becomes smoother. The front end can flexibly adjust the screening conditions according to user requirements, reducing the development cycle and debugging costs. The hierarchical design of the interface business module and the domain module promotes code reuse and improves the maintainability of the system. At the same time, the dynamic selection mechanism of the infrastructure module improves the adaptability of the system. Overall, compared with traditional technologies, the present invention has higher flexibility, efficiency, and scalability in the process of system construction and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 FIG. is a schematic structural diagram of a microservice system with interface elasticity provided by an embodiment of the present invention;

[0036] Figure 2 FIG. is a schematic structural diagram of a data table in the unified configuration data warehouse layer provided by an embodiment of the present invention;

[0037] Figure 3 FIG. is a schematic implementation diagram of the dynamic routing module provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0038] The drawings are only for illustrative purposes and should not be construed as limiting the patent;

[0039] To better illustrate this embodiment, some components in the drawings are omitted, enlarged, or reduced, and do not represent the dimensions of the actual product;

[0040] For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.

[0041] The technical solution of the present invention will be further described below with reference to the drawings and embodiments.

[0042] Embodiment 1

[0043] This embodiment provides a microservice system with interface elasticity, as Figure 1 shown, including:

[0044] A system display module, which provides a display interface and receives interaction requests through the display interface;

[0045] A service gateway module that receives the interaction request and forwards the interaction request to different application services in the interface service module according to the service differentiation of the interaction request.

[0046] An interface service module that includes different application services.

[0047] A domain module that encapsulates business logic codes corresponding to different application services.

[0048] A unified configuration module that abstracts the common processing codes of the interface service module and the domain module, as well as the infrastructure module configuration, and is used for the interaction request between the dynamic routing module and the infrastructure module.

[0049] A dynamic routing module that is used to configure the data storage engine in the infrastructure module that different application services in the interface service module need to access.

[0050] An infrastructure module that provides query and computing capabilities for different data storage engines.

[0051] A business data warehouse module that includes different data storage media for data storage and query by the infrastructure module.

[0052] The system architecture provided in this embodiment makes full use of the design concept of interface elasticity, and realizes high availability and economy through the elastic scaling and load balancing of services.

[0053] Embodiment 2

[0054] Based on Embodiment 1, as Figure 1 shown, the following content is continued to be provided:

[0055] It further includes a user authentication module that authenticates the user's identity and checks the user's permissions after the service gateway module receives the interaction request.

[0056] In a specific embodiment, the user authentication module receives the interaction request from the service gateway module, obtains the user information of the interaction request, returns the user information of the interaction request, and the unified configuration module and the dynamic routing module then return the configuration information according to the user information.

[0057] Embodiment 3

[0058] Based on Embodiments 1 and 2, as Figure 1 shown, the following content is continued to be provided:

[0059] In a further embodiment, the unified configuration module includes a commons code sub-module and a config code sub-module, where:

[0060] The commons code sub-module includes common Java classes;

[0061] The config code sub-module includes MySQL, ES, Redis, Nacos, and Kafka, and is imported in the form of @Import.

[0062] In a specific embodiment, for the unified configuration module, by splitting the commons code sub-module, some common Java classes are placed in the commons code sub-module, and a config code sub-module is designed separately, including MySQL, ES, Redis, Nacos, Kafka, etc., and is imported in the form of @Import, which can avoid loading unnecessary components. In terms of project dependencies, all component dependencies will be used <scope>provided< / scope> , and the required components are self-dependent by the project. It achieves the unified basic configuration environment of the entire project, prevents the project from generating too many unnecessary dependencies, and avoids dependency conflicts caused by multiple configurations and the inability to merge branches.

[0063] In a further embodiment, the dynamic routing module is used to configure the data storage engines in the infrastructure modules that different application services in the interface business module need to access, including:

[0064] The dynamic routing module obtains configuration information from a preset data table in the unified configuration data warehouse layer, including routing rules and data source connection information. The data source connection information is used for the interface business module and the domain module, and the routing rules are used for the infrastructure module. The configuration information is stored in an InheritableThreadLocal object and acts on the entire life cycle of the interaction request.

[0065] In a specific embodiment, the dynamic routing module is for different customers or enterprises or interfaces to access different databases, different tables, and different fields.

[0066] In a further embodiment, the preset data tables in the unified configuration data warehouse layer include:

[0067] There are a first data table, a second data table, and a third data table preset in the unified configuration data warehouse layer. The first data table, the second data table, and the third data table are MySQL tables, where:

[0068] The first data table is a user table, which is used to control the granularity of routing permissions;

[0069] The second data table is a data source configuration information table for recording corresponding routing rules, including data sources, table names, and field routing rules;

[0070] The third data table is a data source connection information table for the basic connection information of the data source.

[0071] In a specific embodiment, three MySQL tables are created in the unified configuration data warehouse layer before project setup as Figure 2 shown. One is a user table for controlling the granularity of routing permissions, one is a data source configuration information table for recording corresponding routing rules, including data sources, table names, and field routing rules, and one is a data source connection information table for the basic connection information of the data source. Among them, the indx field is the logical foreign key of the user table and the data source configuration information table, which can be a virtual table name, and the cluster and db_type fields are the logical foreign keys of the data source configuration information table and the data source connection information table. The request will be parsed by the interceptor of the service gateway to obtain the user of the request. The method in the commons code module will be called inside the interceptor to instantiate the InheritableThreadLocal object. This method will call the dynamic routing code module to return the interface information for configuration information processing and access according to the user information. The config module will provide the data source instance of the unified configuration data warehouse layer here to operate on the data table.

[0072] In a further embodiment, the dynamic routing module obtains configuration information from the preset data tables in the unified configuration data warehouse layer, including:

[0073] As Figure 3 shown, the dynamic routing module receives the interaction request, which includes user information and the user request path. According to the user request path and the enterprise ID and user ID in the user information, the data source routing indx in the first data table is obtained, and then the data source configuration in the second data table and the connection information of the third data table of the data source are found according to the indx.

[0074] In a further embodiment, different configurations of the indx data source routing allow users or enterprises to route to different data sources according to the request path; the entire data source routing adopts a tree - like structure chain - call design, selects the next - hop data source according to the routing strategy of the current data source, and at the same time adopts a virtual - real design. When the data source is a virtual data source, it serves as the strategy entry point for routing to one or more real data sources. When the data source is a real data source, and the real data source can be further combined by multiple real data sources, the dynamic routing module can route to a single real data source according to different conditions in the request; it supports routing to the metric library, and can also route to the specified metric library according to the business path.

[0075] In a further embodiment, it further includes field routing:

[0076] There may be different customers but the same business scenarios in the same data source for business fields. According to different user business scenarios, field routing can be configured in the data source configuration information table. When performing data queries at the infrastructure layer, one business field can be switched to another business field to meet the same business scenarios of different customers in the same industry.

[0077] In a specific embodiment, the specific query process is to obtain the indx information with the finest granularity for this request in the user table (for example, when a specific request comes, there are multiple records in the user table:

[0078] One is that the superior enterprise has configured a record a;

[0079] One is that this user has configured a record b with a request path path of / brandmonitor (indicating all brand monitoring interfaces accessed by this user);

[0080] One is that this user has configured a record c with a request path path of / brandmonitor / v1 / brandComparison (indicating the interfaces starting with / brandmonitor / v1 / brandComparison under brand monitoring accessed by this user);

[0081] Then, for the user request with a path of / brandmonitor / v1 / brandComparison / high_performance, the information of record c will be obtained. If it is / brandmonitor / v1 / brandImage / mentalDimensionType, the information of record b will be obtained. Then, according to the indx information, the corresponding routing rule will be obtained in the data source configuration information table, and the data source connection information will be obtained through the corresponding cluster and db_type information. These configuration information are stored in an InheritableThreadLocal object. The InheritableThreadLocal object is a class in Java that can share data within a thread and acts on the entire life cycle of the request. The data source connection information is used for the interface business module and the domain module, and the corresponding routing rule will act on the infrastructure module to achieve the dynamic configuration function at the user interface level.

[0082] In a further embodiment, the domain module is designed using the factory plus strategy model:

[0083] There is a general interface class, and there are as many implementation classes as there are data source types. Then a factory class is provided, and the factory class can call the methods of the implementation classes corresponding to the data source types according to the InheritableThreadLocal object generated by the dynamic routing module.

[0084] In a specific embodiment, the domain module borrows the domain idea within DDD (Domain-Driven Design), classifies the problem domain of the entire system, and abstracts it into classes with clear problem boundaries and attribute behaviors, which are called domain entity classes. The business logic processing in the interface business module is developed facing this domain entity class, that is, the base data for the business processing in the interface business module is encapsulated by the domain entity class. Since there is only one domain entity class for one domain, but the data storage methods of different data sources and the domain situations that the same statement can cover are different, the link of encapsulating the data source data with the domain entity class is split into two major responsibilities:

[0085] One is to construct the DSL or SQL statements corresponding to the data source and query the results to provide a raw data result, which is the main responsibility of the basic interface in the infrastructure module;

[0086] The other is to convert the raw data result into encapsulation with the domain entity class, and at the same time, further processing of the raw data result also needs to be completed here, which is the main responsibility of the domain method in the domain module).

[0087] The domain module adopts the factory plus strategy model design: there is a general interface class, one interface method for one domain, and there are as many implementation classes as there are db_type (data source types). Then a factory class is provided, and the factory class can call the methods of the implementation classes corresponding to the db_type according to the db_type in the InheritableThreadLocal object generated by the dynamic routing module. It achieves that the interface business is developed facing the domain entity class, and at the same time, it can be dynamically routed to the corresponding target domain method.

[0088] In a further embodiment, the infrastructure module constructs the DSL or SQL statements corresponding to the data source and queries the results, and confirms the specific data source in the business data warehouse layer finally accessed by the DSL or SQL statements through the data source configuration related information in the InheritableThreadLocal object generated by the dynamic routing module.

[0089] In a specific embodiment, the infrastructure module constructs a DSL or SQL statement corresponding to the data source and queries the result, providing a raw data result for the domain method. The domain method corresponds to the domain entity class one by one, and the basic interfaces that the domain method needs to call to obtain data to fill the attributes of the domain entity class object are also determined, so the domain method and the basic interface are developed for the domain entity class. The ads_index, field_rule and other data source configuration related information in the InheritableThreadLocal object generated by the dynamic routing module are used to confirm the specific data source in the business data warehouse layer that the DSL or SQL statement finally accesses.

[0090] In a further embodiment, the business data warehouse module also includes data cleaning, transfer and aggregation functions.

[0091] In a further embodiment, the interface business module is used to receive the business parameters forwarded by the service gateway, and obtain the general interface class object of the corresponding strategy implementation class according to the factory class of the domain module and the db_type in the InheritableThreadLocal object. The developer then uses the general interface class object to actively call the corresponding domain method through the business scenario to obtain the data set encapsulated by the domain implementation class. Then the parsing and assembly are processed into the format required by the business to complete the data needs of the business chart presentation.

[0092] The same or similar reference numerals correspond to the same or similar components;

[0093] The terms used in the drawings to describe positional relationships are only used for illustrative purposes and should not be construed as limiting this patent;

[0094] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.

Claims

1. A microservice system with flexible interfaces, characterized in that: include: A system display module, which provides a display interface and receives interaction requests through the display interface; A service gateway module, wherein the service gateway module receives the interaction request and forwards the interaction request to different application services in the interface service module according to the service differentiation of the interaction request; An interface service module, wherein the interface service module includes different application services; Domain modules, which encapsulate business logic codes corresponding to different application services; A unified configuration module, which abstracts the common processing code of the interface business module and the domain module, as well as the infrastructure module configuration, and is used for interactive requests between the dynamic routing module and the infrastructure module; A dynamic routing module, which is used to configure a data storage engine in the infrastructure module that different application services in the interface business module need to access; An infrastructure module, which provides query and computing capabilities for different data storage engines; A business data warehouse module includes different data storage media for data storage and query by the infrastructure module.

2. The microservice system with flexible interface according to claim 1, characterized in that: It also includes a user authentication module, which performs identity authentication and authority check on the user after the service gateway module receives the interaction request.

3. The microservice system with flexible interface according to claim 1, characterized in that: The unified configuration module includes a commons code submodule and a config code submodule, wherein: The commons code submodule includes common Java classes; The config code submodule includes mysql, es, redis, nacos and kafka, and is imported in the form of @Import.

4. The microservice system with flexible interface according to claim 1, characterized in that: The dynamic routing module is used to configure the data storage engine in the infrastructure module that different application services in the interface business module need to access, including: The dynamic routing module obtains configuration information from a preset data table in the unified configuration data warehouse layer, including routing rules and data source connection information. The data source connection information is used for the interface business module and the domain module, and the routing rules are used for the infrastructure module. The configuration information is stored in an InheritableThreadLocal object, which acts on the entire life cycle of the interaction request.

5. The microservice system with flexible interface according to claim 4, characterized in that: The data tables preset in the unified configuration data warehouse layer include: The unified configuration data warehouse layer is preset with a first data table, a second data table and a third data table, and the first data table, the second data table and the third data table are MySQL tables, wherein: The first data table is a user table, which is used to control the granularity of routing permissions; The second data table is a data source configuration information table, which is used to record corresponding routing rules, including data sources, table names, and field routing rules; The third data table is a data source connection information table, which is used for basic connection information of the data source.

6. The microservice system with flexible interface according to claim 5, characterized in that: The dynamic routing module obtains configuration information from a preset data table in the unified configuration data warehouse layer, including: The dynamic routing module receives the interaction request, which includes user information and user request path, obtains the data source route indx in the first data table according to the user request path and the enterprise ID and user ID in the user information, and then finds the data source configuration in the second data table and the connection information of the data source third data table according to indx.

7. The microservice system with flexible interface according to claim 6, characterized in that: Different configurations of indx data source routing allow users or enterprises to route to different data sources based on the request path; The entire data source routing adopts a tree-structured chain call design, and selects the next-hop data source according to the routing strategy of the current data source. At the same time, a virtual-real design is adopted. When the data source is a virtual data source, it serves as the strategy entry for routing to one or more real data sources. When the data source is a real data source, and the real data source can be further combined by multiple real data sources, the dynamic routing module can route to a single real data source according to different conditions in the request. It supports routing to the indicator library, and can also route to the specified indicator library according to the business path.

8. The microservice system with flexible interface according to claim 5, characterized in that: The domain module is designed using a factory plus strategy model: There is a general interface class, and there are as many implementation classes as there are data source types. A factory class is provided, and the factory class can call the implementation class method of the corresponding data source type according to the InheritableThreadLocal object generated by the dynamic routing module.

9. The microservice system with flexible interface according to claim 6, characterized in that: The infrastructure module constructs the DSL or SQL statement corresponding to the data source and queries the result, and confirms the specific data source in the business data warehouse layer that the DSL or SQL statement finally accesses through the data source configuration related information in the InheritableThreadLocal object generated by the dynamic routing module.

10. The microservice system with flexible interface according to claim 7, characterized in that: The business data warehouse module also includes data cleaning, transfer and aggregation functions.