CN112148501A - Communication method and device for multiple sub-applications, electronic device and storage medium - Google Patents
Communication method and device for multiple sub-applications, electronic device and storage medium Download PDFInfo
- Publication number
- CN112148501A CN112148501A CN202010884743.5A CN202010884743A CN112148501A CN 112148501 A CN112148501 A CN 112148501A CN 202010884743 A CN202010884743 A CN 202010884743A CN 112148501 A CN112148501 A CN 112148501A
- Authority
- CN
- China
- Prior art keywords
- sub
- application
- applications
- interface
- communication
- 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.)
- Withdrawn
Links
- 238000004891 communication Methods 0.000 title claims abstract description 154
- 238000000034 method Methods 0.000 title claims abstract description 58
- 238000004590 computer program Methods 0.000 claims description 15
- 238000002347 injection Methods 0.000 claims description 5
- 239000007924 injection Substances 0.000 claims description 5
- 230000005540 biological transmission Effects 0.000 description 7
- 238000012423 maintenance Methods 0.000 description 5
- 238000011161 development Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 239000000243 solution Substances 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message 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)
- Computer And Data Communications (AREA)
Abstract
The application relates to a communication method, a communication device, an electronic device and a storage medium of a plurality of sub-applications. The communication method of the multiple sub-applications comprises the following steps: acquiring registration files of a plurality of sub applications; according to the registration file, injecting interfaces in the message bus into the sub-applications corresponding to the registration file respectively; acquiring a communication rule of each sub-application in a plurality of sub-applications through an interface; and mounting the communication rule of each sub-application on the interface so that the plurality of sub-applications communicate according to the mounted communication rule in the interface. By the method and the device, the problem of poor communication quality between the sub-applications is solved, and the communication quality between the sub-applications is improved.
Description
Technical Field
The present application relates to the field of information processing, and in particular, to a communication method, apparatus, electronic apparatus, and storage medium for a plurality of sub-applications.
Background
With the rapid development of the internet, the number of users is continuously increased, and the application scale is also continuously enlarged. Maintenance and construction are also increasingly becoming an important component in application development. If a large application is developed and all functions are developed together, the maintenance cost is greatly increased. The application is inevitably required to be split into a plurality of independent sub-applications, which facilitates maintenance and iteration. However, if there is no unified communication method, it cannot be done if there is a function that needs to be completed by cooperation between two sub-applications.
In the related art, the front-end micro-service implements cross-text document, multi-window, cross-domain messaging by adopting a postMessage manner provided by a browser. However, in the research process, it is found that the method can solve the communication problem of the sub-applications, but as the application size increases, frequent calls may cause the maintainability of the project communication module to decrease, and there is also a problem of poor communication quality between the sub-applications.
At present, no effective solution is provided for the problem of poor communication quality between sub-applications in the related art.
Disclosure of Invention
The embodiment of the application provides a communication method and device for multiple sub-applications, an electronic device and a storage medium, and aims to at least solve the problem of poor communication quality between the sub-applications in the related art.
In a first aspect, an embodiment of the present application provides a communication method for multiple sub-applications, including:
acquiring registration files of a plurality of sub applications;
according to the registration file, injecting interfaces in a message bus into the sub-applications corresponding to the registration file respectively;
acquiring a communication rule of each sub-application in the plurality of sub-applications through the interface;
and mounting the communication rule of each sub-application on the interface so that the plurality of sub-applications communicate according to the mounted communication rule in the interface.
In some embodiments, obtaining the registry files for the plurality of sub-applications comprises:
dividing a front-end page into a plurality of sub-applications through a front-end micro-service;
and acquiring the registration files of the plurality of sub-applications.
In some embodiments, obtaining the registry files for the plurality of sub-applications comprises:
judging whether a registration file exists in each sub-application of the plurality of sub-applications;
and acquiring the registration files of the plurality of sub-applications under the condition that the registration files exist in each of the plurality of sub-applications.
In some of these embodiments, the method further comprises:
under the condition that the registration file does not exist in each sub-application of the plurality of sub-applications, determining that the sub-application corresponding to the registration file does not exist, and generating a registration file acquisition failure message;
and sending the failure message to a preset object.
In some embodiments, the mounting the communication rule of each sub-application on the interface comprises:
storing the communication rule of each sub application into a message queue;
and acquiring the communication rule of each sub-application from the message queue and mounting the communication rule on the interface.
In some of these embodiments, the plurality of sub-applications includes a first sub-application, a second sub-application; mounting the communication rule of each sub-application onto the interface for the plurality of sub-applications to communicate according to the mounted communication rule in the interface comprises:
acquiring a push message sent by the first sub-application;
acquiring a communication rule corresponding to the second sub-application from the interface;
and pushing the push message to the second sub-application according to the communication rule of the second sub-application mounted in the interface.
In some embodiments, obtaining the communication rule corresponding to the second sub-application from the interface includes:
judging whether a communication rule corresponding to the second sub-application is hung in the interface;
acquiring a registration file of the second sub-application under the condition that the communication rule corresponding to the second sub-application is not hung in the interface;
injecting an interface in a message bus into the second sub-application according to the registration file of the second sub-application;
acquiring a communication rule of the second sub-application through the interface;
and mounting the communication rule of the second sub-application on the interface.
In a second aspect, an embodiment of the present application further provides a communication apparatus for multiple sub-applications, including:
the first acquisition module is used for acquiring registration files of a plurality of sub-applications;
the injection module is used for respectively injecting interfaces in a message bus into the sub-applications corresponding to the registration files according to the registration files;
the second acquisition module is used for acquiring the communication rule of each sub-application in the plurality of sub-applications through the interface;
and the mounting module is used for mounting the communication rule of each sub-application on the interface, wherein the interface is used for the plurality of sub-applications to communicate according to the mounted communication rule in the interface.
In a third aspect, an embodiment of the present application provides an electronic apparatus, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the processor implements the communication method of the multiple sub-applications as described in the first aspect.
In a fourth aspect, the present application provides a storage medium, on which a computer program is stored, and when the program is executed by a processor, the program implements the communication method of the plurality of sub-applications as described in the first aspect.
Compared with the related art, the communication method, the communication device, the electronic device and the storage medium of the multiple sub-applications provided by the embodiment of the application acquire the registration files of the multiple sub-applications; according to the registration file, injecting interfaces in the message bus into the sub-applications corresponding to the registration file respectively; acquiring a communication rule of each sub-application in a plurality of sub-applications through an interface; the communication rule of each sub-application is mounted on the interface so that the plurality of sub-applications communicate according to the mounted communication rule in the interface, the problem of poor communication quality among the sub-applications is solved, and the communication quality among the sub-applications is improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a terminal of a communication method of a plurality of sub-applications according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of communication of a plurality of sub-applications according to an embodiment of the present application;
FIG. 3 is a first flowchart of a method for communicating among a plurality of sub-applications in accordance with a preferred embodiment of the present application;
FIG. 4 is a flow chart two of a method of communication for multiple sub-applications in accordance with a preferred embodiment of the present application;
fig. 5 is a block diagram of a communication apparatus of a plurality of sub-applications according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. Reference herein to "a plurality" means greater than or equal to two. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The method provided by the embodiment can be executed in a terminal, a computer or a similar operation device. Taking an example of the terminal running on the terminal, fig. 1 is a hardware configuration block diagram of the terminal of the communication method of multiple sub-applications according to the embodiment of the present application. As shown in fig. 1, the terminal 10 may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the terminal. For example, the terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used for storing computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the communication methods of the sub-applications in the embodiment of the present invention, and the processor 102 executes the computer programs stored in the memory 104 to execute various functional applications and data processing, i.e., to implement the methods described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the terminal 10. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
The present embodiment provides a communication method for multiple sub-applications, which may be applied to a bus module independent of other sub-applications, and fig. 2 is a flowchart of the communication method for multiple sub-applications according to the embodiment of the present application, and as shown in fig. 2, the flowchart includes the following steps:
in step S201, registration files of a plurality of sub applications are acquired.
In this step, the registration file may include a registration method of providing an external access interface and a registration method of operating an interface of an in-application message, and may further include a registration method supporting an incoming operation of an external message object.
In some embodiments, obtaining the registration files of the plurality of sub-applications may include:
the first method is as follows: in some of these embodiments, the front-end page may be divided into multiple sub-applications by a front-end microservice; registration files of a plurality of sub-applications are acquired.
In this embodiment, the front-end micro service is a technology of the front end in the continuous development of the network technology, and can split a large front-end application into a plurality of sub-applications. The problems that the application size is too large, the maintenance cost is too large, and the whole application needs to be reconstructed when a small part of content is changed can be solved. And the front-end micro-service can split the front-end page into a plurality of independent applications, and then assemble each sub-application as required by a preset specific method.
The second method comprises the following steps: in some embodiments, determining whether a registry file exists in each of a plurality of sub-applications; and under the condition that the registration files exist in each sub-application of the plurality of sub-applications, acquiring the registration files of the plurality of sub-applications.
In this embodiment, when it is determined that the registration file does not exist in each of the plurality of sub-applications, it may be determined that the sub-application corresponding to the registration file does not exist, and a registration file acquisition failure message may be generated; and sending a failure message to a preset object. By the method, the preset object can be timely notified, so that a user can conveniently configure the registration file for the corresponding sub-application according to the failure message, and the configuration of the registration file of the sub-application is realized.
It should be noted that the preset object is configured by a user in advance, and the preset object includes at least one of the following: mail address, instant communication account address and short message address.
Step S202, according to the registration file, injecting the interfaces in the message bus into the sub-applications corresponding to the registration file respectively.
In this step, the message bus may be a message center, and a plurality of micro-service instances may be connected to the bus, and the instances may send or receive information (by listening) to the message center. Such as: instance a sends a message to, for example, a message bus, and instance B on the message bus can receive the message (instance B subscribes to instance a), so that the message bus acts as an intermediary, facilitating decoupling of instance a and instance B.
Step S203, a communication rule of each sub-application in the plurality of sub-applications is obtained through the interface.
In this step, each sub-application may be configured with a corresponding communication rule in advance by the user, so that each sub-application performs communication according to the communication rule corresponding to the sub-application.
Step S204, the communication rule of each sub-application is mounted on the interface, so that the plurality of sub-applications communicate according to the mounted communication rule in the interface.
Through the steps S201 to S204, the communication between the sub-applications is realized by obtaining the communication rules of the sub-applications and mounting the communication rules of each sub-application on the interface, so that the sub-applications can communicate according to the communication rules mounted in the interface, and the sub-applications can communicate with each other through the message bus, which is convenient for maintenance and management, reduces confusion caused by direct communication between the sub-applications, solves the problem of poor communication quality between the sub-applications, and improves the communication quality between the sub-applications.
In some embodiments, the mounting the communication rule of each sub-application on the interface in step S204 includes: storing the communication rule of each sub-application in a message queue; and acquiring the communication rule of each sub-application from the message queue and mounting the communication rule on an interface. In this embodiment, the problem of congestion caused by too many communication rules can be avoided by storing the communication rule of each sub-application in the message queue, then obtaining the communication rule of each sub-application from the message queue, and mounting the communication rule on the interface.
In some embodiments, the plurality of sub-applications includes a first sub-application and a second sub-application, and the step S204 of mounting the communication rule of each sub-application on the interface for the plurality of sub-applications to communicate according to the mounted communication rule in the interface includes: acquiring a push message sent by a first sub-application; determining a communication rule corresponding to the second sub-application from the interface; and pushing the push message to the second sub-application according to the communication rule of the second sub-application mounted in the interface. In this way, communication between the sub-applications is achieved.
In some embodiments, based on the above embodiments, the obtaining, from the interface, the communication rule corresponding to the second sub-application includes: judging whether a communication rule corresponding to the second sub-application is hung in the interface; acquiring a registration file of the second sub-application under the condition that the communication rule corresponding to the second sub-application is not hung in the interface; injecting an interface in the message bus into the second sub-application according to the registration file of the second sub-application; acquiring a communication rule of the second sub-application through an interface; and mounting the communication rule of the second sub-application on the interface. By the method, a mode that the interface acquires the communication rule is provided, and the sub-applications can communicate conveniently according to the communication rule.
The embodiments of the present application are described and illustrated below by means of preferred embodiments.
Fig. 3 is a first flowchart of a communication method of a plurality of sub-applications according to a preferred embodiment of the present application. As shown in fig. 3, the preferred process may include:
step S301: and starting.
Step S302: and judging whether the sub-application stores the message registration file, if so, executing step S303, and if not, executing step S307.
Step S303, binding the message registration file and the sub-application name of the sub-application corresponding to the message registration file to obtain the communication rule.
Step S304, the communication rule is injected into the interface of the message bus, and the interface for accessing the message is injected into the communication rule of the sub-application.
Step S305, the sub-application accesses the message bus through the corresponding message registration file, and pushes the message to the message bus using the communication rule provided by the message bus.
Step S306, receiving the message pushing request of the sub-application through the message bus, distributing the message to the sub-application, and jumping to step S308.
In step S307, abnormality information is generated.
And step S308, ending.
Fig. 4 is a flowchart ii of a communication method of a plurality of sub-applications according to the preferred embodiment of the present application. As shown in fig. 4, the preferred process may include:
step S401: a separate message registration file is configured in the sub-application.
It should be noted that, configuring a separate message registration file, the following interfaces may be provided:
getState (): an interface for obtaining the current data state of the sub-application.
dispatch (): a distribution message interface through which a message bus passes message registration information to the sub-application.
destroy (): an interface for destroying the data state.
Step S402, judging whether the sub application provides a message registration file; if yes, step S403 is executed, and if no, step S405 is executed.
In this step, the bus module determines whether the sub-application provides a message registration file, and if so, adds the bound sub-application name to a message service (in an object), and simultaneously injects the bound sub-application name into a push () method for pushing a message in the bus module.
Step S403, add the bound sub-application name corresponding to the message registration file into the message service (in an object), and inject the bound sub-application name into the bus module to push the message, so as to obtain the communication rule.
In this step, the method for pushing the message in the bus module is injected into the sub-application during message registration, and when the sub-application needs to push the message to other sub-applications, the method can be directly called to push the message into the bus.
In step S404, the sub-application communicates according to the communication rule and jumps to step S408.
In step S405, the message registration file is re-registered.
In step S406, it is determined whether the registration of the registration message with the file is successful, if yes, step S403 is executed, and if no, step S407 is executed.
Step S407, generates message push failure information.
Step S408 ends.
Based on steps S405 to S407, after receiving the message push, the bus module may also check whether the message registration file corresponding to the pushed sub-application is already in the message service, and if not, attempt message registration and re-verify the message registration. If the message pushing fails, the message pushing is discarded, and message pushing failure information is returned. If so, pushing the message to the sub-application through a dispatch () method provided by the sub-application.
Based on the communication rule in step S404, the sub-application accepts the bus message transmission. And receiving the sub-application of the communication rule, verifying whether the communication rule is legal or not, returning failure information if the communication rule is not legal, and performing corresponding operation if the communication rule is legal.
The present embodiment further provides a communication device with multiple sub-applications, where the communication device is used to implement the foregoing embodiments and preferred embodiments, and the description of the communication device that has been already described is omitted. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of a communication apparatus for multiple sub-applications according to an embodiment of the present application, and as shown in fig. 5, the apparatus includes:
a first obtaining module 51, configured to obtain registration files of multiple sub applications;
an injection module 52, coupled to the first obtaining module 51, configured to inject, according to the registration file, the interfaces in the message bus into the sub-applications corresponding to the registration file, respectively;
a second obtaining module 53, coupled to the injecting module 52, for obtaining the communication rule of each sub-application in the plurality of sub-applications through the interface;
and a mounting module 54, coupled to the second obtaining module 53, configured to mount the communication rule of each sub-application onto an interface, where the interface is used for the plurality of sub-applications to communicate according to the mounted communication rule in the interface.
In this embodiment, the first obtaining module 51 is configured to obtain registration files of a plurality of sub applications; an injection module 52, coupled to the first obtaining module 51, configured to inject, according to the registration file, the interfaces in the message bus into the sub-applications corresponding to the registration file, respectively; a second obtaining module 53, coupled to the injecting module 52, for obtaining the communication rule of each sub-application in the plurality of sub-applications through the interface; and a mounting module 54, coupled to the second obtaining module 53, configured to mount the communication rule of each sub-application on an interface, where the interface is used for a manner in which the plurality of sub-applications communicate according to the communication rule mounted in the interface, so as to solve a problem of poor communication quality between the sub-applications, and improve communication quality between the sub-applications.
In some of these embodiments, the first obtaining module 51 includes: the dividing unit is used for dividing the front-end page into a plurality of sub-applications through the front-end micro-service; the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring registration files of a plurality of sub applications.
In some of these embodiments, the first obtaining module 51 further includes: a judging unit configured to judge whether a registration file exists in each of a plurality of sub-applications; and a second acquisition unit configured to acquire the registration files of the plurality of sub-applications when it is determined that the registration file exists in each of the plurality of sub-applications.
In some of these embodiments, the apparatus further comprises: the determining module is used for determining that the sub-application corresponding to the registration file does not exist under the condition that the registration file does not exist in each sub-application in the plurality of sub-applications, and generating a registration file acquisition failure message; and the sending module is used for sending the failure message to a preset object.
In some of these embodiments, mount module 54 includes: the storage unit is used for storing the communication rule of each sub application into the message queue; and the mounting unit is used for acquiring the communication rule of each sub-application from the message queue and mounting the communication rule on the interface.
In some of these embodiments, mount module 54 further includes: the third acquiring unit is used for acquiring the push message sent by the first sub-application; a fourth obtaining unit, configured to obtain, from the interface, a communication rule corresponding to the second sub-application; and the pushing unit is used for pushing the pushing message to the second sub-application according to the communication rule of the second sub-application mounted in the interface.
In some embodiments, the fourth obtaining unit comprises: the judging subunit is used for judging whether a communication rule corresponding to the second sub-application is hung in the interface; the first obtaining subunit is configured to obtain a registration file of the second sub-application when it is determined that the communication rule corresponding to the second sub-application is not hung in the interface; the injection subunit is used for injecting the interface in the message bus into the second sub-application according to the registration file of the second sub-application; the second acquiring subunit is used for acquiring the communication rule of the second sub-application through the interface; and the mounting subunit is used for mounting the communication rule of the second sub-application on the interface.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
The present embodiment also provides an electronic device comprising a memory having a computer program stored therein and a processor configured to execute the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s201, registration files of a plurality of sub applications are obtained.
S202, according to the registration files, the interfaces in the message bus are respectively injected into the sub-applications corresponding to the registration files.
S203, acquiring the communication rule of each sub-application in the plurality of sub-applications through the interface.
S204, the communication rule of each sub-application is mounted on the interface, so that the plurality of sub-applications communicate according to the mounted communication rule in the interface.
It should be noted that, for specific examples in this embodiment, reference may be made to examples described in the foregoing embodiments and optional implementations, and details of this embodiment are not described herein again.
In addition, in combination with the communication method of multiple sub-applications in the foregoing embodiments, the embodiments of the present application may be implemented by providing a storage medium. The storage medium having stored thereon a computer program; the computer program, when executed by a processor, implements the communication method of any one of the plurality of sub-applications in the above embodiments.
It should be understood by those skilled in the art that various features of the above-described embodiments can be combined in any combination, and for the sake of brevity, all possible combinations of features in the above-described embodiments are not described in detail, but rather, all combinations of features which are not inconsistent with each other should be construed as being within the scope of the present disclosure.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A method for communicating among a plurality of sub-applications, comprising:
acquiring registration files of a plurality of sub applications;
according to the registration file, injecting interfaces in a message bus into the sub-applications corresponding to the registration file respectively;
acquiring a communication rule of each sub-application in the plurality of sub-applications through the interface;
and mounting the communication rule of each sub-application on the interface so that the plurality of sub-applications communicate according to the mounted communication rule in the interface.
2. The method according to claim 1, wherein obtaining the registration files of the plurality of sub-applications comprises:
dividing a front-end page into a plurality of sub-applications through a front-end micro-service;
and acquiring the registration files of the plurality of sub-applications.
3. The method according to claim 1, wherein obtaining the registration files of the plurality of sub-applications comprises:
judging whether a registration file exists in each sub-application of the plurality of sub-applications;
and acquiring the registration files of the plurality of sub-applications under the condition that the registration files exist in each of the plurality of sub-applications.
4. The method of communicating among a plurality of sub-applications of claim 3, the method further comprising:
under the condition that the registration file does not exist in each sub-application of the plurality of sub-applications, determining that the sub-application corresponding to the registration file does not exist, and generating a registration file acquisition failure message;
and sending the failure message to a preset object.
5. The method according to claim 1, wherein the mounting the communication rule of each sub-application on the interface comprises:
storing the communication rule of each sub application into a message queue;
and acquiring the communication rule of each sub-application from the message queue and mounting the communication rule on the interface.
6. The communication method according to claim 1, wherein the plurality of sub-applications include a first sub-application, a second sub-application; mounting the communication rule of each sub-application onto the interface for the plurality of sub-applications to communicate according to the mounted communication rule in the interface comprises:
acquiring a push message sent by the first sub-application;
determining a communication rule corresponding to the second sub-application from the interface;
and pushing the push message to the second sub-application according to the communication rule of the second sub-application mounted in the interface.
7. The method according to claim 6, wherein the obtaining of the communication rule corresponding to the second sub-application from the interface comprises:
judging whether a communication rule corresponding to the second sub-application is hung in the interface;
acquiring a registration file of the second sub-application under the condition that the communication rule corresponding to the second sub-application is not hung in the interface;
injecting an interface in a message bus into the second sub-application according to the registration file of the second sub-application;
acquiring a communication rule of the second sub-application through the interface;
and mounting the communication rule of the second sub-application on the interface.
8. A communication apparatus for a plurality of sub-applications, comprising:
the first acquisition module is used for acquiring registration files of a plurality of sub-applications;
the injection module is used for respectively injecting interfaces in a message bus into the sub-applications corresponding to the registration files according to the registration files;
the second acquisition module is used for acquiring the communication rule of each sub-application in the plurality of sub-applications through the interface;
and the mounting module is used for mounting the communication rule of each sub-application on the interface, wherein the interface is used for the plurality of sub-applications to communicate according to the mounted communication rule in the interface.
9. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and the processor is configured to execute the computer program to perform the communication method of the plurality of sub-applications according to any one of claims 1 to 7.
10. A storage medium having stored thereon a computer program, wherein the computer program is arranged to execute a method of communication of a plurality of sub-applications according to any one of claims 1 to 7 when executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010884743.5A CN112148501A (en) | 2020-08-28 | 2020-08-28 | Communication method and device for multiple sub-applications, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010884743.5A CN112148501A (en) | 2020-08-28 | 2020-08-28 | Communication method and device for multiple sub-applications, electronic device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112148501A true CN112148501A (en) | 2020-12-29 |
Family
ID=73890025
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010884743.5A Withdrawn CN112148501A (en) | 2020-08-28 | 2020-08-28 | Communication method and device for multiple sub-applications, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112148501A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115580642A (en) * | 2022-09-21 | 2023-01-06 | 北京智能建筑科技有限公司 | Communication method and device between applications, nonvolatile storage medium and processor |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101836186A (en) * | 2007-10-20 | 2010-09-15 | 思杰系统有限公司 | A method and system for communicating between isolation environments |
CN104834541A (en) * | 2015-03-30 | 2015-08-12 | 百度在线网络技术(北京)有限公司 | Function module mounting method, mounting system and mounting system updating method |
CN104869452A (en) * | 2014-02-26 | 2015-08-26 | Lg电子株式会社 | Digital Device And Method Of Processing Screensaver Thereof |
US20190220304A1 (en) * | 2016-11-25 | 2019-07-18 | Tencent Technology (Shenzhen) Company Limited | Method and device for processing application program page, and storage medium |
-
2020
- 2020-08-28 CN CN202010884743.5A patent/CN112148501A/en not_active Withdrawn
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101836186A (en) * | 2007-10-20 | 2010-09-15 | 思杰系统有限公司 | A method and system for communicating between isolation environments |
CN104869452A (en) * | 2014-02-26 | 2015-08-26 | Lg电子株式会社 | Digital Device And Method Of Processing Screensaver Thereof |
CN104834541A (en) * | 2015-03-30 | 2015-08-12 | 百度在线网络技术(北京)有限公司 | Function module mounting method, mounting system and mounting system updating method |
US20190220304A1 (en) * | 2016-11-25 | 2019-07-18 | Tencent Technology (Shenzhen) Company Limited | Method and device for processing application program page, and storage medium |
Non-Patent Citations (1)
Title |
---|
KUITOS: "《可能是你见过最完善的微前端解决方案》", HTTP://ZHUANLAN.ZHIHU.COM/78362028?UTM_PSN=1707815978929459200, pages 1 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115580642A (en) * | 2022-09-21 | 2023-01-06 | 北京智能建筑科技有限公司 | Communication method and device between applications, nonvolatile storage medium and processor |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106850402B (en) | Message transmission method and device | |
CN110493184B (en) | Method and device for processing login page in client and electronic device | |
CN112565439B (en) | Internet of things communication method and system | |
CN111885594A (en) | Equipment binding method and device | |
CN111885115A (en) | Equipment binding change method and device | |
CN112187903B (en) | Message pushing method and device and message service system | |
CN111294235A (en) | Data processing method, device, gateway and readable storage medium | |
JP2023530608A (en) | Network slice switching method, terminal, storage medium, and electronic device | |
US20010010061A1 (en) | Communication system, communication method, gateway apparatus, and client | |
CN107368334B (en) | Business plug-in interaction system and method | |
CN111741512A (en) | Private network access method and device | |
US9154973B1 (en) | Testing mobile phone maintenance channel | |
CN103023684A (en) | Method, device and system for network information management | |
CN112148501A (en) | Communication method and device for multiple sub-applications, electronic device and storage medium | |
CN112637221B (en) | Equipment control method and device | |
CN101753561B (en) | Business cluster processing method and cluster system | |
CN102891900B (en) | A kind of method, apparatus and system of the domain name mapping in flow unloading | |
CN110545453B (en) | Content distribution method, device and system of content distribution network | |
CN111262779A (en) | Method, device, server and system for acquiring data in instant messaging | |
CN114697888B (en) | 5G message processing method, device and storage medium | |
CN108279855A (en) | A method of read-write storage device | |
CN103795748A (en) | Method for downloading mobile internet website content information | |
CN114615272A (en) | Media data forwarding server scheduling method and system | |
CN102572802B (en) | Method and system for accessing large-capacity SIM (subscriber identity module) card by network node | |
CN107846300B (en) | Method and device for providing service interface |
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 | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20201229 |