CN111240863A - Data communication method, device, micro front-end system and storage medium - Google Patents

Data communication method, device, micro front-end system and storage medium Download PDF

Info

Publication number
CN111240863A
CN111240863A CN202010025624.4A CN202010025624A CN111240863A CN 111240863 A CN111240863 A CN 111240863A CN 202010025624 A CN202010025624 A CN 202010025624A CN 111240863 A CN111240863 A CN 111240863A
Authority
CN
China
Prior art keywords
module
sub
data
information
modules
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.)
Granted
Application number
CN202010025624.4A
Other languages
Chinese (zh)
Other versions
CN111240863B (en
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.)
Wuxi Huayun Data Technology Service Co Ltd
Original Assignee
Wuxi Huayun Data Technology Service Co 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 Wuxi Huayun Data Technology Service Co Ltd filed Critical Wuxi Huayun Data Technology Service Co Ltd
Priority to CN202010025624.4A priority Critical patent/CN111240863B/en
Publication of CN111240863A publication Critical patent/CN111240863A/en
Application granted granted Critical
Publication of CN111240863B publication Critical patent/CN111240863B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The application provides a data communication method, a data communication device, a micro-front-end system and a storage medium, wherein when a user logs in, a main module obtains user information and authority information of the user, and then the main module renders a main module page corresponding to the authority information. The main module page comprises sub module entries corresponding to the authority information. And when a selection instruction for any sub-module is received, transmitting the user information and the authority information related to the sub-module so that the sub-module renders a sub-module page corresponding to the authority information. Therefore, the access of the sub-modules to the data of the main module is realized by controlling through the main module, the reliable transmission of the data from the main module to the sub-modules is realized, and the reliable communication between the main module and the sub-modules is realized to a certain extent.

Description

