CN113254050A - Micro front-end system - Google Patents

Micro front-end system Download PDF

Info

Publication number
CN113254050A
CN113254050A CN202110699350.1A CN202110699350A CN113254050A CN 113254050 A CN113254050 A CN 113254050A CN 202110699350 A CN202110699350 A CN 202110699350A CN 113254050 A CN113254050 A CN 113254050A
Authority
CN
China
Prior art keywords
sub
application
application module
module
base
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110699350.1A
Other languages
Chinese (zh)
Inventor
濮成林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202110699350.1A priority Critical patent/CN113254050A/en
Publication of CN113254050A publication Critical patent/CN113254050A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The application is applicable to the technical field of front-end application, and discloses a micro front-end system which comprises a sub-application module, a configuration center and a base application cluster, wherein the sub-application module uploads a sub-application configuration file to the configuration center; the configuration center determines a target base application module from the base application module cluster according to the sub-application configuration file, transmits sub-application data in the sub-application configuration file to the target base application module, and performs associated registration on the sub-application data and the base application data when receiving the base application data returned by the target base application module; and the target base application module verifies the key carried by the sub-application data, stores the sub-application data when the verification is successful, and sends the base application data to the configuration center. The micro front-end system realizes discovery and registration of the sub-application modules, and improves the automation degree of registration of the sub-application modules.

Description

