A method and device for dynamically pushing data dictionary based on distributed configuration center
By adopting a dynamic push method of data dictionary based on distributed configuration center in the microservice architecture, the problems of inflexible updates, limitations in configuration center functions and insufficient security in the traditional data dictionary management methods are solved, and real-time updates, unified management and secure access of data dictionaries are realized.
Patent Information
- Application Number
- CN202411807772.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-01
Smart Images

Figure CN119743522A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data dictionaries, and in particular relates to a method and device for dynamically pushing a data dictionary based on a distributed configuration center. Background Art
[0002] In microservice architecture, data dictionaries are often used to define various enumeration values, constants, etc. used in the system to ensure data consistency and accuracy. In traditional methods, data dictionaries are usually hard-coded in applications or stored in databases and loaded by applications when they start. However, this method has some problems, such as updating the data dictionary requires restarting the application and cannot reflect changes in the data dictionary in real time.
[0003] In the microservice architecture, data dictionary is a common data management method, which is used to define and manage various enumeration values, constants, configuration parameters, etc. used in the application. The use of data dictionary can improve the readability and maintainability of the code, and also facilitate the centralized management and unified update of data. However, there are some problems with the traditional data dictionary management method. For example, the update of the data dictionary requires restarting the application, which cannot reflect the changes of the data dictionary in real time; or the data dictionary is scattered in multiple places, making it difficult to manage and update it in a unified way.
[0004] To solve these problems, existing microservice architectures usually introduce a configuration center to manage configuration information. The configuration center is an independent, centralized service that stores and manages configuration information in a microservice architecture. Through the configuration center, developers can easily manage various configuration information, including database connection information, service addresses, function switches, etc.
[0005] In the microservice architecture, the existing technology for managing data dictionaries has the following main shortcomings:
[0006] (1) Inflexible data dictionary updates: In traditional methods, data dictionaries are usually hard-coded in applications or stored in independent databases. When the data dictionary needs to be updated, it is often necessary to restart the application or perform complex database operations, which not only affects the availability of the system but also increases the complexity of operation and maintenance. In addition, this method cannot reflect changes in the data dictionary in real time, which may cause the application to still use outdated data for a period of time.
[0007] (2) Configuration center function limitations: Although there are some configuration center products on the market (such as Apollo, Consul, etc.), which can provide dynamic push and version management functions for configuration information, these products mainly support simple key-value pair configuration. For data dictionaries with complex structures and clear hierarchies, it is not convenient to use these configuration centers for management. In addition, some configuration center products also have certain limitations in terms of performance and scalability.
[0008] (3) Lack of a unified data dictionary management platform: In a microservice architecture, each microservice may need to use the same or similar data dictionary. However, due to the lack of a unified data dictionary management platform, these data dictionaries are often scattered among various microservices, resulting in data inconsistency and difficulty in management. At the same time, this also increases the workload of developers during development, testing, and maintenance.
[0009] (4) Insufficient security and access control of the data dictionary: In some existing implementations, the access control of the data dictionary is often not perfect. For example, some systems may allow any microservice to access and modify the data dictionary, which may lead to data leakage or malicious tampering. In addition, some systems also lack encryption and signing mechanisms for the data dictionary, which poses security risks during data transmission and storage. Summary of the invention
[0010] The purpose of the present invention is to overcome the above problems and provide a method and device for dynamically pushing a data dictionary based on a distributed configuration center.
[0011] In order to achieve the above purpose, the technical solution adopted by the present invention is:
[0012] A method for dynamically pushing a data dictionary based on a distributed configuration center includes the following steps:
[0013] When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, and the distributed configuration center sends update notifications to subscribed microservices in real time;
[0014] After receiving the notification, the microservice obtains the updated data dictionary information from the distributed configuration center and updates the local cache.
[0015] As a further improvement, when the data dictionary changes, the data is dynamically pushed to the distributed configuration center, and the distributed configuration center sends an update notification to the subscribed microservices in real time, including the following steps:
[0016] When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, the data dictionary configuration items of the distributed configuration center are updated, and the distributed configuration center sends update notifications to subscribed microservices in real time.
[0017] As a further improvement, the step of obtaining updated data dictionary information from the distributed configuration center includes the following steps:
[0018] Get updated data dictionary information in real time through the data dictionary configuration items of the shared distributed configuration center.
[0019] As a further improvement, the microservice sets a scheduled task to regularly synchronize the data dictionary with the distributed configuration center.
[0020] As a further improvement, the configuration files that can be viewed by the distributed configuration center include at least:
[0021] The configured data dictionary.
[0022] As a further improvement, the data dictionary of the configuration includes:
[0023] Configure the data dictionary background service and data dictionary micro front-end service.
[0024] As a further improvement, the data dictionary establishes a connection with the distributed configuration center through an internal interface or API.
[0025] As a further improvement, the microservice establishes a connection with the distributed configuration center through the distributed configuration center client.
[0026] On the other hand, the present invention also provides a data dictionary dynamic push system based on a distributed configuration center, the system includes at least one processor and a memory storing instructions, and when the instructions are executed by at least one processor, the method in the above technical solution is implemented.
[0027] A computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method described in the steps of the above technical solution.
[0028] A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method described in the steps of the above technical solution is implemented.
[0029] The beneficial effects of the present invention are:
[0030] By integrating the dynamic push function of the distributed configuration center and the management requirements of the data dictionary, the present invention can realize real-time update, unified management, secure access and efficient push of the data dictionary, thereby meeting the requirements for data dictionary management under the microservice architecture; dynamic push of data dictionary: dynamic push of data dictionary is realized through the distributed configuration center, without the need to manually update the code or configuration file; unified data dictionary management: data dictionary is centrally managed in the technical internal management and distributed configuration center, which is convenient for unified update and query; efficient data push mechanism: the subscription / publishing mechanism of the distributed configuration center is utilized to realize real-time update and push of the data dictionary; system performance optimization: the query and update efficiency of the data dictionary is improved through technical means such as caching and batch update; support for data dictionary management of complex structures, which is convenient for developers to maintain and update the data dictionary. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The present invention has the following accompanying drawings:
[0032] Figure 1 It is a flowchart of a method for dynamically pushing a data dictionary based on a distributed configuration center in some specific embodiments of the present invention;
[0033] Figure 2 It is a structural schematic diagram of a data dictionary dynamic push device based on a distributed configuration center in some specific embodiments of the present invention;
[0034] Figure 3 A schematic diagram of a data dictionary dynamic push system based on a distributed configuration center of the present invention. DETAILED DESCRIPTION
[0035] The following examples further illustrate the content of the present invention, but should not be construed as limiting the present invention. Without departing from the spirit and substance of the present invention, modifications or substitutions made to the methods, steps or conditions of the present invention all fall within the scope of the present invention.
[0036] like Figure 1 As shown, the present invention provides a method for dynamically pushing a data dictionary based on a distributed configuration center, comprising the following steps:
[0037] Step S10: When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, and the distributed configuration center sends update notifications to subscribed microservices in real time;
[0038] Step S11: After receiving the notification, the microservice obtains the updated data dictionary information from the distributed configuration center and updates the local cache.
[0039] When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, and the distributed configuration center sends update notifications to subscribed microservices in real time, including the following steps:
[0040] Step S100: When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, the data dictionary configuration items of the distributed configuration center are updated, and the distributed configuration center sends update notifications to subscribed microservices in real time.
[0041] Obtaining updated data dictionary information from the distributed configuration center includes the following steps:
[0042] Step S110: obtaining updated data dictionary information in real time through the data dictionary configuration items of the shared distributed configuration center.
[0043] In some embodiments of the present invention, the microservice sets a scheduled task to periodically synchronize the data dictionary with the distributed configuration center.
[0044] In some embodiments of the present invention, the configuration files that can be viewed by the distributed configuration center include at least:
[0045] The configured data dictionary.
[0046] In some embodiments of the present invention, the configured data dictionary includes:
[0047] Configure the data dictionary background service and data dictionary micro front-end service.
[0048] In some embodiments of the present invention, the data dictionary establishes a connection with the distributed configuration center through an internal interface or API.
[0049] In some embodiments of the present invention, the microservice establishes a connection with the distributed configuration center through a distributed configuration center client.
[0050] like Figure 2 As shown, the present invention provides a data dictionary dynamic push device based on a distributed configuration center, comprising:
[0051] The push module is used to dynamically push data to the distributed configuration center when the data dictionary changes. The distributed configuration center sends update notifications to subscribed microservices in real time.
[0052] The update module is used by the microservice to obtain updated data dictionary information from the distributed configuration center and update the local cache after receiving the notification.
[0053] When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, which sends update notifications to subscribed microservices in real time, including:
[0054] The sending module is used to dynamically push data to the distributed configuration center when the data dictionary changes, update the data dictionary configuration items of the distributed configuration center, and the distributed configuration center sends update notifications to subscribed microservices in real time.
[0055] Obtain updated data dictionary information from the distributed configuration center, including:
[0056] The acquisition module is used to obtain updated data dictionary information in real time through the data dictionary configuration items of the shared distributed configuration center.
[0057] In some embodiments of the present invention, the microservice sets a scheduled task to periodically synchronize the data dictionary with the distributed configuration center.
[0058] In some embodiments of the present invention, the configuration files viewable by the distributed configuration center include at least: a configuration data dictionary.
[0059] In some embodiments of the present invention, the configured data dictionary includes: configuring a data dictionary background service and a data dictionary micro-frontend service.
[0060] In some embodiments of the present invention, the data dictionary establishes a connection with the distributed configuration center through an internal interface or API.
[0061] In some embodiments of the present invention, the microservice establishes a connection with the distributed configuration center through a distributed configuration center client.
[0062] 1. What parts does this product consist of?
[0063] The product mainly consists of five parts: technical internal management platform, distributed configuration center, microservice cluster, data push mechanism and data dictionary SDK:
[0064] 1. Technical internal management platform: responsible for the creation, update, and deletion of data dictionaries, and stores the data dictionaries in the distributed configuration center.
[0065] 2. Distributed configuration center: As the storage and push center of the data dictionary, it provides the subscription / publishing function of the data dictionary. When the data dictionary changes, the distributed configuration center will push the update to the microservices that subscribe to the data dictionary in real time.
[0066] 3. Microservice cluster: Each microservice subscribes to the data dictionary in the distributed configuration center to dynamically obtain and update the data dictionary. At the same time, the microservice can cache the data dictionary to improve query efficiency, and set a scheduled task to regularly synchronize the data dictionary with the distributed configuration center to ensure data accuracy.
[0067] 4. Data push mechanism: Using the subscription / publishing mechanism of the distributed configuration center, when the data dictionary changes, the distributed configuration center will send update notifications to the microservices that have subscribed to the data dictionary.
[0068] 5. Data dictionary SDK: The data dictionary processing SDK accessed by the microservice pulls the latest data dictionary from the distributed configuration center and updates the local cache after the microservice receives the notification.
[0069] Implementation steps:
[0070] 1. Deploy the distributed configuration center. After the deployment is complete, you can see the data dictionary and other configuration files in the distributed configuration center.
[0071] 2. Deploy the data dictionary background service loongeasy-cloud-txconfig-server and the data dictionary micro front-end service loongeasy-console-txconfig.
[0072] 3. Deploy a microservice cluster that has access to the data dictionary SDK and subscribed to the data dictionary configuration in the configuration center.
[0073] 4. Use the front-end page of the technical internal management platform to edit the data dictionary.
[0074] 5. Use the dynamic push function of the front-end page of the technical internal management platform to push data to the distributed configuration center.
[0075] In addition, the connection relationship between the various parts of the product is as follows:
[0076] 1. Distributed configuration center and microservice cluster
[0077] Connection mechanism: Each microservice in the microservice cluster establishes a connection with the distributed configuration center through the distributed configuration center client. This connection is based on network communication, usually using HTTP or HTTPS protocol.
[0078] Functional implementation: Microservices receive real-time data dictionary update notifications by subscribing to data dictionary configuration items in the distributed configuration center. When the data dictionary changes, the distributed configuration center sends an update notification to the subscribed microservices. After receiving the notification, the microservices pull the latest data dictionary from the distributed configuration center and update the local cache.
[0079] 2. Distributed configuration center and data dictionary management module
[0080] Connection mechanism: As a component of the distributed configuration center or a module tightly integrated with it, the data dictionary management module communicates with the distributed configuration center through an internal interface or API.
[0081] Functional implementation: The data dictionary management module is responsible for the creation, update, and deletion of data dictionaries, and stores these data dictionary information in the distributed configuration center. When the data dictionary changes, the data dictionary management module will update the data dictionary configuration items in the distributed configuration center and trigger the update notification mechanism.
[0082] 3. Inside the microservice cluster
[0083] Connection mechanism: There may be certain dependencies or communication requirements between the microservices in a microservice cluster. These relationships are usually implemented through mechanisms such as service registration and discovery, load balancing, and API gateways.
[0084] Functional implementation: During the data dictionary push process, although microservices within the microservice cluster do not need to communicate directly to transmit data dictionary information, they can indirectly obtain the latest data dictionary information by sharing the data dictionary configuration items in the distributed configuration center. In addition, microservices may also need to use other mechanisms (such as message queues, remote calls, etc.) to achieve business logic collaboration and communication.
[0085] 1. Centralized management: The data dictionary is centrally managed through the data dictionary management platform and distributed configuration center, which makes it convenient for developers to uniformly manage and maintain the data dictionary.
[0086] 2. Dynamic push: Provides a dynamic push mechanism for the data dictionary, which can push the updated data dictionary to each microservice in real time without restarting the application.
[0087] 3. Support complex structures: Support data dictionary management of complex structures to meet the diverse needs of data dictionaries in modern microservice architectures.
[0088] 4. Visual operation: Provide a data dictionary management interface to realize visual management of the data dictionary, reducing the operation difficulty and error rate of developers.
[0089] By integrating the dynamic push function of the distributed configuration center and the management requirements of the data dictionary, the present invention can realize real-time update, unified management, secure access and efficient push of the data dictionary, thereby meeting the requirements for data dictionary management under the microservice architecture; dynamic push of data dictionary: dynamic push of data dictionary is realized through the distributed configuration center, without the need to manually update the code or configuration file; unified data dictionary management: data dictionary is centrally managed in the technical internal management and distributed configuration center, which is convenient for unified update and query; efficient data push mechanism: the subscription / publishing mechanism of the distributed configuration center is utilized to realize real-time update and push of the data dictionary; system performance optimization: the query and update efficiency of the data dictionary is improved through technical means such as caching and batch update; support for data dictionary management of complex structures, which is convenient for developers to maintain and update the data dictionary.
[0090] In some specific embodiments, Figure 3 As shown, a data dictionary dynamic push device based on a distributed configuration center includes at least one processor and a memory storing instructions to implement any one of the data dictionary dynamic push methods based on a distributed configuration center in the above technical solutions.
[0091] In some specific embodiments, a computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in the above technical solution.
[0092] In some specific embodiments, a computer program product is provided, the computer program product includes a computer program, and when the computer program is executed by a processor, the method of implementing the steps in the above technical solution is implemented.
[0093] The embodiments and functional operations of the subject matter described in this specification may be implemented in: digital electronic circuitry, tangibly implemented computer software or firmware, computer hardware, including the structures disclosed in this specification and their structural equivalents, or a combination of more than one of the above. The embodiments of the subject matter described in this specification may be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on one or more tangible non-transitory program carriers, for execution by a data processing device or to control the operation of a data processing device.
[0094] Alternatively or additionally, the program instructions may be encoded on an artificially generated propagation signal, such as a machine-generated electrical, optical, or electromagnetic signal, which is generated to encode information for transmission to an appropriate receiver device for execution by a data processing device. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of the above devices.
[0095] A computer program (which may also be referred to or described as a program, software, software application, module, software module, script or code) may be written in any form of programming language, including compiled or interpreted languages or declarative or procedural languages, and the computer program may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment. A computer program may, but need not, correspond to a file in a file system. A program may be stored in a portion of a file that stores other programs or data, for example, one or more scripts stored in the following: in a markup language document; in a single file dedicated to a related program; or in multiple collaborative files, for example, files storing one or more modules, subroutines or code portions. A computer program may be deployed to execute on one or more computers, the computers being located in one place or distributed to multiple locations and interconnected by a communication network.
[0096] The contents not described in detail in this specification belong to the prior art known to professional and technical personnel in this field.
[0097] Although the present invention has been described in detail above by general description, specific implementation methods and experiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.
Claims
1. A data dictionary dynamic push method based on a distributed configuration center, characterized in that: The following steps are involved: When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, and the distributed configuration center sends update notifications to subscribed microservices in real time; After receiving the notification, the microservice obtains the updated data dictionary information from the distributed configuration center and updates the local cache.
2. According to claim 1, a data dictionary dynamic push method based on a distributed configuration center is characterized in that: When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, and the distributed configuration center sends update notifications to subscribed microservices in real time, including the following steps: When the data dictionary changes, the data is dynamically pushed to the distributed configuration center, the data dictionary configuration items of the distributed configuration center are updated, and the distributed configuration center sends update notifications to subscribed microservices in real time.
3. According to claim 1, a data dictionary dynamic push method based on a distributed configuration center is characterized in that: The step of obtaining updated data dictionary information from the distributed configuration center includes the following steps: Get updated data dictionary information in real time through the data dictionary configuration items of the shared distributed configuration center.
4. According to claim 1, a method for dynamically pushing a data dictionary based on a distributed configuration center is characterized in that: The microservice sets a scheduled task to regularly synchronize the data dictionary with the distributed configuration center.
5. According to claim 1, a method for dynamically pushing a data dictionary based on a distributed configuration center is characterized in that: The configuration files that can be viewed by the distributed configuration center include at least: The configured data dictionary.
6. According to claim 5, a method for dynamically pushing a data dictionary based on a distributed configuration center is characterized in that: The configured data dictionary includes: Configure the data dictionary background service and data dictionary micro front-end service.
7. According to claim 1, a method for dynamically pushing a data dictionary based on a distributed configuration center is characterized in that: The data dictionary establishes a connection with the distributed configuration center through an internal interface or API.
8. According to claim 1, a method for dynamically pushing a data dictionary based on a distributed configuration center is characterized in that: The microservice establishes a connection with the distributed configuration center through the distributed configuration center client.
9. A device for dynamically pushing a data dictionary based on a distributed configuration center, the device comprising at least one processor and a memory storing instructions. When the instructions are executed by at least one processor, a method for dynamically pushing a data dictionary based on a distributed configuration center as described in any one of claims 1 to 8 is implemented.