Data communication method, device, micro front-end system and storage medium
Technical Field
The present application relates to the field of micro front-end technologies, and in particular, to a data communication method, an apparatus, a micro front-end system, and a storage medium.
Background
Micro frontends (micro frontends) is an architecture similar to micro services, which applies the concept of micro services to browser side, i.e. single-page frontend applications are transformed from single monolithic applications to applications that aggregate multiple small frontend applications into one. Each front-end application can be independently developed and independently deployed.
At present, since small front-end applications often have different functions, the reliability of communication between small front-end applications (which may also be referred to as modules in the front-end applications) will directly affect the reliability of the whole front-end architecture. Therefore, how to implement secure access of data between different modules in the front-end application becomes an urgent problem to be solved.
Disclosure of Invention
An object of the embodiments of the present application is to provide a data communication method, an apparatus, a micro front-end system, and a storage medium, so as to implement reliable communication between modules in a front-end application.
The embodiment of the application provides a method for data communication among modules in a micro front-end system, which comprises the following steps:
when a user logs in, a main module acquires user information and authority information of the user; the main module renders a main module page corresponding to the authority information; the main module page comprises sub module entries corresponding to the authority information; when a selection instruction for any sub-module is received, transmitting the user information and the authority information related to the sub-module so that the sub-module renders a sub-module page corresponding to the authority information; and the sub-module page comprises each operation entry which is provided by the sub-module and corresponds to the authority information.
In the implementation process, when the user logs in, the main module obtains the user information and the authority information of the user, and then the main module renders a main module page corresponding to the authority information. The main module page comprises sub module entries corresponding to the authority information, and a user can select any sub module entry. And when receiving a selection instruction for any sub-module, the main module transmits the user information and the authority information related to the sub-module so that the sub-module renders a sub-module page corresponding to the authority information. Therefore, the access of the sub-modules to the data of the main module is realized by controlling through the main module, the reliable transmission of the data from the main module to the sub-modules is realized, and the reliable communication between the main module and the sub-modules is realized to a certain extent.
Further, the user information comprises role information of the user under different data domains; the authority information comprises authorities corresponding to different role information; transmitting the user information and the authority information related to the sub-module, including: and transmitting the role information under the data domain corresponding to the selection instruction and the authority corresponding to the role information to the sub-module.
It should be understood that in a complex business scenario with multiple data ranges, the same user may play different roles in different data domains, and the different roles may have different permissions. Therefore, in the embodiment of the application, the role information in the data domain corresponding to the selection instruction and the authority corresponding to the role information can be transmitted to the sub-module, so that the sub-module renders the sub-module page corresponding to the authority of the role information according to the role information in the current data domain, and the requirement of user operation in a complex service scene in a multi-data range is met.
Further, before the passing the user information and the authority information related to the sub-module, the method further comprises: judging whether the loaded sub-module is the sub-module indicated by the selection instruction; if the loaded sub-module is not the sub-module indicated by the selection instruction, unloading the loaded sub-module; and loading the sub-module indicated by the selection instruction.
In the implementation process, when the loaded sub-module is not the sub-module indicated by the selection instruction, the loaded sub-module is unloaded, and then the sub-module indicated by the selection instruction is loaded; when the loaded sub-module is the sub-module indicated by the selection instruction, the user information and the authority information related to the sub-module are directly transmitted to the sub-module, so that the sub-module is limited to acquire only the data field with the corresponding authority, and the safety of the scheme of the embodiment of the application is improved.
The embodiment of the present application further provides a method for data communication between modules in a micro front-end system, which is applied to a process of accessing the sub-modules by a main module, and the method includes:
the main module registers the needed data event on the message bus and continuously monitors; the data event is an event needing to be processed by calling a back-end service by the sub-module to be accessed; after monitoring data response information of the data event, acquiring the data response information; the data response information is obtained by calling a back-end service by the sub-module to be accessed and is sent to the message bus.
In the implementation process, the main module realizes the access to the data of the sub-module by registering the required data event on the message bus and continuously monitoring, and then acquiring the data response information from the message bus after monitoring the data response information of the data event, and the whole process realizes the data acquisition through the message bus, thereby realizing the reliable communication between the main module and the sub-module to a certain extent.
Further, the registering of the required data event on the message bus by the master module includes: the master module registers the required data events on the message bus in a non-authenticated manner.
In the implementation process, the main module is an external inlet which is connected with the whole micro-front-end system in a butt joint mode, and plays a role of central main control in the data communication process among the modules and has the highest authority, so that the main module can register required data events on a message bus in a non-authentication mode, and the communication efficiency is improved.
The embodiment of the application also provides a data communication method between modules in the micro-front-end system, which is applied to the data access process between the sub-modules, and the method comprises the following steps:
after monitoring target service data sent to a message bus by a first submodule, a main module inquires a second submodule registered with an event corresponding to the target service data according to the target service data; calling an authentication center to authenticate the second sub-module; and when the second submodule has the authority to acquire the target service data, transmitting data address information of the target service data to the message bus, so that the second submodule acquires the target service data according to the data address information after monitoring the data address information.
In the implementation process, after monitoring the target service data sent to the message bus by the first sub-module, the main module queries a second sub-module registered with an event corresponding to the target service data according to the target service data, and then calls an authentication center to authenticate the second sub-module, and sends data address information of the target service data to the message bus when the second sub-module has the right to obtain the target service data. And the second sub-module registers and monitors the event corresponding to the target service data, and can acquire the target service data according to the data address information after monitoring the data address information. Therefore, the control of data communication among the sub-modules is realized through the central coordination of the main module, the sub-modules need to acquire the data of the other sub-module, namely the authentication is carried out by the main module, so that the reliable communication among the sub-modules is realized, and the safety of the data communication is improved.
Further, the method further comprises: the main module registers all data events accessed across modules on the message bus in a non-authentication mode and continuously monitors.
Further, after the master module listens for the target service data sent by the first slave module to the message bus, the method further includes: storing the target service data into a global data pool; and the data address information of the target service data is the storage address of the target service data in the global data pool.
In the implementation process, the target service data is stored in the global data pool, so that the sub-modules can conveniently obtain the target service data, and the convenience in implementation of the scheme is improved.
The embodiment of the application also provides a data communication method between modules in the micro-front-end system, which is applied to the data access process between the sub-modules, and the method comprises the following steps:
the second sub-module registers an event corresponding to the target service data to the message bus and continuously monitors; and after monitoring data address information corresponding to the event on the message bus, acquiring the target service data according to the data address information.
In the implementation process, the second sub-module registers and monitors an event corresponding to the target service data to the message bus, and after monitoring the data address information, the target service data can be acquired according to the data address information. In this way, data communication between the sub-modules is achieved.
The embodiment of the present application further provides an inter-module data communication device in a micro front-end system, which is applied to a main module, and includes: the device comprises a first acquisition unit, a rendering processing unit and a transmission unit;
the first acquisition unit is used for acquiring user information and authority information of a user when the user logs in;
the rendering processing unit is used for rendering a main module page corresponding to the authority information; the main module page comprises sub module entries corresponding to the authority information;
the transmission unit is used for transmitting the user information and the authority information related to the sub-module when a selection instruction for any sub-module is received, so that the sub-module renders a sub-module page corresponding to the authority information; and the sub-module page comprises each operation entry which is provided by the sub-module and corresponds to the authority information.
The embodiment of the present application further provides an inter-module data communication device in a micro front-end system, which is applied to a main module, and includes: a first registration unit and a second acquisition unit;
the first registration unit is used for registering a required data event on a message bus and continuously monitoring; the data event is an event needing to be processed by calling a back-end service by the sub-module to be accessed;
the second obtaining unit is configured to obtain the data response information from the message bus after monitoring the data response information of the data event; and the data response information is acquired by calling a back-end service by the submodule to be accessed and is sent to the message bus.
The embodiment of the present application further provides an inter-module data communication device in a micro front-end system, which is applied to a main module, and includes: the system comprises a processing unit, a calling unit and a sending unit;
the processing unit is used for inquiring the second sub-module registered with an event corresponding to the target service data according to the target service data after monitoring the target service data sent to a message bus by the first sub-module;
the calling unit is used for calling an authentication center to authenticate the second sub-module;
the sending unit is configured to send data address information of the target service data to the message bus when the second submodule has a right to acquire the target service data, so that the second submodule acquires the target service data according to the data address information after monitoring the data address information.
The embodiment of the present application further provides an inter-module data communication device in a micro front-end system, which is applied to sub-modules, and includes: a registration monitoring unit and a third acquisition unit;
the registration monitoring unit is used for registering an event corresponding to the target service data to the message bus and continuously monitoring;
and the third obtaining unit is configured to obtain the target service data according to the data address information after monitoring data address information corresponding to the event on the message bus.
The embodiment of the application also provides a micro front-end system, which comprises a main module and a plurality of sub-modules;
the main module is used for executing the first data communication method provided by the above to realize data communication from the main module to the sub-module; or for executing the second data communication method provided above to enable the main module to access the sub-module data; or for executing the third data communication method provided above to implement data communication between the sub-modules;
the sub-module is configured to execute the fourth data communication method provided above, so as to implement data communication between the sub-modules.
The embodiment of the application also provides a readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to realize the data communication method between the modules in the micro-front-end system.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic data communication flow diagram illustrating a situation where a sub-module accesses data of a main module according to an embodiment of the present application;
fig. 2 is a schematic diagram of a page of a main module according to an embodiment of the present application;
fig. 3 is a schematic data communication flow diagram for a case where a master module accesses data of a sub-module according to an embodiment of the present application;
fig. 4 is a schematic data communication flow diagram for a case of performing data access between sub-modules according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a front-end system and a back-end system with a micro-front-end system according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a data communication device between modules in a first micro-front-end system according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a data communication device between modules in a second micro-front-end system according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a data communication device between modules in a third micro-front-end system according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a data communication device between modules in a fourth micro-front-end system according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The first embodiment is as follows:
the scheme provided by the embodiment of the application is applied to a micro front-end system. The micro-front-end system is an application structure in which one application is configured by a plurality of front-end applications. In the embodiment of the present application, the micro-front-end system includes a main module and a plurality of sub-modules, where the main module is a portal module that interfaces with a user in the whole front-end application, and also takes on the role of coordinating each sub-module in the whole front-end application.
It should be understood that in the micro-front-end system, after the user logs in, there are three communication situations between the modules. Specifically, there are cases where the sub-modules access data of the main module, cases where the main module accesses data of the sub-modules, and cases where data access is performed between the sub-modules. In the embodiment of the application, different data communication modes among modules are respectively adopted for different communication situations, so that data communication among the modules in the micro front-end system is realized.
For the case that the sub-module accesses the data of the main module, the data communication method between the modules provided in the embodiment of the present application may be as shown in fig. 1, and includes:
s101: when a user logs in, the main module acquires user information and authority information of the user.
It should be appreciated that since the primary module is the portal module interfacing the user throughout the front-end application, the primary module is accessed first after the user logs in. In the embodiment of the present application, the main module may call a corresponding API (interface) to obtain the user information and the permission information of the user from the backend service.
S102: and the master module renders a master module page corresponding to the authority information.
It should be noted that, in the embodiment of the present application, the rendered page of the main module includes entries of each sub-module corresponding to the authority information. For example, five sub-modules numbered 1, 2, 3, 4, and 5 are provided in the micro-front-end system, and the sub-modules accessible according to the user right only have three sub-modules numbered 1, 2, and 3, then the rendered main module page may have only sub-module entries of three sub-modules numbered 1, 2, and 3 (see, for example, fig. 2), or the rendered main module page may include sub-module entries of all sub-modules, but the sub-module entries of the sub-modules numbered 4 and 5 are displayed as unavailable.
S103: and when a selection instruction for any submodule is received, transferring the user information and the authority information related to the submodule.
It should be understood that the sub-module selected by the selection instruction should be the sub-module meeting the authority information requirement of the user.
S104: and rendering the sub-module page corresponding to the authority information related to the sub-module by the sub-module.
In the embodiment of the application, the module authority of the sub-module can be acquired. The module authority of a sub-module refers to the resource authority of the sub-module. In the embodiment of the present application, the authority information of the user and the module authority of the sub-module corresponding to the selection instruction are intersected, and the resource authority in the intersection is the resource operation authority that the user has for the sub-module, that is, the authority information related to the sub-module described above.
In the embodiment of the application, the sub-module page includes operation entries which are owned and operated by the sub-module, and different resources can be called through different operation entries. It should be understood that the resources that a user can operate may differ under different jurisdictions. Therefore, in the embodiment of the application, only the operation entries which the user has the right to operate may be rendered and displayed, or all the operation entries which the sub-module has may be rendered and displayed, but the operation entries outside the right are limited to be unavailable.
It is worth noting that in practical applications, there are complex business scenarios with multiple data ranges. In a complex service scenario with multiple data ranges, the same user may play different roles in different data domains, and the different roles have different permissions correspondingly. In the embodiment of the application, all role information of a user and role permissions corresponding to the role information can be acquired, and then corresponding main module pages are respectively rendered according to the role permissions of different role information. For example, it is assumed that a micro front-end system has five sub-modules with numbers of 1, 2, 3, 4, and 5, a user has two roles a and B, the sub-modules with the character permissions corresponding to the access in the role a are three sub-modules with numbers of 1, 2, and 3, the sub-modules with the character permissions corresponding to the access in the role B are three sub-modules with numbers of 2, 3, and 5, and a main module page corresponding to the role a and a main module page corresponding to the role B can be respectively rendered in the main module and provided to the user. Illustratively, the home page corresponding to one role can be displayed to the user at a time in a switching manner similar to a web page, but the user can select to switch to the home page corresponding to the other roles.
Correspondingly, when a user selects a certain sub-module, that is, when the main module receives a selection instruction for any sub-module, the user information and the authority information related to the sub-module, which are sent to the sub-module, include: role information under a data domain corresponding to the selection instruction (namely, a data domain to which a main module page where the user sends the selection instruction belongs) and authority corresponding to the role information. And at the moment, the sub-module renders a corresponding sub-module page according to the authority corresponding to the role information.
It should be noted that, in the embodiment of the present application, the user information may include, in addition to the role information, basic information of the user, such as one or more of a user name, a user phone, a user account, and the like.
In addition, in the embodiment of the present application, after the user logs in, in order to ensure the user experience, a preloading mode may be adopted, that is, a certain sub-module is preloaded. After the user issues the selection instruction for any sub-module, the main module may determine whether the loaded sub-module is the sub-module indicated by the selection instruction. If yes, user information and authority information related to the sub-module can be directly transmitted to the sub-module; if not, the loaded sub-module can be unloaded, the sub-module indicated by the selection instruction is loaded, and the user information and the authority information related to the sub-module are transmitted to the sub-module after the loading is finished.
For the case that the main module accesses data of the sub-modules, the data communication method between the modules provided in the embodiment of the present application may be as shown in fig. 3, which includes:
s301: the master registers the required data event on the message bus and continues listening.
In this embodiment of the present application, the data event registered by the main module on the message bus is an event that requires the sub-module to be accessed to call the back-end service for processing. For example, the main module needs to acquire data a, where the data a is data that needs the sub-module 1 to call the backend service to acquire, the main module may register an event that needs to acquire the data a on the message bus, and continuously monitor the event.
S302: and acquiring the data response information after monitoring the data response information of the data event.
The data response information is obtained by calling a back-end service by the submodule to be accessed and is sent to the message bus. It should be understood that, in this embodiment of the application, after the main module registers a required data event on the message bus, the message bus may not notify the to-be-accessed sub-module, but the to-be-accessed sub-module continuously executes according to its execution logic, and after a certain execution process calls a back-end service to obtain data response information, the data response information is sent to the message bus.
It should be understood that in the registration snooping mechanism, after a certain data event is registered on the message bus, the data event is continuously snooped subsequently.
It should be further noted that, in this embodiment of the application, after receiving the data response information of the data event, the message bus may store the data response information in the global data pool, so that the master module obtains the data response information from the global data pool.
It should be noted that, in the embodiment of the present application, the master module has the highest authority in the whole micro-front-end system, and therefore, in the embodiment of the present application, when the master module registers the data event in the message bus, the master module may register the data event in a non-authenticated mode, that is, the master module directly registers the data event in the message bus without performing authority authentication, and may directly obtain the data from the global data pool.
For the case of performing data access between sub-modules, the data communication method between the modules provided in the embodiment of the present application may be as shown in fig. 4, and includes:
s401: and the second submodule registers the event corresponding to the target service data to the message bus and continuously monitors.
S402: after monitoring the target service data sent to the message bus by the first submodule, the main module queries a second submodule registered with an event corresponding to the target service data according to the target service data.
It should be noted that, in the registration monitoring mechanism, after a certain event is registered on the message bus, monitoring on the event is continued subsequently. Therefore, in the embodiment of the present application, after the second sub-module registers the event corresponding to the target service data with the message bus, the main module may also register the event to implement monitoring of the event. It should be understood that, in the embodiment of the present application, the main module registers and listens for all data events accessed across modules, thereby ensuring that the data communication manner between the sub-modules can be effectively performed.
S403: and calling an authentication center to authenticate the second sub-module.
In this embodiment, after monitoring the target service data sent to the message bus by the first sub-module, the main module may authenticate the second sub-module to determine whether the second sub-module has the right to acquire the target service data. If the authentication is passed, executing step S404 and step S405; if the authentication is not passed, step S404 and step S405 are not performed.
It should be noted that, in the embodiment of the present application, the micro front-end system may obtain the latest user information and permission information again when the page refreshes or reloads the sub-module. At this time, the re-acquired user information and the right information may change, so that there may be a case that the authentication performed by the second sub-module is not passed before, but the authentication performed by the second sub-module is passed after the sub-module is refreshed or reloaded on the page.
S404: and when the second submodule has the authority to acquire the target service data, sending data address information of the target service data to the message bus.
S405: and the second submodule acquires target service data according to the data address information after monitoring the data address information corresponding to the event on the message bus.
In this embodiment of the present application, the target service data may be stored in the global data pool, and the data address information sent by the master module is a storage address of the target service data in the global data pool.
It should be noted that, in the embodiment of the present application, the message bus, the authentication center, and the global data pool may all be integrated in the main module, so as to facilitate the main module to call. Of course, the message bus, the authentication center, and the global data pool may not be integrated in the main module, or may be partially integrated in the main module, which is not limited in the embodiment of the present application.
It should be further noted that the backend service described in the embodiment of the present application may be a backend microservice. In the embodiment of the application, the front terminal module can be similar to the back-end micro service module and all perform service decoupling, and one sub-module corresponds to one independent back-end micro service module. It should be understood that, in practical applications, the service is relatively complex, and therefore, one sub-module may be configured to invoke multiple back-end micro services, or a plurality of sub-modules may be configured to invoke the same micro service.
By the data communication method between the modules in the micro front-end system provided by the embodiment of the application, different communication mechanisms can be adopted for communication conditions between different modules, so that the communication efficiency can be ensured, and the data safety in the communication process between the modules can also be ensured.
Example two:
in this embodiment, on the basis of the first embodiment, a case where a sub module accesses data of a main module in a cloud environment is taken as an example to illustrate a scheme of the present application.
Referring to fig. 5, the micro-front end system includes a main module and a plurality of sub-modules. The main module is integrated with an authentication center and a message bus, and the main module and the sub-modules can call each back-end micro-service through an external API gateway.
In the embodiment of the application, after the user logs in, the main module acquires user information and permission information. The following are examples of the user information obtained:
Figure BDA0002362237020000131
assuming the user chooses to enter scope2 (data field 2), the master module can get the role of the user under scope2 as role2 based on the above information.
The master acquires the role rights under this role 2. An example of role permissions is as follows:
Figure BDA0002362237020000132
Figure BDA0002362237020000141
the main module can obtain the authority of the user for reading, starting, shutting down, restarting and making a mirror image for the cloud host under the role of role2 according to the information, and the authority for reading, mounting, unloading and snapshotting the cloud hard disk.
Assuming that a user accesses module one at scope2 (data field 2), first obtain module one rights for the module as follows:
Figure BDA0002362237020000142
Figure BDA0002362237020000151
the module permission of the first module comprises a main resource cloud host permission and a related resource cloud hard disk permission, the cloud host permission comprises the permissions of creating, reading, deleting, starting, shutting down, restarting, mirror image making, hot upgrading, name changing and password modifying, and the related resource cloud hard disk permission comprises the permission of mounting and unloading.
And taking the intersection of the role authority and the module authority to obtain the operation authority of the user on the resource in the module one of scope 2:
Figure BDA0002362237020000152
the authority for reading, starting, shutting down, restarting and manufacturing the mirror image of the cloud host and the authority for mounting and dismounting the cloud hard disk are obtained.
The main module sends the user information and the determined authority information (namely, the authority for reading, starting, shutting down, restarting and mirror image making of the cloud host, and the authority for mounting and dismounting the cloud hard disk) to the first module, and the first module renders according to the authority information sent by the main module to obtain a first module display interface of the user under scope 2.
Example three:
based on the same inventive concept, the embodiment of the application also provides four data communication devices among modules in the micro front-end system. Referring to fig. 6, 7, 8 and 9, fig. 6 shows a data communication apparatus 100 corresponding to the method shown in fig. 1, fig. 7 shows a data communication apparatus 200 corresponding to the method shown in fig. 3, fig. 8 shows a data communication apparatus 300 corresponding to steps performed by a main module in the method shown in fig. 4, and fig. 9 shows a data communication apparatus 400 corresponding to steps performed by a second sub-module in the method shown in fig. 4. It should be understood that the specific functions of the data communication apparatus can be referred to the above description, and the detailed description is appropriately omitted herein to avoid redundancy. The data communication device includes at least one software functional module that can be stored in memory in the form of software or firmware or solidified in the operating system of the data communication device. Specifically, the method comprises the following steps:
referring to fig. 6, the data communication apparatus 100 is applied to a main module, and includes: a first acquisition unit 101, a rendering processing unit 102, and a transfer unit 103. Wherein:
a first obtaining unit 101, configured to obtain user information and permission information of a user when the user logs in;
the rendering processing unit 102 is configured to render a master module page corresponding to the permission information; the main module page comprises sub module entries corresponding to the authority information;
the transmission unit 103 is used for transmitting the user information and the authority information related to the sub-module when receiving a selection instruction for any sub-module, so that the sub-module renders a sub-module page corresponding to the authority information; the sub-module page comprises each operation entry which is provided by the sub-module and corresponds to the authority information.
In a possible implementation manner of the embodiment of the application, the user information includes role information of the user in different data domains; the authority information comprises authorities corresponding to different role information. The transferring unit 103 is specifically configured to transfer the role information in the data domain corresponding to the selection instruction and the authority corresponding to the role information to the sub-module.
In a possible implementation manner of the embodiment of the present application, the rendering processing unit 102 is further configured to determine whether a loaded sub-module is a sub-module indicated by the selection instruction before the transmitting unit 103 transmits the user information and the permission information related to the sub-module; if the loaded sub-module is not the sub-module indicated by the selection instruction, unloading the loaded sub-module; and loading the sub-module indicated by the selection instruction.
Referring to fig. 7, the data communication apparatus 200, applied to the primary module, includes: a first registration unit 201 and a second acquisition unit 202. Wherein:
a first registration unit 201, configured to register a required data event on a message bus, and continuously monitor; the data event is an event needing to be accessed to call the back-end service for processing;
a second obtaining unit 202, configured to obtain data response information from the message bus after monitoring the data response information of the data event; and the data response information is acquired by calling the back-end service by the submodule to be accessed and is sent to the message bus.
In a possible implementation manner of the embodiment of the present application, the first registration unit 201 is specifically configured to register a required data event on the message bus in a non-authenticated manner.
Referring to fig. 8, the data communication apparatus 300, applied to the main module, includes: a processing unit 301, a calling unit 302 and a sending unit 303. Wherein:
the processing unit 301 is configured to, after monitoring target service data sent to the message bus by the first sub-module, query, according to the target service data, a second sub-module in which an event corresponding to the target service data is registered;
a calling unit 302, configured to call an authentication center to authenticate the second sub-module;
a sending unit 303, configured to send data address information of the target service data to the message bus when the second submodule has a right to obtain the target service data, so that the second submodule obtains the target service data according to the data address information after monitoring the data address information.
In a possible implementation manner of the embodiment of the present application, the processing unit 301 is further configured to register all data events accessed across modules on the message bus in a non-authenticated manner, and continuously listen.
In a possible implementation manner of the embodiment of the present application, the processing unit 301 is further configured to store the target service data in a global data pool; the data address information of the target service data is the storage address of the target service data in the global data pool.
Referring to fig. 9, the data communication apparatus 400 is applied to a sub-module, and includes a registration listening unit 401 and a third acquisition unit 402. Wherein:
a registration monitoring unit 401, configured to register an event corresponding to target service data with a message bus, and continuously monitor the event;
a third obtaining unit 402, configured to obtain the target service data according to the data address information after monitoring the data address information of the corresponding event on the message bus.
It should be understood that, for the sake of brevity, the contents described in some embodiments are not repeated in this embodiment.
Example four:
the embodiment provides a micro-front-end system, which comprises a main module and a plurality of sub-modules. Wherein:
the master module may perform the steps performed by the master module in the data communication method shown in fig. 1, so as to implement data communication from the master module to the slave module; the data communication method shown in fig. 3 may also be performed to enable the main module to access the sub-module data; the steps executed by the main module in the data communication method shown in fig. 4 may also be executed to implement data communication between the sub-modules; the sub-modules may implement the steps performed by the sub-modules in each illustrated process in the first embodiment.
It is understood that the micro-front-end system further comprises components such as a message bus, an authentication center, a global data pool, and the like. In the embodiment of the present application, the message bus, the authentication center, the global data pool, and the like may be integrated into the main module, for example, as shown in fig. 5.
The present embodiment further provides a readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash Memory, a usb (secure digital Card), an MMC (Multimedia Card), etc., in which one or more programs for implementing the above steps are stored, and the one or more programs can be executed by one or more processors to implement the data communication method between the modules in the micro front-end system according to any of the above embodiments. And will not be described in detail herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
In this context, a plurality means two or more.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (15)

