CN111240863B - 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
CN111240863B
CN111240863B CN202010025624.4A CN202010025624A CN111240863B CN 111240863 B CN111240863 B CN 111240863B CN 202010025624 A CN202010025624 A CN 202010025624A CN 111240863 B CN111240863 B CN 111240863B
Authority
CN
China
Prior art keywords
module
sub
data
information
target service
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.)
Active
Application number
CN202010025624.4A
Other languages
Chinese (zh)
Other versions
CN111240863A (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

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 acquires user information and authority information of the user, and further 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, user information and 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. In this way, the master module controls the slave module, so that the slave module accesses the data of the master module, the data is reliably transmitted from the master module to the slave module, and the reliable communication between the master module and the slave module 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 technical field of micro front ends, and in particular, to a data communication method, a data communication device, a micro front end system, and a storage medium.
Background
Micro front ends (micro front ends) are an architecture similar to micro services that apply the micro services concept to the browser side, i.e., converting a single page front end application from a single monolithic application to an application that aggregates multiple small front end applications into one. Each front-end application can be independently developed and independently deployed.
Currently, since small-sized front-end applications often have different functions, the reliability of communication between the small-sized front-end applications (each small-sized front-end application may also be referred to as each module in the front-end application) directly affects the reliability of the overall front-end architecture. Therefore, how to realize the secure access of data between different modules in the front-end application becomes a problem to be solved.
Disclosure of Invention
An objective of the embodiments of the present application is to provide a data communication method, device, micro front-end system and storage medium, which are used for implementing reliable communication between modules in front-end application.
The embodiment of the application provides a data communication method between 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 master module renders a master 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.
In the implementation process, when the user logs in, the main module acquires the user information and the authority information of the user, and further 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. 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. In this way, the master module controls the slave module, so that the slave module accesses the data of the master module, the data is reliably transmitted from the master module to the slave module, and the reliable communication between the master module and the slave module is realized to a certain extent.
Further, the user information comprises role information of the user in different data fields; the authority information comprises authorities corresponding to different role information; delivering the user information and rights information associated with the sub-module to the sub-module, comprising: and transmitting the role information under the data field corresponding to the selection instruction and the authority corresponding to the role information to the submodule.
It should be appreciated that in complex traffic scenarios with multiple data ranges, the same user may play different roles under different data fields, with different roles corresponding to different rights. Therefore, in the embodiment of the application, the role information under 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 under the current data domain, and the requirement of user operation under the complex service scene of multiple data ranges is met.
Further, before said transferring said user information and rights information related to said sub-module, said method further comprises: judging whether the loaded sub-module is the sub-module indicated by the selection instruction; if the loaded submodule is not the submodule indicated by the selection instruction, unloading the loaded submodule; and loading the sub-module indicated by the selection instruction.
In the implementation process, when the loaded submodule is not the submodule indicated by the selection instruction, unloading the loaded submodule, and then loading the submodule indicated by the selection instruction; when the loaded sub-module is 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 only acquire 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 application also provides a data communication method among modules in the micro front-end system, which is applied to the process of accessing the sub-modules by the main module, and comprises the following steps:
the main module registers required data events on a message bus and monitors continuously; the data event is an event which needs to be processed by calling the back-end service by the sub-module to be accessed; acquiring the data response information after the data response information of the data event is monitored; the data response information is information which 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 registers the required data event on the message bus and continuously monitors the data event, so that after the data response information of the data event is monitored, the data response information is obtained from the message bus, the access to the data of the sub-module is realized, the data obtaining is realized through the message bus in the whole process, and the reliable communication between the main module and the sub-module is realized to a certain extent.
Further, the registering, by the master module, the required data event on the message bus includes: the master module registers the required data event on the message bus in a non-authenticated manner.
In the implementation process, the main module is an external port of the whole micro front-end system, 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 the message bus in a non-authentication mode, and the communication efficiency is improved.
The embodiment of the application also provides a data communication method among modules in the micro front-end system, which is applied to the data access process among sub-modules, and comprises the following steps:
after the main module monitors target service data sent to a message bus by the first sub-module, the second sub-module registered with an event corresponding to the target service data is queried according to the target service data; invoking an authentication center to authenticate the second sub-module; and when the second sub-module has permission to acquire the target service data, sending data address information of the target service data to the message bus, so that the second sub-module acquires the target service data according to the data address information after monitoring the data address information.
In the implementation process, after the main module monitors the target service data sent by the first sub-module to the message bus, the second sub-module registered with the event corresponding to the target service data is queried according to the target service data, and then the authentication center is called to authenticate the second sub-module, and when the second sub-module has permission to acquire the target service data, the data address information of the target service data is sent to the message bus. And the second sub-module registers an event corresponding to the target service data and monitors the event, and after the data address information is monitored, the target service data can be acquired according to the data address information. Therefore, the control of data communication among the sub-modules is realized through the centering coordination of the main modules, and the authentication is needed to be carried out by the main modules when the sub-modules want to acquire the data of another sub-module, so that the reliability communication among the sub-modules is realized, and the safety of the data communication is improved.
Further, the method further comprises: the master module registers all cross-module accessed data events on the message bus in a non-authenticated manner and continues listening.
Further, after the main module monitors the target service data sent to the message bus by the first sub-module, the method further includes: storing the target service data into a global data pool; the data address information of the target service data is a 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 are convenient to acquire, and convenience in implementation of the scheme is improved.
The embodiment of the application also provides a data communication method among modules in the micro front-end system, which is applied to the data access process among sub-modules, and comprises the following steps:
the second sub-module registers an event corresponding to the target service data to the message bus and monitors continuously; and after the data address information corresponding to the event on the message bus is monitored, acquiring the target service data according to the data address information.
In the implementation process, the second sub-module registers an event corresponding to the target service data to the message bus and monitors the event, and after monitoring the data address information, the second sub-module can acquire the target service data according to the data address information. In this way, data communication between sub-modules is achieved.
The embodiment of the application also provides a data communication device between modules in the micro front-end system, which is applied to the main module and comprises: the system comprises a first acquisition unit, a rendering processing unit and a transfer 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 the main module page corresponding to the authority information; the main module page comprises sub-module entries corresponding to the authority information;
the transfer unit is used for transferring the user information and the authority information related to the submodule when a selection instruction for any submodule is received, so that the submodule renders a submodule 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.
The embodiment of the application also provides a data communication device between modules in the micro front-end system, which is applied to the main module and comprises: a first registration unit and a second acquisition unit;
the first registration unit is used for registering required data events on the message bus and continuously monitoring; the data event is an event which needs to be processed by calling the 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 the data response information of the data event is monitored; and the data response information is acquired by the to-be-accessed submodule calling back-end service and is sent to the message bus.
The embodiment of the application also provides a data communication device between modules in the micro front-end system, which is applied to the main module and comprises: the device comprises a processing unit, a calling unit and a sending unit;
the processing unit is used for inquiring the second sub-module registered with the event corresponding to the target service data according to the target service data after monitoring the target service data sent to the message bus by the first sub-module;
the calling unit is used for calling an authentication center to authenticate the second submodule;
the sending unit is configured to send data address information of the target service data to the message bus when the second sub-module has permission to acquire the target service data, so that the second sub-module acquires the target service data according to the data address information after monitoring the data address information.
The embodiment of the application also provides a data communication device between modules in the micro front-end system, which is applied to the sub-modules and comprises: 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 acquisition unit is used for acquiring the target service data according to the data address information after the data address information corresponding to the event on the message bus is monitored.
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 configured to execute the first data communication method provided above, so as to implement data communication from the main module to the sub-module; or is used for executing the second data communication method provided above so as to realize the access of the main module to the sub-module data; or for executing the third data communication method provided above to realize data communication between the sub-modules;
the submodule is configured to execute the fourth data communication method provided above, so as to implement data communication between the submodules.
The embodiment of the application also provides a readable storage medium, wherein the readable storage medium 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 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 needed 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 should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic data communication flow chart of a case 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 main module page according to an embodiment of the present application;
fig. 3 is a schematic data communication flow chart for a case where a main module accesses data of a sub-module according to an embodiment of the present application;
fig. 4 is a schematic diagram of a data communication flow for a case of data access between sub-modules according to an embodiment of the present application;
fig. 5 is a schematic diagram of a front-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.
Embodiment one:
the scheme provided by the embodiment of the application is applied to the micro front-end system. The micro front-end system is an application structure in which one application is constituted by a plurality of front-end applications. In this 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 for interfacing with a user in the whole front-end application, and also plays a 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 cases between the modules. Specifically, there are cases where the sub-module accesses data of the main module, where the main module accesses data of the sub-module, and where data access is performed between the sub-modules. In the embodiment of the application, aiming at different communication conditions, different data communication modes among modules are adopted to realize data communication among modules in the micro front-end system.
For the case that the submodule accesses the data of the main module, the data communication manner between the modules provided in the embodiment of the present application may be shown in fig. 1, which includes:
s101: when the user logs in, the main module acquires user information and authority information of the user.
It should be appreciated that since the master module is the portal module that interfaces to the user throughout the front-end application, the master module is accessed first after the user logs in. In the embodiment of the application, the main module can call a corresponding API (interface) to acquire the user information and the authority information of the user from the back-end service.
S102: the master module renders the master module page corresponding to the authority information.
It should be noted that in the embodiment of the present application, the rendered main module page includes sub-module entries corresponding to the authority information. For example, in the micro front-end system, there are five sub-modules numbered 1, 2, 3, 4 and 5, and the sub-modules accessible according to the user rights have only three sub-modules numbered 1, 2 and 3, so that the rendered main module page may have only sub-module inlets of the three sub-modules numbered 1, 2 and 3 (for example, see fig. 2), or the rendered main module page may include sub-module inlets of all sub-modules, but sub-module inlets of sub-modules numbered 4 and 5 are displayed as unavailable.
S103: and when receiving a selection instruction for any sub-module, transmitting the user information and the authority information related to the sub-module.
It should be understood that the submodule selected by the selection instruction should be a submodule which meets the rights information requirements of the user.
S104: the sub-module renders sub-module pages corresponding to the authority information associated with the sub-module.
In the embodiment of the application, the module authority of the sub-module can be acquired. The module authority of the sub-module refers to the resource authority of the sub-module. In the embodiment of the 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 of the user on the sub-module, namely the authority information related to the sub-module.
In the embodiment of the application, the sub-module page comprises operation entries which are provided by the sub-module and are authorized to be operated by a user, and different resources can be called through different operation entries. It should be appreciated that under different rights, the resources available to the user for operation may be different. For this reason, in the embodiment of the present application, only each operation entry that shows that the user has authority to perform an operation may be rendered, or all operation entries that the sub-module has may be rendered and displayed, but operation entries outside the authority are limited to be unavailable.
It is worth noting that in practical applications, there are complex business scenarios with multiple data ranges. In complex business scenarios with multiple data ranges, the same user may play different roles in different data fields, and different roles correspond to different rights. In the embodiment of the application, all the role information of the user and the role rights corresponding to the role information can be acquired, and further the corresponding main module pages are respectively rendered according to the role rights of different role information. The micro front-end system is provided with five sub-modules with numbers of 1, 2, 3, 4 and 5, a user has two roles A and B, the sub-modules which can be accessed by the role authority corresponding to the role under the role A are three sub-modules with numbers of 1, 2 and 3, the sub-modules which can be accessed by the role authority corresponding to the role under 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 a main module and provided for the user. For example, the main module pages corresponding to one character can be displayed to the user at a time in a similar switching manner to the web page, but the user can select to switch to the main module pages corresponding to the other characters.
Correspondingly, when a user selects a certain sub-module, namely, when the main module receives a selection instruction for any sub-module, the user information sent to the sub-module and the authority information related to the sub-module comprise: role information under the data domain corresponding to the selection instruction (namely, the data domain to which the main module page belongs when the user issues the selection instruction) and the authority corresponding to the role information. At this time, the sub-module renders the 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 role information, basic information of the user, such as one or more of user name, user phone, 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 can determine whether the loaded sub-module is the sub-module indicated by the selection instruction. If yes, the user information and the 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 after loading is finished, the user information and the authority information related to the sub-module are transferred to the sub-module.
For the case that the main module accesses the data of the sub-module, the data communication manner between the modules provided in the embodiment of the present application may be shown in fig. 3, which includes:
s301: the master module registers the required data events on the message bus and continues listening.
In the embodiment of the application, the data event registered by the main module on the message bus is an event which needs to be accessed by the sub-module to call the back-end service for processing. For example, the main module needs to acquire the data a, where the data a needs to be acquired by the sub-module 1 calling the back-end service, 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 the data response information of the data event is monitored.
The data response information is information which is acquired by calling the back-end service by the sub-module to be accessed and is sent to the message bus. It should be understood that, in this embodiment of the present application, after the main module registers a required data event on the message bus, the message bus may not notify the sub-module to be accessed, but the sub-module to be accessed is continuously executed according to its execution logic, and after a certain execution procedure invokes the back-end service to obtain the data response information, the data response information is sent to the message bus.
It should be appreciated that in the registration snoop mechanism, after a certain data event is registered on the message bus, the data event is continuously listened to.
It should be further noted that, in the embodiment of the present 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 this embodiment of the present application, the master module has the highest authority in the whole micro front-end system, so in this embodiment of the present application, when the master module registers a data event in the message bus, the master module may register in a non-authentication mode, that is, directly registers the data event in the message bus without performing authority authentication, and may directly acquire data from the global data pool.
For the case of data access between sub-modules, the data communication manner between the modules provided in the embodiments of the present application may be shown in fig. 4, which includes:
s401: the second sub-module registers the event corresponding to the target service data to the message bus and monitors continuously.
S402: after the main module monitors the target service data sent to the message bus by the first sub-module, the second sub-module registered with the event corresponding to the target service data is queried according to the target service data.
Note that, in the registration monitor mechanism, after a certain event is registered on the message bus, the event is continuously monitored. Therefore, in the embodiment of the present application, after the second sub-module registers the event corresponding to the target service data to the message bus, the main module may also register the event to realize monitoring of the event. It should be understood that in the embodiment of the present application, the main module registers and listens to all data events accessed across modules, so as to ensure 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 of the present application, after the main module monitors the target service data sent by the first sub-module to the message bus, the second sub-module may be authenticated, so as to determine whether the second sub-module has the authority 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 retrieve the latest user information and authority information when the page refreshes or reloads the sub-module. The user information and the permission information obtained again may change at this time, so there may be a case that the second sub-module is not authenticated before, but the second sub-module is authenticated after the page is refreshed or reloaded.
S404: and when the second sub-module has authority to acquire the target service data, sending the data address information of the target service data to the message bus.
S405: and the second sub-module acquires the 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 be all integrated in the master module, so as to facilitate the call of the master module. 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 also be noted that the backend service described in the embodiments of the present application may be a backend micro-service. In this embodiment of the present application, the front terminal module may be similar to the back-end micro service, and perform service decoupling, where one sub-module corresponds to a single back-end micro service. It should be understood that the service is relatively complex in practical application, so that one sub-module may be set to call a plurality of back-end micro services, or a situation that a plurality of sub-modules may call the same micro service may be set.
By the data communication method among the modules in the micro front-end system, different communication conditions among the modules can adopt different communication mechanisms, so that the communication efficiency can be ensured, and the safety of data in the communication process among the modules can also be ensured.
Embodiment two:
in this embodiment, on the basis of the first embodiment, a case that a submodule accesses main module data in a cloud environment is taken as an example, and a scheme of the application is illustrated.
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-module 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 the user information and the authority information. The following are examples of the acquired user information:
assuming that the user chooses to enter scope2 (data field 2), the master module can obtain the role of the user under scope2 as roll 2 according to the above information.
The master module obtains the role rights under role2. Examples of role rights are as follows:
the main module can obtain the authority of the user for reading, starting up, shutting down, restarting and making mirror images under the role of role2 according to the information, and the authority of the user for reading, mounting, unloading and snapshot is provided for the cloud hard disk.
Assuming that the user accesses module one in scope2 (data field 2), first, the module one authority of the module is acquired as follows:
the module rights of the first module comprise main resource cloud host rights and associated resource cloud hard disk rights, the cloud host rights comprise rights of creating, reading, deleting, starting, shutting down, restarting, mirror image making, hot upgrading, name changing and password modifying, and the associated resource cloud hard disk rights comprise rights of mounting and unloading.
Taking the intersection of the role authority and the module authority to obtain the operation authority of the user on the resource in the first module of scope 2:
and obtaining the rights of reading, starting up, shutting down, restarting and making mirror images of the cloud host, and the rights of mounting and unloading the cloud hard disk.
The main module sends the user information and the determined authority information (namely, the authority for reading, starting up, shutting down, restarting and making mirror images of the cloud host and the authority for mounting and unloading 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 the scope 2.
Embodiment III:
based on the same inventive concept, the embodiment of the application also provides a data communication device among the modules in the four micro front-end systems. Referring to fig. 6, 7, 8 and 9, fig. 6 shows a data communication apparatus 100 in one-to-one correspondence with the method shown in fig. 1, fig. 7 shows a data communication apparatus 200 in one-to-one correspondence with the method shown in fig. 3, fig. 8 shows a data communication apparatus 300 in one-to-one correspondence with the steps executed by the main module in the method shown in fig. 4, and fig. 9 shows a data communication apparatus 400 in one-to-one correspondence with the steps executed by the second sub-module in the method shown in fig. 4. It should be appreciated that the specific functions of the data communication apparatus may be found in the above description, and detailed description is omitted here as appropriate to avoid repetition. 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 cured in an operating system of the data communication device. Specifically:
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, a transfer unit 103. Wherein:
a first obtaining unit 101, configured to obtain user information and authority information of a user when the user logs in;
the rendering processing unit 102 is configured to render a main module page corresponding to the permission information; the main module page comprises sub-module entries corresponding to the authority information;
a transmitting unit 103, configured to transmit, when receiving a selection instruction for any sub-module, user information and authority information related to the sub-module, so that the sub-module renders a sub-module page corresponding to the authority information; the sub-module page comprises operation entries corresponding to the authority information and provided by the sub-module.
In one possible implementation manner of the embodiment of the present application, the user information includes role information of the user in different data fields; the authority information comprises authorities corresponding to different role information. The transfer unit 103 is specifically configured to transfer the role information and the authority corresponding to the role information under the data field corresponding to the selection instruction to the sub-module.
In a possible implementation manner of the embodiment of the present application, before the transferring unit 103 transfers the user information and the authority information related to the sub-module, the rendering processing unit 102 is further configured to determine whether the loaded sub-module is a sub-module indicated by the selection instruction; if the loaded submodule is not the submodule indicated by the selection instruction, unloading the loaded submodule; the sub-module indicated by the select instruction is loaded.
Referring to fig. 7, the data communication apparatus 200 is applied to a main module, and 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 monitor continuously; the data event is an event which needs to be accessed and is processed by calling the back-end service by the sub-module to be accessed;
a second obtaining unit 202, configured to obtain the data response information from the message bus after monitoring the data response information of the data event; the data response information is acquired by calling the back-end service by the sub-module to be accessed and is sent to the message bus.
In a possible implementation of the embodiment of the present application, the first registration unit 201 is specifically configured to register the required data event on the message bus in a non-authenticated manner.
Referring to fig. 8, the data communication apparatus 300 is applied to a main module, and includes: a processing unit 301, a calling unit 302 and a transmitting unit 303. Wherein:
the processing unit 301 is configured to query, after monitoring the target service data sent by the first sub-module to the message bus, a second sub-module registered with an event corresponding to the target service data according to the target service data;
a calling unit 302, configured to call an authentication center to authenticate the second submodule;
And the sending unit 303 is configured to send data address information of the target service data to the message bus when the second sub-module has permission to obtain the target service data, so that the second sub-module obtains the target service data according to the data address information after hearing 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 to monitor continuously.
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 into a global data pool; the data address information of the target service data is a 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 monitor unit 401, configured to register an event corresponding to the target service data to the message bus, and monitor continuously;
and a third acquiring unit 402, configured to acquire 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 simplicity of description, the descriptions in the first embodiment are omitted in this embodiment.
Embodiment four:
the embodiment provides a micro front-end system, which comprises a main module and a plurality of sub-modules. Wherein:
the main module can execute the steps executed by the main module in the data communication method shown in fig. 1, so as to realize the data communication from the main module to the sub-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 performed by the main module in the data communication method shown in fig. 4 may also be performed to implement data communication between sub-modules; the submodules may be configured to execute steps performed by the submodules in each illustrated process in accordance with one embodiment.
It can be understood that the micro front-end system further comprises a message bus, an authentication center, a global data pool and the like. In this embodiment, the message bus, the authentication center, the global data pool, and other components may be integrated into the master module, for example, as shown in fig. 5.
The present embodiment also provides a readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a usb disk, an SD (Secure Digital Memory Card, secure digital Card) Card, an MMC (Multimedia Card) Card, or the like, in which one or more programs implementing the above steps are stored, and the one or more programs may be executed by one or more processors to implement a data communication method between modules in the micro front-end system of any one 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 manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
Further, the units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Furthermore, functional modules in various embodiments of the present application may be integrated together to form a single portion, or each module may exist alone, or two or more modules may be integrated to form a single portion.
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.
Herein, a plurality refers to two or more.
The foregoing is merely exemplary embodiments of the present application and is not intended to limit the scope of the present application, and various modifications and variations may be suggested to one skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims (13)

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 master module renders a master 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 provided by the sub-module;
Wherein the user information comprises role information of the user in different data fields; the authority information comprises authorities corresponding to different role information;
delivering the user information and rights information associated with the sub-module to the sub-module, comprising:
and transmitting the role information under the data field corresponding to the selection instruction and the authority corresponding to the role information to the submodule.
2. The method of inter-module data communication of claim 1, wherein prior to communicating the user information and 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 submodule is not the submodule indicated by the selection instruction, unloading the loaded submodule;
and loading the sub-module indicated by the selection instruction.
3. The method according to claim 1, wherein the method further comprises:
the main module registers required data events on a message bus and monitors continuously; the data event is an event which needs to be processed by calling the back-end service by the sub-module to be accessed;
After the data response information of the data event is monitored, acquiring the data response information from the message bus; the data response information is information which is obtained by calling a back-end service by the sub-module to be accessed and is sent to the message bus.
4. A method of inter-module data communication as claimed in claim 3, wherein said registering by said master module a desired data event on a message bus comprises:
the master module registers the required data event on the message bus in a non-authenticated manner.
5. The method according to claim 1, wherein the method further comprises:
after the main module monitors the target service data sent to the message bus by the first sub-module, the second sub-module registered with the event corresponding to the target service data is inquired according to the target service data;
invoking an authentication center to authenticate the second sub-module;
and when the second sub-module has permission to acquire the target service data, sending data address information of the target service data to the message bus, so that the second sub-module acquires the target service data according to the data address information after monitoring the data address information.
6. The method of inter-module data communication of claim 5, wherein the method further comprises:
the master module registers all cross-module accessed data events on the message bus in a non-authenticated manner and continues listening.
7. The method of inter-module data communication according to claim 5 or 6, wherein the main module monitors the target service data sent from the first sub-module to the message bus, the method further comprising:
storing the target service data into a global data pool;
the data address information of the target service data is a storage address of the target service data in the global data pool.
8. The method of claim 5, wherein the method further comprises:
the second sub-module registers an event corresponding to the target service data to the message bus and continuously monitors the event;
and after the data address information corresponding to the event on the message bus is monitored, acquiring the target service data according to the data address information, wherein the data address information is transmitted to the message bus when a main module in the micro front-end system calls an authentication center to authenticate the second sub-module and the second sub-module has permission to acquire the target service data, and the target service data is transmitted to the message bus by a first sub-module.
9. A data communication device between modules in a micro front-end system, which is applied to a main module, comprising: the system comprises a first acquisition unit, a rendering processing unit and a transfer 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 the main module page corresponding to the authority information; the main module page comprises sub-module entries corresponding to the authority information;
the transfer unit is used for transferring the user information and the authority information related to the submodule when a selection instruction for any submodule is received, so that the submodule renders a submodule page corresponding to the authority information; the sub-module comprises operation inlets corresponding to the authority information and possessed by the sub-module;
wherein the user information comprises role information of the user in different data fields; the authority information comprises authorities corresponding to different role information;
delivering the user information and rights information associated with the sub-module to the sub-module, comprising:
And transmitting the role information under the data field corresponding to the selection instruction and the authority corresponding to the role information to the submodule.
10. The apparatus of claim 9, wherein the main module further comprises: a first registration unit and a second acquisition unit;
the first registration unit is used for registering required data events on the message bus and continuously monitoring; the data event is an event which needs to be processed by calling the 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 the data response information of the data event is monitored; and the data response information is acquired by the to-be-accessed submodule calling back-end service and is sent to the message bus.
11. The apparatus of claim 9, wherein the main module further comprises: the device comprises a processing unit, a calling unit and a sending unit;
the processing unit is used for inquiring a 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 the message bus by the first sub-module;
The calling unit is used for calling an authentication center to authenticate the second submodule;
the sending unit is configured to send data address information of the target service data to the message bus when the second sub-module has permission to acquire the target service data, so that the second sub-module acquires the target service data according to the data address information after monitoring the data address information.
12. The apparatus of claim 11, wherein the sub-module further comprises: 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;
the third obtaining unit is configured to obtain the target service data according to the data address information after the data address information corresponding to the event on the message bus is monitored, where the data address information is obtained by the main module in the micro front-end system calling an authentication center to authenticate the second sub-module, and when the second sub-module has permission to obtain the target service data, the second sub-module sends the target service data to the message bus, and the target service data is sent to the message bus by the first sub-module.
13. A readable storage medium storing one or more programs executable by one or more processors to implement the method of data communication between modules in a micro front-end system of any of claims 1-8.
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 CN111240863A (en) 2020-06-05
CN111240863B true 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)

Families Citing this family (5)

* 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
CN112804330B (en) * 2021-01-14 2023-04-18 京东科技控股股份有限公司 Application communication method and device
CN113568652A (en) * 2021-06-29 2021-10-29 深圳云之家网络有限公司 Application system processing method and device, computer equipment and storage medium
CN113688343B (en) * 2021-07-23 2023-11-03 济南浪潮数据技术有限公司 Page authority control method, device, equipment and readable storage medium

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

Also Published As

Publication number Publication date
CN111240863A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN111240863B (en) Data communication method, device, micro front-end system and storage medium
CN114025021A (en) Communication method, system, medium and electronic device across Kubernetes cluster
EP3445019B1 (en) Vehicle-based communication method and system
US11853767B2 (en) Inter-core data processing method, system on chip and electronic device
CN111314452B (en) Shell access method, device, equipment and storage medium of cloud mobile phone
CN110377369B (en) Method, device and computer storage medium for running small program
CN104980448B (en) Remote monitoring method, device and system
CN114257440B (en) Network function service discovery method, system and storage medium
US20220245005A1 (en) Methods, devices and computer storage media for inter-mini program platform discovery
CN111371809B (en) Server based on reverse proxy architecture and GIS service access control method
WO2020181814A1 (en) Application program upgrading method and apparatus, terminal and computer readable storage medium
CN113032766A (en) Application authority management method and device
CN112835632B (en) Method and equipment for calling end capability and computer storage medium
CN114244654B (en) URL forwarding method, device, equipment and computer storage medium
CN114637703A (en) Data access device, method, readable medium and electronic equipment
CN112818336A (en) Data access method, data access device and computer readable storage medium
CN110784510A (en) Method for accessing target service node to bus and information interaction method of service node
CN112383617B (en) Method, device, terminal equipment and medium for performing long connection
CN112153168B (en) Network access method, device, computer equipment and storage medium
CN113541981B (en) Member management method and system for network slice
CN111580987A (en) Remote procedure calling method and device, storage medium and terminal equipment
KR102086088B1 (en) Terminal, device manager application and service application for changing access point name
CN112261051B (en) User registration method, device and system
WO2012026700A2 (en) File-transmitting method, and apparatuses for performing the method
CN110445798B (en) DNS anti-hijacking method and device and electronic equipment

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