Component calling method, device, storage medium and electronic device
By using preset communication components for component calls in software design, the problem of binary file generation and interface conflicts caused by unfinished low-level component interfaces is solved, independent development and flexible combination of components are realized, and development efficiency and calling efficiency are improved. .
Patent Information
- Application Number
- CN202410667980.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-05-28
AI Technical Summary
During the software design process, the interfaces of low-level components were not completed, resulting in the inability of high-level components to generate binary files or run debugging, and a large number of interface header files led to slow compilation or errors. Unloading modules could not be dynamically deactivated, and there were binary dependencies and conflicts.
Get the component call request through the preset communication component, parse and deliver the message, isolate the calling component and the called component, use the message passing type to make the interface call, omit the API calling interface, configure the message structure interface in the configuration file, and realize the communication between components Independent development and flexible combination.
The input and output interfaces between component calls are clear. Independent development can be compiled and linked without staking, which reduces conflicts and dependency issues and improves the flexibility and efficiency of component calls.
Smart Images

Figure CN118245253B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and more specifically, to a component calling method, device, storage medium and electronic device. Background Art
[0002] In the software design process, the software needs to be divided into modules (or components) according to certain principles. Each module (or component) has relatively independent business functions and must meet the characteristics of high cohesion and low coupling. Conventional module (or component) design usually adopts static library or dynamic library to interact through interfaces.
[0003] Take C++ language as an example. Figure 1 As shown, the low-level components (low-level component 1, low-level component 2, low-level component 3) provide interface header files and library files (lib, dll, so) to the high-level components (high-level component 1, high-level component 2). The high-level components include header files that reference the low-level components in the project, and link the corresponding low-level component library files to generate corresponding binary files.
[0004] However, this solution has at least the following problems due to binary dependencies between interfaces:
[0005] 1. During the development process, if the interface of the low-level component is not fully developed, the high-level component can only stub each interface, otherwise the binary file cannot be generated or the debugging cannot be run.
[0006] 2. When there are too many dependent low-level components, a large number of low-level component interface header files need to be included. There may be conflicts or circular dependencies between these header files, which will cause the software compilation to slow down or cause inexplicable errors.
[0007] 3. When troubleshooting or trimming functions, some modules cannot be disabled or uninstalled dynamically (recompilation is required).
[0008] Based on this, it is necessary to optimize the link calling technology between components in the software development and design process. Summary of the invention
[0009] In view of this, it is necessary to provide a new component calling method, device, storage medium and electronic device to solve at least one of the above technical problems.
[0010] In a first aspect of the present application, a component calling method is provided, the method comprising:
[0011] Obtaining a call request of the first component through a preset communication component, wherein the call request includes a message to be transmitted and a message transmission type;
[0012] Parsing the call request to determine a second component that receives the message to be transmitted;
[0013] Sending the message to be delivered to the second component according to the message delivery type;
[0014] Obtain a feedback message from the second component, and send the feedback message to the first component.
[0015] In one of the embodiments, the parsing of the calling request to determine the second component that receives the message to be delivered includes: detecting whether the calling request contains a called component, and if so, using the called component as the second component; otherwise, querying a preset internal message forwarding table for a component that supports subscribing to the message to be delivered, and using the queried component as the second component.
[0016] In one of the embodiments, when no component supporting subscription to the message to be delivered is found from the internal message forwarding table, feedback is given to the first component that there is no second component responding to the call request.
[0017] In one of the embodiments, determining the second component that receives the message to be delivered includes: determining any component that responds to the message to be delivered as the second component.
[0018] In one of the embodiments, sending the message to be delivered to the second component according to the message delivery type includes: broadcasting the message to be delivered so that a component that receives and subscribes to the message to be delivered actively obtains the message to be delivered.
[0019] In one of the embodiments, the method further includes: configuring the process and message subscription type for each component, and generating or updating the internal message forwarding table.
[0020] In one of the embodiments, the method further comprises: recording the subscription execution result of each second component on the message to be delivered;
[0021] When the subscription execution result indicates an execution exception, the second component indicating the execution exception is checked and analyzed.
[0022] In one of the embodiments, the troubleshooting and analysis of the second component indicating the execution abnormality includes: reproducing a call request corresponding to the second component indicating the execution abnormality, causing a third component in the same process as the second component indicating the execution abnormality that responds to the call request to be in an uninstalled state, causing the second component indicating the execution abnormality to respond to the reproduced call request when the third component is in the uninstalled state, obtaining a response result, and analyzing whether the second component indicating the execution abnormality is normal based on the response result.
[0023] In a second aspect of the present application, a component calling device is provided, the device comprising:
[0024] A call request acquisition module, used to acquire a call request of the first component through a preset communication component, wherein the call request includes a message to be transmitted and a message transmission type;
[0025] A message delivery module, configured to parse the call request, determine a second component to receive the message to be delivered, and send the message to be delivered to the second component according to the message delivery type;
[0026] A feedback message acquisition module is used to obtain a feedback message from the second component and send the feedback message to the first component.
[0027] In a third aspect of the present application, an electronic device is provided, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the component calling method described in any one of the embodiments of the present application.
[0028] In a fourth aspect of the present application, a computer storage medium is provided, wherein the storage medium stores executable instructions, and when the instructions are executed by a processor, the processor executes the component calling method described in any embodiment of the present application.
[0029] The component calling method in this application sets up a communication component, and the communication component transmits the message of the calling request, isolates the calling component and the called component, decouples the calling component and the called component, and makes them "invisible" to each other, or even completely non-existent. In this way, the input and output interfaces between component calls can be made clear, and there is no need to set the API calling interface. By configuring the corresponding message structure interface in the configuration file, the setting of the API calling interface can be omitted. In the development stage, the component development work is very independent, and compiles and links to generate binary files without piling. In addition, the components can be flexibly combined according to business needs to achieve more flexible calls between components. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope of the present application.
[0031] Figure 1 A logic diagram for invoking a conventional component in one embodiment;
[0032] Figure 2A schematic diagram of a flow chart of a component calling method in one embodiment;
[0033] Figure 3A A schematic diagram of component call logic in one embodiment of the present application;
[0034] Figure 3B A logic diagram for calling components in another embodiment of the present application;
[0035] Figure 4 It is a structural block diagram of a component calling device in one embodiment;
[0036] Figure 5 It is a structural block diagram of a component calling device in another embodiment. DETAILED DESCRIPTION
[0037] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present application. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present application.
[0038] The terms used herein are only for describing specific embodiments and are not intended to limit the present application. The words "a", "an (kind)" and "the" used herein should also include the meanings of "multiple" and "multiple", unless the context clearly indicates otherwise. In addition, the terms "including", "comprising" and the like used herein indicate the existence of corresponding features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0039] In addition, although the terms "first", "second", "third", etc. are used many times herein to describe various elements (or various processes or various applications or various instructions or various operations), etc., these elements (or processes or applications or instructions or operations) should not be limited by these terms. These terms are only used to distinguish one element (or process or application or instruction or operation) from another element (or process or application or instruction or operation). For example, a first component may be referred to as a second component, and a second component may be referred to as a first component without departing from the scope of the present invention, and the first component and the second component are not the same component.
[0040] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0041] In one embodiment, in combination Figure 2 As shown, a component calling method is provided, the method comprising:
[0042] Step 202: Obtain a call request of the first component through a preset communication component, wherein the call request includes a message transmission type and a message to be transmitted.
[0043] In this embodiment, a component (or module) refers to a set of related functions, features or services that are organized into a reusable, replaceable or manageable unit. In software development, a component (or module) generally refers to an independent, reusable software module that has specific functions and interfaces, and a larger software system can be built by combining these components. Components can be software objects, classes, libraries, modules or other units that provide services by defining input and output interfaces and implementing specific functions. The first component and the second component in this application refer to components in the same software application.
[0044] The first component represents the component that initiates the call, the second component represents the component that is called, and the communication component is a common component used to transmit call information between the first component and the second component. In this application, by pre-setting the communication component, other components can communicate with the communication component, and pass the message to be transmitted to the recipient through the communication component, so that the first component and the second component do not need to use binary dependencies to perform interface calls, and do not need API call interfaces.
[0045] Among them, when the user is developing and testing software, he needs to use the first component in the software to call the second component, and use the second component to implement or test the relevant functions in the software. After obtaining the relevant instructions, the first component can trigger the corresponding call request, and the communication component can receive the call request. The relevant functions that can be implemented or the subscription messages that are concerned by different components can be the same or different, and the functions or subscription messages that can be implemented can include one or more.
[0046] Optionally, there are many ways to implement the communication component, which can be any message-based RPC, such as socket (including Uinux Domain), shared memory, pipe, etc.
[0047] The call request indicates a request or instruction to call other components to implement related functions or to make other components subscribe to related messages. The call request contains any one or more of a request identifier for uniquely identifying the request, a first component identifier that uniquely identifies the identity of the first component, a message transmission type, and a message to be transmitted. Other components in the software can subscribe to the message to be transmitted and implement related software function design or testing based on the message to be transmitted.
[0048] The message delivery type indicates the information delivery method used to transmit the message to be delivered, wherein the delivery method may include specifying a call object (i.e., specifying a recipient) and not specifying a call object. Specifically, specifying a call object indicates a message delivery method that specifies the second component, and not specifying a call object indicates a message delivery method that does not specify the second component.
[0049] Furthermore, the designated call object can be further set to whether it is limited to the designated object or not limited to the designated object, wherein when it is limited to the designated object, it means that the call request is only passed to the designated object; if it is not limited to the designated object, it means that in addition to passing the call request to the designated object, it can also be passed to other components suitable for processing the message. The number of designated objects in the call request can include one or more.
[0050] After the first component initiates the call request, the communication component can receive the call request and obtain the information in the call request.
[0051] Step 204: parse the call request to determine a second component that receives the message to be delivered.
[0052] In this embodiment, after the communication component obtains the call request, it performs a security check on the call request, such as resolving the identity of the corresponding first component, determining whether the first component has the authority to initiate the call request, and also resolving the type of message transmission required for the call request, and determining the recipient of the message to be transmitted (i.e., the second component or the called component).
[0053] Optionally, the communication component can detect whether the call request also contains a called component. If it does, it means that the message transmission type uses a specified call object. If it does not, it means that an unspecified call object is used. For a specified call object, the communication component can directly use the specified called component as the second component. For an unspecified call object, the corresponding relationship between each component and the message to be transmitted can be determined by querying the corresponding relationship between each component and the message to be transmitted, and the component that has an associated relationship with the message to be transmitted can be determined as the second component.
[0054] Furthermore, for the case where a specified calling object is limited, if it is further limited to the specified calling object, the communication component only determines the specified calling object as the second component; if it is further not limited to the specified object, then in addition to determining the specified calling object as the second component, the communication component can also query whether there are other components corresponding to the message to be transmitted, and use the corresponding one or more other components found out as the second component.
[0055] Specifically, a component that supports subscription to the message to be delivered is queried from a preset internal message forwarding table, and the queried component is used as the second component.
[0056] An internal message forwarding table is pre-configured in the electronic device. The internal message forwarding table configures a subscription relationship between each component and a message type. The subscription relationship indicates a component that can receive a corresponding message.
[0057] The process and message subscription type can be configured for each component in advance, and an internal message forwarding table can be generated or updated. In addition to the subscription relationship between the component and the message, the internal message forwarding table also configures the component type and the process corresponding to the component.
[0058] For example, there are four components, namely component 1, component 2, component 3, and component 4, which belong to different types of components, and component 1 and component 2 belong to process 1; component 3 and component 4 belong to process 2. The configuration information of each component is as follows:
[0059] Component 1: Type is 1, the corresponding implementation library is libService-A.so, and it does not subscribe to any messages;
[0060] Component 2: Type is 2, the corresponding implementation library is libService-B.so, and it subscribes to messages 1, 2, and 3;
[0061] Component 3: Type is 3, the corresponding implementation library is libService-C.so, and it subscribes to messages 2 and 4;
[0062] Component 4: The type is 4, the corresponding implementation library is libService-D.so, and it subscribes to messages 2, 3, and 5.
[0063] The corresponding process-component configuration information implementation code is as follows:
[0064] {
[0065] "Process":[
[0066] {
[0067] "Name":"PROC-1",
[0068] "Type":2,
[0069] "Module":[
[0070] {
[0071] "Type":1,
[0072] "Library":". / libService-A.so",
[0073] "Subscribe":[]
[0074] },
[0075] {
[0076] "Type":2,
[0077] "LibFile":". / libService-B.so",
[0078] "Subscribe":[
[0079] "MSG-1",
[0080] "MSG-2",
[0081] "MSG-3" ]
[0083] } ]
[0085] },
[0086] {
[0087] "Name":"PROC-2",
[0088] "Type":4,
[0089] "Module":[
[0090] {
[0091] "Type":3,
[0092] "Library":". / libService-C.so",
[0093] "Subscribe":[
[0094] "MSG-2",
[0095] "MSG-4" ]
[0097] },
[0098] {
[0099] "Type":4,
[0100] "Library":". / libService-D.so",
[0101] "Subscribe":"MSG-2",
[0102] "MSG-3",
[0103] "MSG-5" ]
[0105] } ]
[0107] } ]
[0109] }
[0110] Similarly, the number of specified call objects (i.e., the second number) may be further limited in the call request, and the number may be a specific number, such as 1, 2, 3, etc., or a range of numbers, such as no more than 3, or at least 3, etc. In the case where the number of call objects is specified, the communication component may detect whether the call objects specified in the call request meet the number requirement. If not, all components with corresponding relationships may be queried from the internal message forwarding table, and components that meet the number requirement may be selected from the components as the second component.
[0111] When the number of components that meet the requirement exceeds the number required in the call request, the best component can be selected as the second component according to the corresponding rules. The best component can be the component that can respond to the call request the fastest according to the preset sorting rules or priority.
[0112] Optionally, it is also possible to query the components that are called the most times by the first component among all eligible components, and select the components that meet the quantity requirements as the second component in combination with the sorting rule and / or priority rule. For example, in addition to a specified component, the first component also needs 3 components to respond to the call request. The communication component also queries 10 components (excluding the specified component) from the internal message forwarding table that can respond to the call request. The communication component can then randomly select 3 corresponding components as the second components, or it can select the best 3 components as the second components in combination with one or more factors such as the task processing efficiency, queue waiting time, and the number of times / frequency called by the first component within a preset time period among the 10 components.
[0113] Step 206: Send the message to be delivered to the second component according to the message delivery type.
[0114] In this embodiment, the communication component can send the message to be transmitted to the second component according to the message transmission type. Specifically, after completing the verification of the first component and the call request, the call request is sorted and sent to the second component according to the sorting order.
[0115] There may be multiple components in the system processing tasks at the same time, so sorting may be required. The communication component can sort the call requests according to the priority of the call requests, preset sorting rules and / or the actual call situation in the current system or application, and send them to the second component according to the rules.
[0116] The second component can obtain the call request, and then process the message in the call request to complete the test of the corresponding software or application.
[0117] For example, if Figure 3A As shown, the first component is component 1, and the message to be transmitted in the call request sent by it is message A. The message transmission type is a one-to-one asynchronous call mode, that is, the receiver is specified to be only component 2, and component 2 can subscribe to message A. After receiving the call request, the communication component can directly use the specified receiver as the second component, that is, component 2 as the second component, and forward the call request to component 2. Or before forwarding, it further searches the internal message forwarding table to see whether there is component 2 in the components matching message A. If so, component 2 is used as the second component and the call request is forwarded to component 2.
[0118] For example, Figure 3B As shown, the first component is component 1, and the message to be transmitted in the call request sent by it is message MSG-2. The message transmission type is a one-to-many asynchronous call mode, that is, the recipient is not specified (nor the number of recipients is set), and the call request sent by it is a broadcast mode. After receiving the call request, the communication component searches for all components that match the message MSG-2 in the internal message forwarding table, and uses all matched components as the second component. For example, the matched components include component 2, component 3, and component 4, and the call request is directed to component 2, component 3, and component 4. Alternatively, after receiving the call request, the communication component can also directly broadcast the call request to all components, and other components actively obtain the call request and judge whether it matches the message they subscribe to. For example, component 2, component 3, and component 4 can all actively receive the call request broadcast and forwarded by the communication component, obtain the message therein, and identify whether the message belongs to the message corresponding to itself. If it does, it can respond, and if it does not, it will be discarded.
[0119] Step 208: Obtain a feedback message from the second component, and send the feedback message to the first component.
[0120] In this embodiment, after receiving the call request, the second component can also respond to the first component and generate a feedback message, which can indicate first feedback on whether the call request is successfully received, and / or second feedback on the processing result of the message requested to be processed in the call request. The feedback message may include a first feedback result of successful or unsuccessful reception, and / or a second feedback result of successful or unsuccessful message processing.
[0121] Similar to the call request, the feedback message generated by the second component can also be sent to the communication component first, and then the communication component sends the feedback message to the first component. The feedback message can carry the request identifier of the corresponding call request and the component identifier of the second component, so that the first component can know which component is providing feedback on which call request.
[0122] The component calling method in this application sets up a communication component, and the communication component transmits the message of the calling request, isolates the calling component and the called component, decouples the calling component and the called component, and makes them "invisible" to each other, or even completely non-existent. In this way, the input and output interfaces between component calls can be made clear, and there is no need to set the API calling interface. By configuring the corresponding message structure interface in the configuration file, the setting of the API calling interface can be omitted. In the development stage, the component development work is very independent, and compiles and links to generate binary files without piling. In addition, the components can be flexibly combined according to business needs to achieve more flexible calls between components.
[0123] In one embodiment, when querying the internal message forwarding table for a component that supports subscribing to a message to be delivered, if no component that supports subscribing to the message to be delivered is found, it is determined that there is no corresponding second component, and the call request can be directly discarded, and / or feedback is given to the first component that there is no second component that responds to the call request.
[0124] Among them, when no component matching or corresponding to the message to be delivered is found, it means that there is no component that has subscribed to the message to be delivered. At this time, the call request can be directly discarded, which means that the call request will no longer be broadcast to other components or conveyed independently, thereby reducing the occupancy of message transmission resources.
[0125] In one embodiment, determining the second component that receives the message to be delivered includes: determining any component that responds to the message to be delivered as the second component. Step 206 includes: broadcasting the message to be delivered so that the component that receives and subscribes to the message to be delivered actively obtains the message to be delivered.
[0126] In this embodiment, the communication component can also broadcast the call request directly without any second component identification, and regard all components that can receive the broadcasted call request as potential second components. When one or more components respond to and execute the call request, the corresponding component will actively send a feedback message to the communication component to receive the call request, and the communication component can regard the component that sent the feedback message as the second component. By actively responding to determine the second component by other components, the complexity of the communication component can be reduced, so that the communication component does not need to perform too much second component screening and confirmation work, and the execution efficiency of the call request can be improved.
[0127] In one embodiment, the above method further includes: recording the subscription execution result of each second component for the message to be delivered; when the subscription execution result indicates an execution exception, troubleshooting and analyzing the second component indicating the execution exception.
[0128] In this embodiment, after obtaining the feedback message of each second component, the communication component obtains the result of whether the subscription execution result of each second component is normal, and saves the result data. In addition to recording the subscription execution result, the execution time and execution environment information of the message are also recorded at the same time. This is convenient for troubleshooting and analyzing abnormal subsequent execution results.
[0129] Specifically, the call request corresponding to the second component with the execution exception is reproduced, so that the third component in the same process as the second component with the execution exception that responds to the call request is in an uninstalled state, so that the second component with the execution exception responds to the reproduced call request when the third component is in the uninstalled state, and a response result is obtained, and whether the second component with the execution exception is normal is analyzed according to the response result.
[0130] Among them, the call request corresponding to the execution result in the execution exception can be obtained, and the call request can be redirected and sent to the corresponding second component through the communication component, so that the second component with the execution exception re-subscribes to the message in the call request, and processes the message to obtain a response result. At this time, before the second component responds to the call request, the third component in the same process as the second component can be dynamically uninstalled to avoid the third component causing response interference to the second component. The response result is obtained by executing the second component when the third component is in an uninstalled state, and the cause of the execution exception can be analyzed based on the response result. For example, the execution exception is caused by the conflict caused by one or more third components in the same process when processing tasks at the same time. For example, when multiple third components are also executing tasks at the same time, the resources allocated to the second component are insufficient, resulting in an execution exception.
[0131] Specifically, multiple third components in the same process as the second component can be dynamically uninstalled in sequence by permutation and combination, so that the dynamically uninstalled third components cannot cause any interference to the second component, and then the second component responds to the recurring call request, subscribes to the message, outputs the response result, and extracts whether the result of the response is normal. The specific cause of the execution exception is determined based on the response result corresponding to each dynamic uninstallation of the third component.
[0132] For example, the third component in the same process as the second component includes three components, namely, component A, component B, and component C. According to the dynamic uninstallation methods of permutations and combinations, there may be seven dynamic uninstallation methods, namely, uninstalling only component A, uninstalling only component B, uninstalling only component C, uninstalling only component A and component B, uninstalling only component A and component C, uninstalling only component B and component C, and uninstalling all components A, component B, and component C. In each partial or partial uninstallation method, the call request is repeated once or multiple times, so that the second component obtains response results under multiple different uninstallation states.
[0133] For example, when component A is in an uninstalled state, the response result of the second component indicates that it is in a normal state, and in any other case where component A is not in an uninstalled state, the response result of the second component is in an abnormal state. It can be concluded that the reason for the abnormal execution of the second component is that it is interfered with by component A.
[0134] In the above method, since a communication component is used to transmit subscription messages, there is no need for binary dependency between the first component and the second component. Therefore, during the troubleshooting process, the third component can be easily uninstalled dynamically to perform troubleshooting and analysis, thereby reducing the difficulty of troubleshooting and analysis and improving the efficiency of troubleshooting and analysis.
[0135] In one embodiment, Figure 4 As shown, a component calling device is provided, the device comprising:
[0136] A call request acquisition module 402, configured to acquire a call request of the first component through a preset communication component, wherein the call request includes a message to be transmitted and a message transmission type;
[0137] The message delivery module 404 is used to parse the call request, determine the second component that receives the message to be delivered, and send the message to be delivered to the second component according to the message delivery type;
[0138] The feedback message acquisition module 406 is used to acquire the feedback message of the second component and send the feedback message to the first component.
[0139] In one embodiment, the message delivery module 404 is also used to detect whether the calling request contains a called component. If so, the called component is used as the second component; otherwise, the component that supports subscribing to the message to be delivered is queried from the preset internal message forwarding table, and the queried component is used as the second component.
[0140] In one embodiment, the feedback message acquisition module 406 is further configured to feedback to the first component that there is no second component that responds to the call request when no component that supports subscribing to the message to be delivered is found from the internal message forwarding table.
[0141] In one embodiment, the message delivery module 404 is further configured to determine any component that responds to the message to be delivered as the second component.
[0142] In one embodiment, the message delivery module 404 is further configured to broadcast the message to be delivered, so that a component that receives and subscribes to the message to be delivered actively obtains the message to be delivered.
[0143] In one embodiment, Figure 5 As shown, another component calling device is provided, the device also includes an internal message forwarding table generating module 401, which is used to perform process and message subscription type configuration for each component, and generate or update the internal message forwarding table.
[0144] In one embodiment, the device further includes a troubleshooting and analysis module 408, which is used to record the subscription execution result of each second component on the message to be transmitted; when the subscription execution result indicates an execution exception, the second component indicating the execution exception is checked and analyzed.
[0145] In one embodiment, the troubleshooting and analysis module 408 is also used to reproduce the call request corresponding to the second component with the execution exception, so that the third component in the same process as the second component with the execution exception that responds to the call request is in an uninstalled state, and the second component with the execution exception responds to the reproduced call request when the third component is in the uninstalled state, to obtain a response result, and analyze whether the second component with the execution exception is normal based on the response result.
[0146] In one embodiment, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the component calling method in any of the above embodiments. Specifically, the electronic device may be a terminal such as a mobile phone or a tablet computer, or may be a server.
[0147] In one embodiment, a computer storage medium is provided, on which computer executable instructions are stored. When the instructions are executed by a processor, the processor executes the steps of the component calling method in any of the above embodiments.
[0148] Although example embodiments have been described, it will be apparent to those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the inventive concept. Therefore, it should be understood that the above example embodiments are not restrictive, but illustrative.
Claims
1. A component calling method, characterized in that: The method comprises: Obtaining a call request of the first component through a preset communication component, wherein the call request includes a message to be transmitted and a message transmission type; Parsing the call request to determine a second component that receives the message to be transmitted; Sending the message to be delivered to the second component according to the message delivery type; Obtain a feedback message from the second component, and send the feedback message to the first component; Recording the subscription execution result of each second component on the message to be delivered; When the subscription execution result indicates an execution exception, the call request corresponding to the second component with the execution exception is reproduced, and multiple third components are dynamically uninstalled in sequence in an arrangement and combination manner, so that the second component with the execution exception responds to the reproduced call request, and the response results of the second component when the multiple third components are in different uninstall states are obtained. According to each response result, it is analyzed whether the second component with the execution exception is normal. When the response result of one of the third components A in the uninstall state indicates normal, and the response result of any situation in which the third component A is not in the uninstall state indicates abnormality, it is determined that the cause of the execution exception of the second component is interference with the third component A, and the multiple third components include the third component A, and the multiple third components are components in the same process as the second component with the execution exception that responds to the call request.
2. The component calling method according to claim 1, characterized in that: The parsing of the call request to determine a second component that receives the message to be transmitted includes: Detect whether the calling request contains a called component. If so, use the called component as the second component; otherwise, query the component that supports subscribing to the message to be delivered from the preset internal message forwarding table, and use the queried component as the second component.
3. The component calling method according to claim 2, characterized in that: When no component supporting subscription to the message to be delivered is found in the internal message forwarding table, feedback is given to the first component that there is no second component responding to the call request.
4. The component calling method according to claim 1, characterized in that: The determining of the second component that receives the message to be delivered includes: determining any component that responds to the message to be delivered as the second component; and / or The sending the message to be delivered to the second component according to the message delivery type includes: The message to be delivered is broadcasted, so that a component that receives and subscribes to the message to be delivered actively obtains the message to be delivered.
5. The component calling method according to claim 2, characterized in that: The method further comprises: The process and message subscription type are configured for each component, and the internal message forwarding table is generated or updated.
6. A component calling device, characterized in that: The device comprises: A call request acquisition module, used to acquire a call request of the first component through a preset communication component, wherein the call request includes a message to be transmitted and a message transmission type; A message delivery module, configured to parse the call request, determine a second component to receive the message to be delivered, and send the message to be delivered to the second component according to the message delivery type; A feedback message acquisition module, used to acquire a feedback message of the second component and send the feedback message to the first component; A troubleshooting and analysis module is used to record the subscription execution results of each second component for the message to be transmitted; when the subscription execution result indicates an execution exception, the call request corresponding to the second component with the execution exception is reproduced, and multiple third components are dynamically uninstalled in sequence in a permutation and combination manner, so that the second component with the execution exception responds to the reproduced call request, and the response results of the second component when the multiple third components are in different uninstall states are obtained, and whether the second component with the execution exception is normal is analyzed according to each response result. When the response result of one of the third components A in the uninstall state indicates normal, and the response result of any situation in which the third component A is not in the uninstall state indicates abnormality, it is determined that the cause of the execution exception of the second component is interference by the third component A, and the multiple third components include the third component A, and the multiple third components are components in the same process as the second component with the execution exception that responds to the call request.
7. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors execute a component calling method as described in any one of claims 1 to 5.
8. A computer storage medium, characterized in that: The storage medium stores executable instructions, and when the instructions are executed by the processor, the processor executes a component calling method as described in any one of claims 1 to 5.