1. A method for data communication between modules in a micro-front-end system, comprising:
when a user logs in, a main module acquires user information and authority information of the user;
the main module renders a main module page corresponding to the authority information; the main module page comprises sub module entries corresponding to the authority information;
when a selection instruction for any sub-module is received, the user information and the authority information related to the sub-module are transmitted to the sub-module, so that the sub-module renders a sub-module page corresponding to the authority information, and the sub-module page comprises operation entries corresponding to the authority information and possessed by the sub-module.
2. The method for data communication between modules according to claim 1, wherein said user information includes role information of said user under different data domains; the authority information comprises authorities corresponding to different role information;
transmitting the user information and the authority information related to the sub-module, including:
and transmitting the role information under the data domain corresponding to the selection instruction and the authority corresponding to the role information to the sub-module.
3. The method of data communication between modules of claim 1 or 2, wherein prior to passing the user information and the rights information associated with the sub-module to the sub-module, the method further comprises:
judging whether the loaded sub-module is the sub-module indicated by the selection instruction;
if the loaded sub-module is not the sub-module indicated by the selection instruction, unloading the loaded sub-module;
and loading the sub-module indicated by the selection instruction.
4. A method for data communication between modules in a micro-front-end system, which is applied to a process of accessing a sub-module by a main module, the method comprises the following steps:
the main module registers the needed data event on the message bus and continuously monitors; the data event is an event needing to be processed by calling a back-end service by the sub-module to be accessed;
after monitoring the data response information of the data event, acquiring the data response information from the message bus; the data response information is obtained by calling a back-end service by the sub-module to be accessed and is sent to the message bus.
5. The method for data communication between modules according to claim 4, wherein said master module registering a desired data event on the message bus comprises:
the master module registers the required data events on the message bus in a non-authenticated manner.
6. A method for data communication between modules in a micro-front-end system is applied to a data access process between sub-modules, and the method comprises the following steps:
after monitoring target service data sent to a message bus by a first submodule, a main module inquires a second submodule registered with an event corresponding to the target service data according to the target service data;
calling an authentication center to authenticate the second sub-module;
and when the second submodule has the authority to acquire the target service data, transmitting data address information of the target service data to the message bus, so that the second submodule acquires the target service data according to the data address information after monitoring the data address information.
7. The method for data communication between modules of claim 6, wherein said method further comprises:
the main module registers all data events accessed across modules on the message bus in a non-authentication mode and continuously monitors.
8. The method for data communication between modules according to claim 6 or 7, wherein the master module, after listening for the target service data sent by the first sub-module to the message bus, further comprises:
storing the target service data into a global data pool;
and the data address information of the target service data is the storage address of the target service data in the global data pool.
9. A method for data communication between modules in a micro-front-end system is applied to a data access process between sub-modules, and the method comprises the following steps:
the second sub-module registers an event corresponding to the target service data to the message bus and continuously monitors;
and after monitoring data address information corresponding to the event on the message bus, acquiring the target service data according to the data address information.
10. An apparatus for data communication between modules in a micro-front-end system, applied to a main module, comprising: the device comprises a first acquisition unit, a rendering processing unit and a transmission unit;
the first acquisition unit is used for acquiring user information and authority information of a user when the user logs in;
the rendering processing unit is used for rendering a main module page corresponding to the authority information; the main module page comprises sub module entries corresponding to the authority information;
the transmission unit is used for transmitting the user information and the authority information related to the sub-module when a selection instruction for any sub-module is received, so that the sub-module renders a sub-module page corresponding to the authority information; the sub-module comprises each operation entry which is provided by the sub-module and corresponds to the authority information.
11. An apparatus for data communication between modules in a micro-front-end system, applied to a main module, comprising: a first registration unit and a second acquisition unit;
the first registration unit is used for registering a required data event on a message bus and continuously monitoring; the data event is an event needing to be processed by calling a back-end service by the sub-module to be accessed;
the second obtaining unit is configured to obtain the data response information from the message bus after monitoring the data response information of the data event; and the data response information is acquired by calling a back-end service by the submodule to be accessed and is sent to the message bus.
12. An apparatus for data communication between modules in a micro-front-end system, applied to a main module, comprising: the system comprises a processing unit, a calling unit and a sending unit;
the processing unit is used for inquiring a second sub-module which is registered with an event corresponding to target service data according to the target service data after monitoring the target service data sent to a message bus by the first sub-module;
the calling unit is used for calling an authentication center to authenticate the second sub-module;
the sending unit is configured to send data address information of the target service data to the message bus when the second submodule has a right to acquire the target service data, so that the second submodule acquires the target service data according to the data address information after monitoring the data address information.
13. A data communication device between modules in a micro-front-end system is applied to a sub-module and comprises the following components: a registration monitoring unit and a third acquisition unit;
the registration monitoring unit is used for registering an event corresponding to the target service data to the message bus and continuously monitoring;
and the third obtaining unit is configured to obtain the target service data according to the data address information after monitoring data address information corresponding to the event on the message bus.
14. A micro-front-end system, comprising: a main module and a plurality of sub-modules;
the master module, configured to perform the data communication method according to any one of claims 1 to 3, so as to implement master module-to-slave module data communication; or for performing the data communication method according to claim 4 or 5, to enable access by the main module to sub-module data; or for performing the data communication method of any of claims 6-8 to enable data communication between sub-modules;
the sub-modules, configured to perform the data communication method according to claim 9, so as to implement data communication between the sub-modules.
15. A readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the method for data communication between modules in a micro-front-end system as claimed in any one of claims 1-9.
CN202010025624.4A 2020-01-10 2020-01-10 Data communication method, device, micro front-end system and storage medium Active CN111240863B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010025624.4A CN111240863B (en) 2020-01-10 2020-01-10 Data communication method, device, micro front-end system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010025624.4A CN111240863B (en) 2020-01-10 2020-01-10 Data communication method, device, micro front-end system and storage medium