Micro front-end system
Technical Field
The application relates to the technical field of front-end application, in particular to a micro front-end system.
Background
The micro front-end system is characterized in that a front-end application is decomposed into smaller and simpler sub-application modules which can be independently developed, tested and deployed, the overall control of the system behavior is realized by globally controlling and scheduling the sub-application modules through the base application module, and the micro front-end system has the advantages of application autonomy, single responsibility, independence of technology stacks and the like. The micro-front-end system needs to search and register the newly published sub-application configuration file of the sub-application module, and when the sub-application configuration file is changed, the registration information of the base application module subscribed to the sub-application module is updated. In the prior art, a base application module of a micro-front-end system serves as a main service registration management end, and a pre-constructed base serves as a main control end to control the behavior of the whole system.
In the existing micro front-end system, the registration of the sub-application module is realized through a fixed configuration file, the configuration file needs to be modified when the sub-application module is updated every time, and then the base application is restarted for data synchronization, so that the addition and the deletion of the sub-application module are inconvenient. Moreover, when the sub-application module is changed, for example, when a sub-application configuration file of the sub-application module is newly released or a sub-application configuration file of an existing sub-application module is updated, the base application module cannot automatically register and discover the sub-application module, and developers need to notify the base application module to register the sub-application module, which can be seen in the problem that the existing micro front terminal application module registration scheme has a low automation degree.
Disclosure of Invention
Therefore, it is necessary to provide a micro front end system to solve the problem of low automation degree of the existing micro front end application module registration scheme, in view of the above technical problems.
The embodiment of the application provides a micro front-end system which comprises a sub-application module, a configuration center and a base application module cluster.
And the sub-application module is used for uploading the sub-application configuration file to the configuration center.
And the configuration center is used for determining a target base application module from the base application module cluster according to the sub-application configuration file, sending sub-application data in the sub-application configuration file to the target base application module, and performing associated registration on the sub-application data and the base application data when receiving the base application data returned by the target base application module.
And the target base application module is used for verifying the secret key carried by the sub-application data, storing the sub-application data when the verification is successful, and sending the base application data to the configuration center.
In the above scheme, the sub-application configuration file includes a configuration center address and the sub-application data.
And the configuration center is also used for sending an uploading notice to the sub-application module when the sub-application configuration file is monitored to be changed.
The sub-application module is specifically configured to send the sub-application configuration file to the configuration center according to the configuration center address when receiving the upload notification.
In the foregoing solution, the determining a target base application module from the base application module cluster according to the sub-application configuration file includes:
and analyzing the sub-application configuration file through a configuration processing module of a configuration center to obtain the sub-application data.
And determining a target base application module from the base application module cluster according to the theme carried in the sub-application data based on a preset theme relation mapping list.
In the above scheme, the information in the preset theme relationship mapping list is used to describe a one-to-one correspondence between the theme and the target base application module.
In the foregoing solution, the sending the sub-application data in the sub-application configuration file to the target base application module specifically includes:
and sending the sub-application data to the target base application module through Websocket.
In the above scheme, the associating and registering the sub-application data and the base application data when receiving the base application data returned by the target base application module includes:
and judging whether the theme exists in a subscription relation table in the configuration center database or not based on the preset theme relation mapping list.
And if the theme exists in the subscription relation table, storing the sub-application ID of the sub-application data into the subscription relation table.
And if the theme does not exist in the subscription relationship table, storing the sub-application ID of the sub-application data, the theme and the base application ID of the base application data into the subscription relationship table in an associated manner based on the preset theme relationship mapping list.
In the above scheme, the sub-application data carries a sub-application private key, and the base application data carries a base application public key.
The target base application module is specifically configured to verify whether the sub-application private key is paired with the base application public key.
And if the sub-application private key is matched with the base application public key, receiving and storing the sub-application data sent by the configuration center, and sending the base application data to the configuration center.
In the foregoing solution, the configuration center is further configured to synchronously store the subscription relationship table, in which the subscription relationships between the sub application module and the target base application module are stored, in a Redis cache.
In the above scheme, the configuration center is further configured to build a Websocket service, and the base application module is used as a client of the Websocket service.
In the above scheme, the sub-application private key and the base application public key are both obtained based on an asymmetric encryption algorithm, wherein the sub-application private key and the base application public key are respectively configured in the sub-application module and the target base application module based on a subscription relationship between the target base application module and the sub-application module.
The application provides a micro front-end system, which comprises a sub application module, a configuration center and a base application cluster, wherein the sub application module uploads a sub application configuration file to the configuration center, the configuration center analyzes and processes the received sub application configuration file to obtain sub application data, a target base application module is determined from the base application module cluster based on the sub application data and sends the sub application data to the target base application module, the target base module verifies a secret key carried by the sub application data, the sub application data are stored and sent to the configuration center when the verification is successful, and the configuration center performs associated registration on the sub application data and the base application data when receiving the base application data returned by the target base application module. According to the micro-front-end system, data interaction is carried out through the configuration center main guide sub-application module, the configuration center and the base application module, the base application module finds and registers the sub-application module, and the automation degree of sub-application module registration is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a schematic structural framework diagram of a micro-front-end system according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a detailed structural framework of a micro-front-end system according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a subscription relationship between a sub-application module and a base application module based on a publish-subscribe mode in an embodiment of the present application.
Wherein, 10-sub application module, 20-configuration center, 30-base application module cluster, 31-base application module.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The micro front-end systems provided by all embodiments of the application are applied to electronic equipment, and the electronic equipment can be a terminal or a server, such as a mobile phone or a computer.
Fig. 1 shows a schematic structural framework of a micro-front-end system. As shown in fig. 1, the micro-front-end system includes a plurality of sub-application modules 10, a configuration center 20, and a base application module cluster 30 composed of a plurality of base application modules 31.
And the sub-application module 10 is used for uploading the sub-application configuration file to the configuration center 20.
And the configuration center 20 is configured to determine a target base application module from the base application module cluster 30 according to the sub-application configuration file, send sub-application data in the sub-application configuration file to the target base application module, and perform associated registration on the sub-application data and the base application data when receiving the base application data returned by the target base application module.
And the target base application module is configured to verify the key carried by the sub-application data, store the sub-application data when the verification is successful, and send the base application data to the configuration center 20.
In the present embodiment, the sub-application configuration file is used to describe the execution environment and the execution content of the sub-application module. The execution environment is used to describe a specific registration process of the sub-application module, and the execution content may be described by the sub-application data. The sub application module 10 uploads the sub application configuration file to the configuration center 20, which may be to configure an upload policy in the sub application module 10, for example, to set a period for uploading the sub application configuration file to the configuration center 20, and when a specified upload time of the period is reached, upload the sub application configuration file to the configuration center 20. Or, the configuration center 20 performs content update detection on the sub-application module 10, and when it is detected that the sub-application configuration file in the sub-application module 10 is updated, the sub-application module 10 is made to upload the updated sub-application configuration file.
The base application module cluster 30 comprises a plurality of base application modules 31, one or more base application modules 31 having a subscription relationship with a sub-application module are determined from the plurality of base application modules 31 in the base application module cluster 30 according to the related information in the sub-application configuration file, wherein the determined one or more base application modules 31 are target base application modules, the subscription relationship refers to that the base application module 31 associates with the plurality of sub-application modules 10, and further realizes the specific function of the front-end application system by calling the data of the associated sub-application modules 10, the sub-application module 10 is registered by specifically storing or changing the subscription relationship between the base application module 31 and the sub-application module 10, for example, a new sub-application module 10, the sub-application configuration file of which has been configured with the related information of the base application module 31 subscribing to the sub-application module 10 in advance, however, at this time, because the micro front-end system does not register the sub-application module 10, that is, the subscription relationship between the sub-application module 10 and the base application module 31 is not stored, the base application module 31 cannot realize the corresponding system function by calling the data of the newly added sub-application module 10, for example, the sub-application configuration file of the sub-application module 10 is changed, at this time, the registration information of the sub-application module 10 needs to be updated, for example, a sub-application module 10 is deleted, and only the associated registration data of the sub-application module 10 and the corresponding base application module 31 needs to be deleted.
The sub-application configuration files of the sub-application modules 10 carry sub-application data, the sub-application configuration files obtain the sub-application data after data analysis and processing, after a target base application module is determined from the base application module cluster 30, the configuration center 20 sends the sub-application data to each target base application module, and data interaction between the configuration center 20 and the target base application module can adopt a C-S mode, namely a client (client) and server (server) mode, wherein the configuration center 20 serves as a server and the target base application module serves as a client, or vice versa, or a P2P mode, namely a peer-to-peer mode, and the configuration center 20 and the target base application perform complete peer-to-peer communication, and the client and the server are both clients and servers.
After the target base application module successfully receives the sub-application data sent by the configuration center 20, the target base application module sends the base application data to the configuration center 20, the configuration center 20 receives the base application data, and then associates the base application data with the corresponding sub-application data, so as to realize automatic registration of the sub-application module 10, specifically, the base application data and the sub-application data can be stored in a data table, when the subscription relationship between the base application module 31 and the sub-application module 10 needs to be accessed, the subscription relationship information for accessing the base application module 31 and the sub-application module 10, and the base application data and the sub-application data can be obtained by directly accessing the data table, or the base data and the sub-application data are respectively stored, and the subscription relationship between the base application module 31 and the sub-application module 10 is separately stored in a subscription relationship table, when the subscription relationship between the base application module 31 and the sub-application module 10 needs to be accessed, the subscription relationship table is accessed first to obtain the subscription relationship information, and then the base application data and the sub-application data are obtained.
The configuration center 20 sends the sub-application data to the target base application module, but the target base application module does not directly receive the sub-application data, but verifies the key carried in the sub-application data, receives and stores the sub-application data only when the key is verified, and then feeds back the base application data of the target base application module to the configuration center 20. If the key verification by the target base application module 31 is not successful, the sub-application data is not received and the base application data is not sent to the configuration center 20, and the registration process of the sub-application module 10 is terminated. In this embodiment, the key verification may be implemented based on a data encryption algorithm, a public key and a private key that can be paired with each other are generated in advance, and then are configured in the sub-application data and the base application data, specifically, when the key verification is performed, it is determined whether the public key and the private key are paired, if so, the key verification is successful, otherwise, the key verification is unsuccessful.
It should be further understood that, in this embodiment, one sub-application module 10 may be subscribed by multiple base application modules 31 at the same time, that is, for each base application module 31 subscribed to the sub-application module 10, the sub-application module 10 needs to be registered. On the other hand, one base application module 31 may also subscribe to multiple sub-application modules 10 at the same time, and the functions of the micro-front-end system are realized together by calling data of the multiple sub-application modules 10.
According to the micro front-end system provided by the embodiment of the application, the configuration center 20 controls the sub-application module 10 and the base application module 31 to perform data interaction, so that the base application module 31 discovers and registers the sub-application module 10, and the automation degree of registration of the sub-application module 10 is improved. On the other hand, based on the encryption algorithm, before the target base application module receives the sub-application data, the key verification is carried out on the sub-application data, and the safety of the sub-application data is guaranteed.
As an embodiment, the sub-application configuration file comprises a configuration center address and said sub-application data. The configuration center 20 is further configured to send an upload notification to the sub-application module 10 when it is monitored that the sub-application configuration file changes; the sub-application module 10 is specifically configured to, when receiving the upload notification, send the sub-application configuration file to the configuration center 20 according to the configuration center address.
The micro-front-end system comprises a plurality of sub-application modules 10, and each sub-application module 10 is registered to a corresponding target base application module through a sub-application configuration file. The sub-application configuration file comprises a configuration center address and sub-application data, wherein the configuration center address is used for the sub-application module 10 to address the configuration center 20, so as to upload the sub-application configuration file to the configuration center 20 for further processing. The configuration center 20 monitors the sub-application configuration file, and when the sub-application configuration file changes, notifies the sub-application module 10 to upload the sub-application configuration file, where the change of the sub-application configuration file includes adding a new sub-application configuration file, deleting an original sub-application configuration file, and changing sub-application data in the original configuration file, and when the sub-application configuration file changes, the sub-application module 10 to which the sub-application configuration file belongs needs to be re-registered or deleted in the base application module 31.
Fig. 2 shows a specific structural framework diagram of a micro-front-end system according to an embodiment of the present application.
As an embodiment, determining a target base application module from the base application module cluster 30 according to a sub-application configuration file includes:
and analyzing the sub-application configuration file through a configuration processing module of a configuration center to obtain the sub-application data.
Specifically, the configuration processing module of the configuration center 20 analyzes the sub-application configuration file to obtain sub-application data, and the configuration processing module of the configuration center 20 stores a configuration processing program for analyzing the sub-application configuration file to obtain sub-application data, and further determines a target base application module from a plurality of base application modules 31 in the base application module cluster 30 according to a theme carried by the sub-application data.
And determining a target base application module from the base application module cluster 30 according to the theme carried in the sub-application data based on the preset theme relationship mapping list. And the information in the preset theme relation mapping list is used for describing the one-to-one correspondence between the theme and the target base application module.
The theme carried in the sub-application data is obtained based on a publish-subscribe mode in the field of data communication, and a preset theme relationship mapping list stores the one-to-one correspondence relationship between the theme and the target base application module. The information transmission between the sub-application module 10 and the base application module 31 adopts a publish-subscribe mode, the topic carried in the sub-application data refers to the topic that the sub-application module 10 needs to publish, the topic may be one or more, the base application module 31 indirectly realizes the subscription to the plurality of sub-application modules 10 by subscribing to the corresponding topic, and the corresponding relationship between the base application module 31 and the topic is stored in a preset topic relationship mapping list. The publish-subscribe pattern in this embodiment is further explained below.
In the publish-subscribe model, the publisher does not directly communicate with the subscriber, and the communication between the publisher and the subscriber is realized through a third party, i.e., Broker. If the publisher needs to publish a new message, the publisher only needs to tell the Broker, i'm the message to be sent, the subject is AAA, and the subscriber only needs to tell the Broker, i'm the message that the subject is AAA, so that when the Broker receives the message sent by the publisher and the subject is AAA, the message is pushed to the subscriber who subscribes the subject is AAA, or the subscriber actively pulls the message of the subscribed subject. Specifically, in the present embodiment, the base application module 31 is a subscriber, the sub-application modules 10 are publishers, each sub-application module 10 publishes to a corresponding topic, and the published topic is not unique.
In a common publish-subscribe model, a publisher may publish multiple topics, and a subscriber may subscribe to multiple topics at the same time, however, in this embodiment, with respect to the limitation of the publish-subscribe mode, fig. 3 shows a schematic view of the subscription relationship between the sub-application module 10 and the base application module 31 based on the publish-subscribe mode in the embodiment of the present application, and specifically, fig. 3 shows a subscription relationship between sub-application data of a sub-application module and base application data and topics of a base application module, where the sub-application module 10 is a publisher, the base application module 31 is a subscriber, one sub-application module 10 can publish to multiple topics, i.e. one sub-application 10 may belong to multiple topics simultaneously, but for the base application 31, there is one and only one topic subscribed to, that is, the base application module 31 and the topic subscription relationship are in one-to-one correspondence. Based on this, in a specific development process, the unique theme subscribed by the base application name can be named directly by the base application name, so that the data volume is reduced, and the logic is more intuitive and clear. It should be clear that fig. 3 only shows the subscription relationship between a single sub-application module 10 and multiple base application modules 31, if multiple sub-application modules 10 exist at the same time, the topics published by these sub-application modules 10 may be repeated, that is, multiple topics published by different sub-application modules may have the same topic, and thus, the subscription of one base application module 31 to multiple sub-application modules 10 is realized through the topic.
On the other hand, the configuration center 20 also saves the sub-application data to a sub-application table in the configuration center database. The configuration center database is configured to store relevant information of the sub-application module 10 and the base application module 31, and specifically, in an embodiment, three tables are created in the configuration center database, which are respectively a sub-application table, a base application table, and a subscription relationship table, where the sub-application table is configured to store relevant information of the sub-application module 10, the base application table is configured to store relevant information of the base application module 31, and the subscription relationship table is configured to store subscription relationship information of the sub-application module 10 and the base application module 31. In an embodiment, the sub-application data includes a sub-application name, a sub-application address, a sub-application private key, and one or more topics. The sub-application table example shown in table 1:
TABLE 1 example of sub-applications
Sub-application ID Name of sub-application Sub-application address Sub-application private key Themes
The sub-application table further comprises a sub-application ID, the sub-application ID is a unique ID of the sub-application in the configuration center database, and the sub-application ID can be generated by presetting or automatically configuring the database.
As an embodiment, sending the sub-application data in the sub-application configuration file to the target base application module specifically includes: and sending the sub-application data to the target base application module through the Websocket.
Websocket is a protocol for full-duplex communication on a single TCP connection, the Websocket allows a server to actively push data to a client, and in the Websocket API, the client and the server can establish persistent connection and perform bidirectional data transmission only by completing one handshake. In the present application, the configuration center 20 is used as a server of the Websocket to communicate with the base application module 31, the base application module 31 is a client, the base application module 31 can also transmit data to the configuration center through the Websocket, and bidirectional data transmission between the configuration center 20 and the base application module 31 is realized based on the Websocket.
As an embodiment, the sub-application data carries a sub-application private key, and the base application data carries a base application public key. The target base application module is specifically used for verifying whether the sub-application private key is matched with the base application public key; and if the sub-application private key is matched with the base application public key, receiving and storing the sub-application data sent by the configuration center, and sending the base application data to the configuration center.
After receiving the sub-application configuration file, the configuration center 20 analyzes the sub-application data to obtain sub-application data, on one hand, the sub-application data is stored, on the other hand, after finding the target base application module, the sub-application data is sent to one or more target base application modules through the Websocket, and the target base application module performs key verification operation. Specifically, the target base application verifies whether the sub-application private key is paired with the base application public key, the sub-application private key is included in the sub-application data, and the base application public key is included in the base application data. Further, if the sub-application private key is paired with the base application public key, the sub-application data sent by the configuration center 20 is received and stored, and the base application data is sent to the configuration center 20 through Websocket. On the contrary, if the sub-application private key is not paired with the base application public key, the target base application module does not receive the sub-application data, in this embodiment, the key verification is used to ensure that the sub-application data received by the base application module 31 is the sub-application data of the sub-application module 10 to which the sub-application data is subscribed, and only after the key verification is paired, the base application module 31 receives the sub-application data, thereby ensuring the security of the sub-application data. If the key check is not performed, the sub-application data may be received by other base application modules 31, and then sub-application module registration is performed, resulting in insecurity of the sub-application data. For example, the sub-application module a is required to be registered only on the base application module B, and if the key is not verified, the sub-application data of the sub-application module a is received by the base application module C, the sub-application data can be directly registered on the base application module C, which causes an error in registration of the sub-application module a.
As an embodiment, when receiving the base application data returned by the target base application module, performing association registration on the sub-application data and the base application data, including:
and judging whether the theme exists in a subscription relation table in a configuration center database or not based on a preset theme relation mapping list. An example of a subscription relationship table as shown in table 2:
table 2 subscription relationship representation example
Relationship Table ID Themes Sub-application ID Base application ID
1 AAA P001 S001
2 BBB P002 S002
3 CCC P003 S003
For example, the base application module 31 with the base application ID of S001, the subscribed topic stored in the subscription relationship table is AAA, if a new sub-application module 10 is published at this time, the sub-application ID is P004, and the published topic is the same AAA, it can be known by judgment that the topic AAA already exists in the subscription relationship table, and if the published topic is DDD, the topic does not exist in the subscription relationship table. The sub-application ID and the base application ID may be preset or may be automatically generated by a configuration center database.
And if the theme exists in the subscription relation table, storing the sub-application ID of the sub-application data into the subscription relation table.
For example, a topic issued by the new sub-application module 10 is AAA, and based on a preset topic relationship mapping list, it can be known that the base application ID of the base application module 31 corresponding to the topic is S001, and the sub-application ID of the sub-application module 10 is P004, and since the topic AAA already exists in the subscription relationship table, only the sub-application ID of the sub-application module 10 needs to be added to the subscription relationship table, and the new subscription relationship table is shown in table 3:
TABLE 3 New subscription relationship Table example
Relationship Table ID Themes Sub-application ID Base application ID
1 AAA P001 P004 S001
2 BBB P002 S002
3 CCC P003 S003
And if the theme does not exist in the subscription relation table, storing the sub-application ID of the sub-application data, the theme and the base application ID of the base application data into the subscription relation table in an associated manner based on a preset theme relation mapping list.
For example, a theme issued by the new sub-application module 10 is DDD, based on a preset theme relationship mapping list, it can be known that the base application ID of the base application module 31 corresponding to the theme is S004, if the sub-application ID is P004, because the theme DDD does not exist in the subscription relationship table, a record of the theme needs to be newly added in the subscription relationship table, and the sub-application ID of the sub-application data, the theme, and the base application ID of the base application data are stored in the subscription relationship table in an associated manner. The new subscription relationship table is shown in table 4:
table 4 new subscription relationship table example
Relationship Table ID Themes Sub-application ID Base application ID
1 AAA P001 S001
2 BBB P002 S002
3 CCC P003 S003
4 DDD P004 S004
On the other hand, after receiving the base application data, the configuration center also stores the base application data into a base application table in the configuration center database. The base application table example as shown in table 5:
table 5 base application example
Base application ID Base application name Base application public key
The base application name is the name of the base application module, the base application ID is a code for identifying the base application module, and the base application public key is used for being matched with the sub-application private key to carry out key verification operation.
As an embodiment, the configuration center 20 is further configured to synchronously save the subscription relationship table storing the subscription relationships between the sub application module 10 and the target base application module into the Redis cache.
The configuration center 20 manages the subscription relationship between a plurality of base application modules 31 and sub application modules 10, each base application module 31 may subscribe to a plurality of sub application modules 10, the subscription relationship between the base application module 31 and the sub application modules 10 may change due to the change of the base application module 31 or the sub application modules 10, the change of the relationship is very frequent, if all data access requests directly access the configuration center database, the configuration center database may have abnormal connection, a buffer operation is performed by using a Redis cache, so that the data access requests access the Redis cache first instead of directly accessing the configuration center database, specifically, a subscription relationship table may be directly created in the Redis cache, and when the subscription relationship table information in the configuration center database changes, the subscription relationship table in the Redis cache and the subscription relationship table in the configuration center database are kept updated synchronously, or copying and copying the subscription relationship table in the configuration center database to the Redis cache at regular time, and when the system needs to access the subscription relationship between the sub application module 10 and the base application module 31, directly accessing the Redis cache, thereby improving the access speed.
As an embodiment, the configuration center is further configured to build a Websocket service, and the base application module is used as 31 as a client of the Websocket service.
The existing server-client communication usually adopts an HTTP protocol, but the communication can only be initiated by a client, the client sends a request to a server, and the server returns a query result. In the application, the configuration center communicates with the base application module, if the HTTP protocol is adopted, when the sub-application configuration file changes, the sub-application data needs to be sent to the target base application module, but due to the characteristic of the unidirectional request of the HTTP protocol, the configuration center 20 cannot actively push information to the base application module 31, and only the base application module 31 can send an inquiry request to the configuration center 20 at regular time, so that network bandwidth is occupied, resources are wasted, and the working efficiency is low. The configuration center 20 creates the Websocket service, the configuration center 20 serves as a server of the Websocket service, the base application module 31 serves as a client of the Websocket service, the configuration center 20 can actively push information to the base application module 31, and the base application module 31 can also actively send information to the configuration center 20, so that the information interaction efficiency is improved, and the network bandwidth is saved.
As an embodiment, the sub-application private key and the base application public key are both obtained based on an asymmetric cryptographic algorithm, wherein the sub-application private key and the base application public key are respectively configured in the sub-application module 10 and the target base application module based on a subscription relationship between the target base application module and the sub-application module 10.
Before uploading the sub-application configuration file to the configuration center 20, a sub-application private key and a base application public key are generated based on an asymmetric encryption algorithm, the sub-application private key is added to the sub-application data of the sub-application module 10 based on the subscription relationship between the sub-application module 10 and the target base application module, and the base application public key is added to the base application data of the target base application module.
Asymmetric encryption algorithms require two keys: the public key and the private key are a pair. The asymmetric encryption algorithm has two realization functions, namely encryption, wherein a party A encrypts data by using a public key, and a party B can decrypt the data only by using a corresponding private key. And secondly, verification, namely, the party A signs the data by using a private key and then sends the data to the party B, and the party B checks the signature of the data sent back by the party A by using a public key so as to ensure that the data is sent by the party A. Key verification in this application is used to ensure that the sub-application data received by the base application module 31 is the sub-application data of the sub-application 10 to which it is subscribed, i.e. using the authentication function of the asymmetric cryptographic algorithm. In this embodiment, specifically, data is encrypted based on RSA asymmetric encryption algorithm, a public key and a private key are generated using JAVA. The private key refers to a sub-application private key, the public key refers to a base application public key, and the two are generated in pair and can be completely paired. In addition, the sub-application private key needs to be added to the sub-application data of the sub-application module 10, and the base application public key needs to be added to the base application data of the target base application module, so as to be used for the subsequent key verification operation of the target base application module.
The application provides a micro front-end system, which comprises a sub application module, a configuration center and a base application cluster, wherein the sub application module uploads a sub application configuration file to the configuration center, the configuration center analyzes and processes the received sub application configuration file to obtain sub application data, a target base application module is determined from the base application module cluster based on the sub application data and sends the sub application data to the target base application module, the target base module verifies a secret key carried by the sub application data, the sub application data are stored and sent to the configuration center when the verification is successful, and the configuration center performs associated registration on the sub application data and the base application data when receiving the base application data returned by the target base application module. According to the micro-front-end system, data interaction is carried out through the configuration center main guide sub-application module, the configuration center and the base application module, the base application module finds and registers the sub-application module, and the automation degree of sub-application module registration is improved.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A micro-front-end system, comprising a sub-application module, a configuration center and a base application module cluster;
the sub-application module is used for uploading the sub-application configuration file to the configuration center;
the configuration center is used for determining a target base application module from the base application module cluster according to the sub-application configuration file, sending sub-application data in the sub-application configuration file to the target base application module, and performing associated registration on the sub-application data and the base application data when receiving the base application data returned by the target base application module;
and the target base application module is used for verifying the secret key carried by the sub-application data, storing the sub-application data when the verification is successful, and sending the base application data to the configuration center.
2. The micro-front-end system of claim 1, in which the sub-application profile comprises a configuration hub address and the sub-application data;
the configuration center is further used for sending an upload notification to the sub-application module when the sub-application configuration file is monitored to be changed;
the sub-application module is specifically configured to send the sub-application configuration file to the configuration center according to the configuration center address when receiving the upload notification.
3. The micro-front-end system of claim 1, wherein the determining a target base application module from the cluster of base application modules according to the sub-application profile comprises:
analyzing the sub-application configuration file through a configuration processing module of a configuration center to obtain the sub-application data;
and determining a target base application module from the base application module cluster according to the theme carried in the sub-application data based on a preset theme relation mapping list.
4. The micro-front-end system of claim 3, wherein information in the preset topic relationship mapping list is used to describe a one-to-one correspondence between the topic and the target base application module.
5. The micro-front-end system of claim 1, wherein sending the sub-application data in the sub-application configuration file to the target base application module specifically comprises:
and sending the sub-application data to the target base application module through Websocket.
6. The micro-front-end system of claim 3,
when receiving the base application data returned by the target base application module, the associating and registering the sub-application data and the base application data includes:
judging whether the theme exists in a subscription relation table in the configuration center database or not based on the preset theme relation mapping list;
if the theme exists in the subscription relation table, storing the sub-application ID of the sub-application data into the subscription relation table;
and if the theme does not exist in the subscription relationship table, storing the sub-application ID of the sub-application data, the theme and the base application ID of the base application data into the subscription relationship table in an associated manner based on the preset theme relationship mapping list.
7. The micro-front-end system of claim 1, wherein the sub-application data carries a sub-application private key and the base application data carries a base application public key;
the target base application module is specifically configured to verify whether the sub-application private key is paired with the base application public key;
and if the sub-application private key is matched with the base application public key, receiving and storing the sub-application data sent by the configuration center, and sending the base application data to the configuration center.
8. The micro-front-end system of claim 1, wherein the configuration center is further configured to synchronously save a subscription relationship table storing subscription relationships of the child application module and the target base application module into a Redis cache.
9. The micro-front-end system of claim 1, wherein the configuration center is further to build a Websocket service, and to use the base application module as a client of the Websocket service.
10. The micro-front-end system of claim 7, wherein the sub-application private key and the base application public key are both derived based on an asymmetric cryptographic algorithm, wherein the sub-application private key and the base application public key are configured into the sub-application module and the target base application module, respectively, based on a subscription relationship between the target base application module and the sub-application module.
CN202110699350.1A 2021-06-23 2021-06-23 Micro front-end system Pending CN113254050A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110699350.1A CN113254050A (en) 2021-06-23 2021-06-23 Micro front-end system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110699350.1A CN113254050A (en) 2021-06-23 2021-06-23 Micro front-end system