Publications (2)

Publication Number Publication Date
CN111240863A true CN111240863A (en) 2020-06-05
CN111240863B CN111240863B (en) 2024-02-06

Family

ID=70872393

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010025624.4A Active CN111240863B (en) 2020-01-10 2020-01-10 Data communication method, device, micro front-end system and storage medium

Country Status (1)

Country Link
CN (1) CN111240863B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612467A (en) * 2020-12-22 2021-04-06 中国建设银行股份有限公司 Method and device for processing micro front-end architecture based on qiankun
CN112804330A (en) * 2021-01-14 2021-05-14 京东数字科技控股股份有限公司 Application communication method and device
CN113568652A (en) * 2021-06-29 2021-10-29 深圳云之家网络有限公司 Application system processing method and device, computer equipment and storage medium
CN113688343A (en) * 2021-07-23 2021-11-23 济南浪潮数据技术有限公司 Page permission control method, device, equipment and readable storage medium
US11410104B2 (en) 2013-12-20 2022-08-09 Walmart Apollo, Llc Systems and methods for event detection and device control in a distributed computing environment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101082896A (en) * 2007-08-03 2007-12-05 杭州华三通信技术有限公司 Control method and device between master-salve module
CN101277193A (en) * 2008-05-05 2008-10-01 北京航空航天大学 One-point entry and access system based on authentication service acting information facing to service architecture
WO2018014657A1 (en) * 2016-07-20 2018-01-25 中兴通讯股份有限公司 Unified portal method, apparatus and system
CN108243183A (en) * 2017-12-20 2018-07-03 北京车和家信息技术有限公司 Integrated control method, system and the computer equipment of gate system
CN109246089A (en) * 2018-08-20 2019-01-18 北京交通大学 A kind of the front and back end separation architecture access control system and method for based role
CN109379369A (en) * 2018-11-09 2019-02-22 中国平安人寿保险股份有限公司 Single-point logging method, device, server and storage medium
CN109460529A (en) * 2018-10-15 2019-03-12 杭州安恒信息技术股份有限公司 A kind of front end micro services module communication means based on iframe
CN109542538A (en) * 2018-11-22 2019-03-29 郑州云海信息技术有限公司 A kind of management subsystem method and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101082896A (en) * 2007-08-03 2007-12-05 杭州华三通信技术有限公司 Control method and device between master-salve module
CN101277193A (en) * 2008-05-05 2008-10-01 北京航空航天大学 One-point entry and access system based on authentication service acting information facing to service architecture
WO2018014657A1 (en) * 2016-07-20 2018-01-25 中兴通讯股份有限公司 Unified portal method, apparatus and system
CN108243183A (en) * 2017-12-20 2018-07-03 北京车和家信息技术有限公司 Integrated control method, system and the computer equipment of gate system
CN109246089A (en) * 2018-08-20 2019-01-18 北京交通大学 A kind of the front and back end separation architecture access control system and method for based role
CN109460529A (en) * 2018-10-15 2019-03-12 杭州安恒信息技术股份有限公司 A kind of front end micro services module communication means based on iframe
CN109379369A (en) * 2018-11-09 2019-02-22 中国平安人寿保险股份有限公司 Single-point logging method, device, server and storage medium
CN109542538A (en) * 2018-11-22 2019-03-29 郑州云海信息技术有限公司 A kind of management subsystem method and system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11410104B2 (en) 2013-12-20 2022-08-09 Walmart Apollo, Llc Systems and methods for event detection and device control in a distributed computing environment
CN112612467A (en) * 2020-12-22 2021-04-06 中国建设银行股份有限公司 Method and device for processing micro front-end architecture based on qiankun
CN112804330A (en) * 2021-01-14 2021-05-14 京东数字科技控股股份有限公司 Application communication method and device
CN113568652A (en) * 2021-06-29 2021-10-29 深圳云之家网络有限公司 Application system processing method and device, computer equipment and storage medium
CN113688343A (en) * 2021-07-23 2021-11-23 济南浪潮数据技术有限公司 Page permission control method, device, equipment and readable storage medium
CN113688343B (en) * 2021-07-23 2023-11-03 济南浪潮数据技术有限公司 Page authority control method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN111240863B (en) 2024-02-06

Similar Documents

Publication Publication Date Title
CN111240863A (en) Data communication method, device, micro front-end system and storage medium
CN110377369B (en) Method, device and computer storage medium for running small program
CN111371809B (en) Server based on reverse proxy architecture and GIS service access control method
CN114025021A (en) Communication method, system, medium and electronic device across Kubernetes cluster
CN110532106B (en) Inter-process communication method, device, equipment and storage medium
US20220245005A1 (en) Methods, devices and computer storage media for inter-mini program platform discovery
WO2020181814A1 (en) Application program upgrading method and apparatus, terminal and computer readable storage medium
CN112040071B (en) Number protection method, device and system and number calling method and device
WO2021088671A1 (en) Method for calling terminal capability, device, and computer storage medium
CN114257440A (en) Network function service discovery method, system and storage medium
CN114637703A (en) Data access device, method, readable medium and electronic equipment
CN115114042A (en) Storage data access method and device, electronic equipment and storage medium
CN112818336A (en) Data access method, data access device and computer readable storage medium
CN111581576A (en) Development processing method and device based on micro-service and storage medium
CN115422277A (en) Data source connection pool control method and device and server
CN114637525A (en) Method, device, equipment and medium for compatibility of SDK and access application
CN112558939A (en) Method, system and equipment for constructing service satellite-borne software of software-defined satellite
KR102086088B1 (en) Terminal, device manager application and service application for changing access point name
CN111580987A (en) Remote procedure calling method and device, storage medium and terminal equipment
CN110765426A (en) Equipment permission setting method, device, equipment and computer storage medium
CN113704274B (en) Data reading method and electronic equipment
CN113157604B (en) Data acquisition method and device based on distributed system and related products
CN114025013B (en) Information processing method, device and equipment
EP4383651A1 (en) Micro-service logic network and construction method and apparatus thereof, device and readable medium
CN117539802B (en) Cache operation method, system and related device

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
GR01 Patent grant
GR01 Patent grant