Publications (1)

Publication Number Publication Date
CN113254050A true CN113254050A (en) 2021-08-13

Family

ID=77189365

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110699350.1A Pending CN113254050A (en) 2021-06-23 2021-06-23 Micro front-end system

Country Status (1)

Country Link
CN (1) CN113254050A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115857891A (en) * 2022-11-17 2023-03-28 北京百度网讯科技有限公司 Front-end application program generation method and device, electronic equipment and storage medium
US11778045B2 (en) 2021-07-12 2023-10-03 Red Hat, Inc. Communication system for micro-frontends of a web application

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11778045B2 (en) 2021-07-12 2023-10-03 Red Hat, Inc. Communication system for micro-frontends of a web application
CN115857891A (en) * 2022-11-17 2023-03-28 北京百度网讯科技有限公司 Front-end application program generation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11258654B1 (en) Parallel distributed network management
CN109587228B (en) Equipment access method of public protocol Internet of things platform system
US11411897B2 (en) Communication method and communication apparatus for message queue telemetry transport
US10623272B2 (en) Authenticating connections and program identity in a messaging system
US8713177B2 (en) Remote management of networked systems using secure modular platform
US8612527B2 (en) Automatic notification system and process
US8117297B2 (en) System and method of device-to-server registration
US20150215400A1 (en) File Upload Method And System
EP2835938B1 (en) Message publishing and subscribing method and apparatus
WO2013046352A1 (en) Computer system, data management method and data management program
CN113254050A (en) Micro front-end system
GB2588002A (en) Security management for networked client devices using a distributed ledger service
EP4340333A1 (en) Communication protocol conversion method, and device, system, and gateway device
CN111355986A (en) Message processing method and device in live broadcast room and storage medium
US20130185329A1 (en) Distributed database
CN104468594A (en) Data request method, device and system
CA2605366C (en) Wireless gateway server
CN112787906A (en) Message pushing system based on cloud desktop platform
US11050798B2 (en) Methods for establishing peer-to-peer communications using distributed call ledgers
CN115314512B (en) Massive terminal data synchronization method and system
US20240054109A1 (en) Dynamic file based publish-subscribe method and system
CN116367272A (en) 5G network element open event processing method and device
JP3019774B2 (en) Network system remote operation management system, remote operation management method, and medium for storing remote operation management program
US9860128B2 (en) Automated command and discovery process for network communications
CN114257606A (en) Data processing method, file management system, storage medium, and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination