CN109981546B - Method and device for acquiring remote call relation between application modules - Google Patents

Method and device for acquiring remote call relation between application modules Download PDF

Info

Publication number
CN109981546B
CN109981546B CN201711462204.7A CN201711462204A CN109981546B CN 109981546 B CN109981546 B CN 109981546B CN 201711462204 A CN201711462204 A CN 201711462204A CN 109981546 B CN109981546 B CN 109981546B
Authority
CN
China
Prior art keywords
rpc
application module
application
interface
interfaces
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711462204.7A
Other languages
Chinese (zh)
Other versions
CN109981546A (en
Inventor
董旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201711462204.7A priority Critical patent/CN109981546B/en
Publication of CN109981546A publication Critical patent/CN109981546A/en
Application granted granted Critical
Publication of CN109981546B publication Critical patent/CN109981546B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Abstract

The invention discloses a method and a device for acquiring a remote calling relationship between application modules, and relates to the technical field of computers. One embodiment of the method comprises: for each application module, acquiring a source code of the application module; acquiring original calling data of the application module according to the source code of the application module; and acquiring the remote calling relation between the application modules according to the original calling data of each application module. The implementation mode overcomes the technical problem that the remote call relation between the application modules accessed to the RPC frame of the same type can only be obtained by adopting the registration center framework, and further achieves the technical effect of the remote call relation between the application modules of the cross-frame.

Description

Method and device for acquiring remote call relation between application modules
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for acquiring a remote calling relationship between application modules.
Background
The service management, namely, the comprehensive management of numerous remote calls in a complex system is always a difficult problem of a large-scale technical internet company, and the service management is required to be realized and the mutual call relation among system modules is acquired.
For a Remote Procedure Call (RPC) framework, a registry architecture is adopted in the prior art, that is, a service provider registers a service in the registry, and a service caller queries the service in the registry and then connects the provider to perform Remote Call. The service provider and the caller have own identity in the registry, so that the remote calling relationship between the modules can be directly inquired in the registry.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
1. only the remote call relations among the modules accessed to the RPC frames of the same type can be obtained, and different frames cannot share the call relations.
2. On the premise of not modifying the existing Thrift, WebService and RESTful interfaces, the remote calling relation can not be obtained.
3. The method has code intrusiveness, and the application module needs to integrate the related dependency packages of all the frames, add related configuration files, write corresponding start codes and write interfaces conforming to the related specifications of all the frames.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for obtaining a remote call relationship between application modules, and a technical means for obtaining a call relationship between modules according to an application module source code is adopted, so as to overcome a technical problem that a registration center architecture is adopted to only obtain a remote call relationship between application modules accessing the same type of RPC framework, thereby achieving a technical effect of a remote call relationship between application modules across frameworks. And the existing interfaces of Thrift, WebService and RESTful can also acquire the remote calling relationship without code modification. Meanwhile, the method is free from code intrusion and does not need to access a specific framework.
To achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a method for obtaining a remote invocation relationship between application modules, including: for each application module, acquiring a source code of the application module; acquiring original calling data of the application module according to the source code of the application module; and acquiring the remote calling relation between the application modules according to the original calling data of each application module.
Optionally, the original call data of the application module includes an RPC interface called by the application module and an RPC interface provided by the application module; the method for acquiring the remote call relation between the application modules comprises the following steps: taking any one application module as a first application module; matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules, and if the same RPC interface exists between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module providing the relationship interface as a second application module; a remote invocation relationship is obtained in which the first application module invokes a relationship interface provided by the second application module.
Optionally, identifying the RPC interface through the RPC frame type of the RPC interface and the identifier of the RPC interface; the step of matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules comprises the following steps: judging whether the RPC frame type of the RPC interface called by the first application module is the same as the RPC frame types of the RPC interfaces provided by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface called by the first application module is the same as the identification of the RPC interfaces provided by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules.
Optionally, the original call data of the application module includes an RPC interface called by the application module and an RPC interface provided by the application module; the method for acquiring the remote call relation between the application modules comprises the following steps: taking any one application module as a first application module; matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules, and if the same RPC interface exists between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module calling the relationship interface as a second application module; obtaining a remote invocation relationship for the relationship interface that the first application module provides for invocation by the second application module.
Optionally, identifying the RPC interface through the RPC frame type of the RPC interface and the identifier of the RPC interface; the step of matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules comprises the following steps: judging whether the RPC frame type of the RPC interface provided by the first application module is the same as the RPC frame types of the RPC interfaces called by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface provided by the first application module is the same as the identification of the RPC interfaces called by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules.
Optionally, the obtaining the source code of the application module includes: acquiring basic information of an application module, wherein the basic information comprises: a source code address, a unique identification of the application module; downloading the source code of the application module according to the source code address; after the original calling data of the application module is obtained, the method comprises the following steps: marking the unique identification of the application module on the extracted original calling data to determine that the source code of the application module has been processed.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an apparatus for obtaining a remote invocation relation between application modules, including: the system comprises a source code acquisition unit, an original calling data acquisition unit and a remote calling relation acquisition unit; the source code obtaining unit is configured to: for each application module, acquiring a source code of the application module; the original call data acquisition unit is configured to: acquiring original calling data of the application module according to the source code of the application module; the remote invocation relation obtaining unit is configured to: and acquiring the remote calling relation between the application modules according to the original calling data of each application module.
Optionally, the original call data of the application module includes: the RPC interface called by the application module and the RPC interface provided by the application module; the remote invocation relation obtaining unit is configured to: taking any one application module as a first application module; matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules, and if the same RPC interface exists between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module providing the relationship interface as a second application module; a remote invocation relationship is obtained in which the first application module invokes a relationship interface provided by the second application module.
Optionally, the remote invocation relation obtaining unit is further configured to: identifying the RPC interface through the RPC frame type of the RPC interface and the identification of the RPC interface; judging whether the RPC frame type of the RPC interface called by the first application module is the same as the RPC frame types of the RPC interfaces provided by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface called by the first application module is the same as the identification of the RPC interfaces provided by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules.
Optionally, the original call data of the application module includes an RPC interface called by the application module and an RPC interface provided by the application module; the remote invocation relation obtaining unit is configured to: taking any one application module as a first application module; matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules, and if the same RPC interface exists between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module calling the relationship interface as a second application module; obtaining a remote invocation relationship for the relationship interface that the first application module provides for invocation by the second application module.
Optionally, the remote invocation relation obtaining unit is further configured to: identifying the RPC interface through the RPC frame type of the RPC interface and the identification of the RPC interface; judging whether the RPC frame type of the RPC interface provided by the first application module is the same as the RPC frame types of the RPC interfaces called by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface provided by the first application module is the same as the identification of the RPC interfaces called by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules.
Optionally, the source code obtaining unit is configured to: acquiring basic information of an application module, wherein the basic information comprises: a source code address, a unique identification of the application module; downloading the source code of the application module according to the source code address; after the original calling data of the application module is obtained, the method comprises the following steps: marking the unique identification of the application module on the extracted original calling data to determine that the source code of the application module has been processed.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus including: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the method for acquiring the remote calling relationship between the application modules.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer readable medium having stored thereon a computer program, which when executed by a processor, implements the method for acquiring a remote call relationship between application modules according to the present invention.
One embodiment of the above invention has the following advantages or benefits: because the technical means of acquiring the module point calling relationship according to the source code of the application module is adopted, the technical problem that the remote calling relationship between the application modules accessed into the RPC framework of the same type can only be acquired by adopting the registration center framework is solved, and the technical effect of the remote calling relationship between the application modules of the cross-framework is further achieved. And the existing interfaces of Thrift, WebService and RESTful can also acquire the remote calling relationship without code modification. Meanwhile, the method is free from code intrusion and does not need to access a specific framework.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a simplified schematic diagram of interface dependency between application modules;
FIG. 2 is a diagram illustrating a prior art remote invocation relationship between modules using a registry architecture;
FIG. 3 is a diagram illustrating a basic flow of a method for obtaining a remote invocation relationship between application modules according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of services provided and invoked by application module A, obtained from the source code of application module A;
FIG. 5 is a schematic diagram of services provided and invoked by application module B, obtained from the source code of application module B;
FIG. 6 is a diagram illustrating basic modules of an apparatus for obtaining a remote invocation relationship between application modules according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating preferred modules of an apparatus for obtaining remote invocation relationships between application modules, in accordance with an embodiment of the present invention;
FIG. 8 is a diagram illustrating a preferred flow of obtaining remote invocation relationships between application modules, according to an embodiment of the present invention;
FIG. 9 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 10 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The nouns of the technical wording appearing herein explain:
a Web service is a platform-independent, low-coupling, self-contained, programmable Web-based application that can be described, published, discovered, coordinated, and configured using the open XML (a subset of the standard universal markup language) standard for developing distributed, interoperable applications.
Thrfit is a software framework for extensible and cross-language service development.
REST refers to a set of architectural constraints and principles, and the interface of an application or design that satisfies these constraints and principles is the RESTful interface.
Jsf (javaserver faces) is a standard framework for building Java Web applications.
Dubbo is an open source distributed service framework.
JMQ is a message middleware system.
An RPC (remote Procedure call) remote Procedure call is a protocol that requests services from a remote computer program over a network without knowledge of the underlying network technology.
FIG. 1 is a simplified schematic diagram of interface dependency between application modules; as shown in fig. 1, application module a calls a JSF type interface of "com.jd.xxx.yyy" provided by application module B, application module B calls a Web Service on "/query/method" provided by application module C, application module D calls JMQ "listening to Topic as ABC provided by application module B, and application module D calls a Dubbo type interface of" com.jd.zzzz "provided by application module C. When the number of application modules is small, the developer can quickly master the codes of all the modules, so that the calling relationship among the modules can be manually combed. However, when the number of application modules is tens of thousands, the difficulty of manually combing the calling relationship is very high.
FIG. 2 is a diagram illustrating a prior art remote invocation relationship between modules using a registry architecture; as shown in fig. 2, the application module a providing the first service may register the first service in the registry, the application module B providing the second service may register the second service in the registry, and the application module C invoking the first service and the application module D invoking the first service may directly connect to the application module a for remote invocation after querying the first service in the registry. The application module A, the application module C and the application module D all have own identity identifiers in the registration center, so that the call relation among the modules can be directly inquired in the registration center, namely: the application module C calls a remote calling relation of the first service provided by the application module A; and the application module D calls the remote calling relation of the first service provided by the application module A.
Fig. 3 is a schematic diagram of a basic flow of a method for obtaining a remote call relationship between application modules according to an embodiment of the present invention, and as shown in fig. 3, an embodiment of the present invention provides a method for obtaining a remote call relationship between application modules, which may include:
step S301: for each application module, acquiring a source code of the application module;
step S302: acquiring original calling data of the application module according to the source code of the application module;
step S303: and acquiring the remote calling relation between the application modules according to the original calling data of each application module.
The embodiment of the invention adopts the technical means of acquiring the call relation between the modules according to the source code of the application module, thereby overcoming the technical problem that the remote call relation between the application modules which are accessed into the RPC framework of the same type can only be acquired by adopting the registration center framework, and further achieving the technical effect of the remote call relation between the application modules of the cross-framework. And the existing interfaces of the thread, the Web Service and the RESTful can also acquire the remote calling relation without code modification. Meanwhile, the method is free from code intrusion and does not need to access a specific framework.
In the embodiment of the invention, the original calling data of the application module can comprise an RPC interface called by the application module and an RPC interface provided by the application module; obtaining the remote call relationship between the application modules may include: taking any one application module as a first application module; matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules, and if the same RPC interface exists between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module providing the relationship interface as a second application module; a remote invocation relationship is obtained in which the first application module invokes a relationship interface provided by the second application module. When any one application module is used as the first application module, all the application modules may not include the first application module.
According to the embodiment of the invention, the technical means of matching and calling the RPC interface and providing the RPC interface is adopted to obtain the call relation between the modules, so that the speed of obtaining the call relation between the modules can be improved, and meanwhile, the accuracy of the obtained result is higher.
In the embodiment of the invention, the RPC interface can be identified by the RPC frame type of the RPC interface and the identification of the RPC interface; matching the RPC interface called by the first application module with the RPC interfaces provided by all application modules may include: judging whether the RPC frame type of the RPC interface called by the first application module is the same as the RPC frame types of the RPC interfaces provided by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface called by the first application module is the same as the identification of the RPC interfaces provided by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules.
According to the embodiment of the invention, the RPC frame type of the RPC interface and the identification of the RPC interface are matched with the RPC interface and the RPC interface is provided, so that the accuracy of obtaining the call relation between the modules can be improved.
Fig. 4 is a schematic diagram of services provided and invoked by application module a obtained from the source code of application module a. As shown in fig. 4, the interface called by the application module a in the original calling data of the application module a includes: a JSF type interface identified as "com.jd.module a.bbbb", a JSF type interface identified as "com.jd.module a.aaaa"; the interface provided by the application module a comprises: a JSF type interface identified as "xxxxxx", a JSF type interface identified as "yyyyyy". Fig. 5 is a schematic diagram of services provided and invoked by application module B obtained from the source code of application module B. As shown in fig. 5, the interface called by the application module B in the original call data of the application module B includes: a Dubbo type interface identified as "com.jd.modulec.dubbo.zzz", a Dubbo type interface identified as "com.jd.moduleB.xxx", a JSF type interface identified as "com.xxx.eee.jsf.bbbb", a JSF type interface identified as "jmq.topic.moduley.jsf.abc", a JSF type interface identified as "jmq.topic.modulex.jsf.aaa"; the interface provided by the application module B comprises: a JSF type interface identified as "com.jd.module a.bbbb", a JSF type interface identified as "com.jd.module a.aaaa", a JSF type interface identified as "com.jd.module a.eeee", a JMQ type interface identified as "jmq.topic.module a.somneling.happen". Taking the application module A as a first application module, matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules, and obtaining the same RPC interface through matching of the RPC interface type and the identification of the RPC interface: a JSF type interface identified as "com. Then, the application module B is the second application module, and obtains the remote call relationship between the JSF type interface identified as "com.
In the embodiment of the invention, the original calling data of the application module can comprise an RPC interface called by the application module and an RPC interface provided by the application module; obtaining the remote call relationship between the application modules may include: taking any one application module as a first application module; matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules, and if the same RPC interface exists between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module calling the relationship interface as a second application module; obtaining a remote invocation relationship for the relationship interface that the first application module provides for invocation by the second application module.
The embodiment of the invention adopts the technical means of providing the RPC interface and calling the RPC interface in a matching manner to obtain the call relation between the modules, can improve the speed of obtaining the call relation between the modules, and simultaneously ensures that the accuracy of the obtained result is higher.
In the embodiment of the invention, the RPC interface can be identified by the RPC frame type of the RPC interface and the identification of the RPC interface; matching the RPC interface provided by the first application module with the RPC interfaces invoked by all application modules may include: judging whether the RPC frame type of the RPC interface provided by the first application module is the same as the RPC frame types of the RPC interfaces called by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface provided by the first application module is the same as the identification of the RPC interfaces called by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules.
According to the embodiment of the invention, the RPC interface and the call RPC interface are provided by matching the RPC frame type of the RPC interface and the identification of the RPC interface, so that the accuracy of obtaining the call relation between the modules can be improved.
In this embodiment of the present invention, the obtaining the source code of the application module may include: acquiring basic information of an application module, wherein the basic information may include: a source code address, a unique identification of the application module; downloading the source code of the application module according to the source code address; obtaining the original call data of the application module may include: marking the unique identification of the application module on the extracted original calling data to determine that the source code of the application module has been processed.
FIG. 6 is a diagram illustrating basic modules of an apparatus for obtaining a remote invocation relationship between application modules according to an embodiment of the present invention; as shown in fig. 6, an apparatus 600 for obtaining a remote invocation relationship between application modules according to an embodiment of the present invention may include: a source code obtaining unit 601, an original call data obtaining unit 602, and a remote call relation obtaining unit 603; the source code obtaining unit 601 is configured to: for each application module, acquiring a source code of the application module; the original call data obtaining unit 602 is configured to: acquiring original calling data of the application module according to the source code of the application module; the remote invocation relation obtaining unit 603 is configured to: and acquiring the remote calling relation between the application modules according to the original calling data of each application module.
The embodiment of the invention adopts the technical means of acquiring the call relation between the modules according to the source code of the application module, thereby overcoming the technical problem that the remote call relation between the application modules accessed into the same frame can only be acquired by adopting a registration center framework, and further achieving the technical effect of the remote call relation between the application modules of the cross-frame. And the existing interfaces of Thrift, WebService and RESTful can also acquire the remote calling relationship without code modification. Meanwhile, the method is free from code intrusion and does not need to access a specific framework.
In this embodiment of the present invention, the original call data of the application module may include: the RPC interface called by the application module and the RPC interface provided by the application module; the remote invocation relation obtaining unit 603 may be configured to: taking any one application module as a first application module; matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules, and if the same RPC interface exists between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module providing the relationship interface as a second application module; a remote invocation relationship is obtained in which the first application module invokes a relationship interface provided by the second application module.
According to the embodiment of the invention, the technical means of matching and calling the RPC interface and providing the RPC interface is adopted to obtain the call relation between the modules, so that the speed of obtaining the call relation between the modules can be improved, and meanwhile, the accuracy of the obtained result is higher.
In this embodiment of the present invention, the remote invocation relation obtaining unit 603 may be further configured to: identifying the RPC interface through the RPC frame type of the RPC interface and the identification of the RPC interface; judging whether the RPC frame type of the RPC interface called by the first application module is the same as the RPC frame types of the RPC interfaces provided by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface called by the first application module is the same as the identification of the RPC interfaces provided by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules.
According to the embodiment of the invention, the RPC frame type of the RPC interface and the identification of the RPC interface are matched with the RPC interface and the RPC interface is provided, so that the accuracy of obtaining the call relation between the modules can be improved.
In the embodiment of the invention, the original calling data of the application module can comprise an RPC interface called by the application module and an RPC interface provided by the application module; the remote invocation relation obtaining unit may be configured to: taking any one application module as a first application module; matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules, and if the same RPC interface exists between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module calling the relationship interface as a second application module; obtaining a remote invocation relationship for the relationship interface that the first application module provides for invocation by the second application module.
The embodiment of the invention adopts the technical means of providing the RPC interface and calling the RPC interface in a matching manner to obtain the call relation between the modules, can improve the speed of obtaining the call relation between the modules, and simultaneously ensures that the accuracy of the obtained result is higher.
In this embodiment of the present invention, the remote invocation relation obtaining unit 603 may be further configured to: identifying the RPC interface through the RPC frame type of the RPC interface and the identification of the RPC interface; judging whether the RPC frame type of the RPC interface provided by the first application module is the same as the RPC frame types of the RPC interfaces called by all the application modules; if the RPC interfaces are the same, judging whether the identification of the RPC interface provided by the first application module is the same as the identification of the RPC interfaces called by all the application modules; and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules.
According to the embodiment of the invention, the RPC interface and the call RPC interface are provided by matching the RPC frame type of the RPC interface and the identification of the RPC interface, so that the accuracy of obtaining the call relation between the modules can be improved.
In this embodiment of the present invention, the source code obtaining unit 601 may be configured to: acquiring basic information of an application module, wherein the basic information comprises: a source code address, a unique identification of the application module; downloading the source code of the application module according to the source code address; after the original calling data of the application module is obtained, the method comprises the following steps: marking the unique identification of the application module on the extracted original calling data to determine that the source code of the application module has been processed.
FIG. 7 is a schematic diagram of preferred module components for obtaining remote invocation relationships between application modules, in accordance with an embodiment of the present invention; as shown in fig. 7, the source code obtaining unit obtains the basic information of the application module and the address of the source code, and after downloading the code according to the address of the source code, the source code obtaining unit may obtain the original call data in a manner of, but not limited to, scanning the source code. The timing trigger of the remote call relation acquisition unit can be set every night, the acquired original call data is analyzed, the remote call relation between the application modules is acquired, and the call relation is output.
In this embodiment of the present invention, the remote invocation relation obtaining unit 603 may be further configured to: and the obtained remote calling relation among the modules is used for external calling or front-end display.
FIG. 8 is a diagram illustrating a preferred flow of obtaining remote invocation relationships between application modules, according to an embodiment of the present invention; as shown in fig. 8, the source code acquiring unit acquires the application module source code from the code library, and acquires the application module basic information from the application module information management system. Acquiring original calling data according to the source code of the application module; the remote call relation acquisition unit acquires remote call relations among the application modules according to the original call data; and the obtained remote calling relation between the modules is used for interface calling or front-end display.
Fig. 9 shows an exemplary system architecture 900 of a distributed data processing method or distributed data processing apparatus to which embodiments of the present invention may be applied.
As shown in fig. 9, the system architecture 900 may include end devices 901, 902, 903, a network 904, and a server 905. Network 904 is the medium used to provide communication links between terminal devices 901, 902, 903 and server 905. Network 904 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 901, 902, 903 to interact with a server 905 over a network 904 to receive or send messages and the like. The terminal devices 901, 902, 903 may have various communication client applications installed thereon, such as a shopping application, a web browser application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 901, 902, 903 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 905 may be a server that provides various services, such as a background management server that supports shopping websites browsed by users using the terminal devices 901, 902, and 903. The background management server can analyze and process the received data such as the product information inquiry request and feed back the processing result to the terminal equipment.
It should be noted that the method for obtaining the remote invocation relationship between the application modules according to the embodiment of the present invention is generally executed by the server 905, and accordingly, the apparatus for obtaining the remote invocation relationship between the application modules is generally disposed in the server 905.
It should be understood that the number of terminal devices, networks, and servers in fig. 9 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
According to an embodiment of the present invention, there are also provided an electronic apparatus and a readable storage medium.
The electronic device of the embodiment of the invention comprises: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the method for acquiring the remote calling relationship between the application modules.
The computer readable medium of the embodiment of the present invention stores thereon a computer program, which when executed by a processor implements the method for acquiring a remote invocation relationship between application modules provided by the present invention.
Referring now to FIG. 10, a block diagram of a computer system 1000 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 10, the computer system 1000 includes a Central Processing Unit (CPU)1001 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1002 or a program loaded from a storage section 1008 into a Random Access Memory (RAM) 1003. In the RAM1003, various programs and data necessary for the operation of the system 1000 are also stored. The CPU1001, ROM1002, and RAM1003 are connected to each other via a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
The following components are connected to the I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 1008 including a hard disk and the like; and a communication section 1009 including a network interface card such as a LAN card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 1001.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor, comprising: the system comprises a source code acquisition unit, an original calling data acquisition unit and a remote calling relation acquisition unit. The names of these units do not in some cases constitute a limitation to the module itself, and for example, the source code acquiring unit may also be described as "a unit that acquires the source code of the application module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: step S301: for each application module, acquiring a source code of the application module; step S302: acquiring original calling data of the application module according to the source code of the application module; step S303: and acquiring the remote calling relation between the application modules according to the original calling data of each application module.
According to the distributed data processing method, the technical means of acquiring the call relation among the modules according to the source codes of the application modules is adopted, so that the technical problem that the remote call relation among the application modules accessed to the RPC framework of the same type can only be acquired by adopting the registration center framework is solved, and the technical effect of the remote call relation among the application modules of the cross-framework is further achieved. And the existing interfaces of Thrift, WebService and RESTful can also acquire the remote calling relationship without code modification. Meanwhile, the method is free from code intrusion and does not need to access a specific framework.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A method for obtaining a remote call relation between application modules is characterized by comprising the following steps:
acquiring a source code of an application module aiming at each application module, wherein the number of the application modules is multiple, and each application module comprises one or more frame types of remote calling interfaces;
acquiring original calling data of the application module according to the source code of the application module;
the original calling data of each application module comprises an RPC interface called by the application module and an RPC interface provided by the application module;
acquiring a remote calling relation between the application modules according to the original calling data of each application module;
obtaining a remote calling relation between the application modules according to the original calling data of each application module, wherein the remote calling relation comprises the following steps: and acquiring remote calling relations among the RPC interfaces determined based on the frame types among the plurality of application modules according to the RPC interfaces called by the application modules and the provided RPC interfaces.
2. The method of claim 1,
the method for acquiring the remote call relation between the application modules comprises the following steps:
taking any one application module as a first application module;
matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules, and if the same RPC interface exists between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module providing the relationship interface as a second application module;
a remote invocation relationship is obtained in which the first application module invokes a relationship interface provided by the second application module.
3. The method of claim 2, wherein the RPC interface is identified by its RPC frame type, its identifier;
the step of matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules comprises the following steps:
judging whether the RPC frame type of the RPC interface called by the first application module is the same as the RPC frame types of the RPC interfaces provided by all the application modules;
if the RPC interfaces are the same, judging whether the identification of the RPC interface called by the first application module is the same as the identification of the RPC interfaces provided by all the application modules;
and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules.
4. The method of claim 1, wherein obtaining remote invocation relationships between application modules comprises:
taking any one application module as a first application module;
matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules, and if the same RPC interface exists between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules, using the same RPC interface as a relationship interface, and using the application module calling the relationship interface as a second application module;
obtaining a remote invocation relationship for the relationship interface that the first application module provides for invocation by the second application module.
5. The method of claim 4, wherein the RPC interface is identified by its RPC frame type, its identifier;
the step of matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules comprises the following steps:
judging whether the RPC frame type of the RPC interface provided by the first application module is the same as the RPC frame types of the RPC interfaces called by all the application modules;
if the RPC interfaces are the same, judging whether the identification of the RPC interface provided by the first application module is the same as the identification of the RPC interfaces called by all the application modules;
and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules.
6. The method of claim 1, wherein obtaining the source code of the application module comprises:
acquiring basic information of an application module, wherein the basic information comprises: a source code address, a unique identification of the application module;
downloading the source code of the application module according to the source code address;
after the original calling data of the application module is obtained, the method comprises the following steps: marking the unique identification of the application module on the extracted original calling data to determine that the source code of the application module has been processed.
7. An apparatus for obtaining a remote invocation relationship between application modules, comprising: the system comprises a source code acquisition unit, an original calling data acquisition unit and a remote calling relation acquisition unit; the number of the application modules is multiple, and each application module comprises one or more frame types of remote calling interfaces;
the source code obtaining unit is configured to: for each application module, acquiring a source code of the application module;
the original call data acquisition unit is configured to: acquiring original calling data of the application module according to the source code of the application module; the original calling data of each application module comprises an RPC interface called by the application module and an RPC interface provided by the application module;
the remote invocation relation obtaining unit is configured to: acquiring a remote calling relation between the application modules according to the original calling data of each application module; obtaining a remote calling relation between the application modules according to the original calling data of each application module, wherein the remote calling relation comprises the following steps: and acquiring remote calling relations among the RPC interfaces determined based on the frame types among the plurality of application modules according to the RPC interfaces called by the application modules and the provided RPC interfaces.
8. The apparatus of claim 7,
the remote invocation relation obtaining unit is configured to:
taking any one application module as a first application module;
matching the RPC interface called by the first application module with the RPC interfaces provided by all the application modules, and if the same RPC interface exists between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module providing the relationship interface as a second application module;
a remote invocation relationship is obtained in which the first application module invokes a relationship interface provided by the second application module.
9. The apparatus of claim 8, wherein the remote invocation relationship obtaining unit is further configured to:
identifying the RPC interface through the RPC frame type of the RPC interface and the identification of the RPC interface;
judging whether the RPC frame type of the RPC interface called by the first application module is the same as the RPC frame types of the RPC interfaces provided by all the application modules;
if the RPC interfaces are the same, judging whether the identification of the RPC interface called by the first application module is the same as the identification of the RPC interfaces provided by all the application modules;
and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface called by the first application module and the RPC interfaces provided by all the application modules.
10. The apparatus of claim 7, wherein the remote invocation relationship obtaining unit is configured to:
taking any one application module as a first application module;
matching the RPC interface provided by the first application module with the RPC interfaces called by all the application modules, and if the same RPC interface exists between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules, taking the same RPC interface as a relationship interface, and taking the application module calling the relationship interface as a second application module;
obtaining a remote invocation relationship for the relationship interface that the first application module provides for invocation by the second application module.
11. The apparatus of claim 10, wherein the remote invocation relationship obtaining unit is further configured to:
identifying the RPC interface through the RPC frame type of the RPC interface and the identification of the RPC interface;
judging whether the RPC frame type of the RPC interface provided by the first application module is the same as the RPC frame types of the RPC interfaces called by all the application modules;
if the RPC interfaces are the same, judging whether the identification of the RPC interface provided by the first application module is the same as the identification of the RPC interfaces called by all the application modules;
and if the RPC interfaces are the same, determining that the same RPC interfaces exist between the RPC interface provided by the first application module and the RPC interfaces called by all the application modules.
12. The apparatus of claim 7, wherein the source code obtaining unit is configured to:
acquiring basic information of an application module, wherein the basic information comprises: a source code address, a unique identification of the application module;
downloading the source code of the application module according to the source code address;
after the original calling data of the application module is obtained, the method comprises the following steps: marking the unique identification of the application module on the extracted original calling data to determine that the source code of the application module has been processed.
13. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201711462204.7A 2017-12-28 2017-12-28 Method and device for acquiring remote call relation between application modules Active CN109981546B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711462204.7A CN109981546B (en) 2017-12-28 2017-12-28 Method and device for acquiring remote call relation between application modules

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711462204.7A CN109981546B (en) 2017-12-28 2017-12-28 Method and device for acquiring remote call relation between application modules

Publications (2)

Publication Number Publication Date
CN109981546A CN109981546A (en) 2019-07-05
CN109981546B true CN109981546B (en) 2021-08-20

Family

ID=67074878

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711462204.7A Active CN109981546B (en) 2017-12-28 2017-12-28 Method and device for acquiring remote call relation between application modules

Country Status (1)

Country Link
CN (1) CN109981546B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532115B (en) * 2019-09-04 2021-03-05 北京海益同展信息科技有限公司 System, method and apparatus for developing smart contracts
CN112148264A (en) * 2020-09-29 2020-12-29 湖南快乐阳光互动娱乐传媒有限公司 Cross-frame data interaction method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101256612A (en) * 2008-04-01 2008-09-03 北京飞天诚信科技有限公司 Program protection method and system based on .Net card
CN102420697A (en) * 2011-09-07 2012-04-18 北京邮电大学 Service-configurable comprehensive resource monitoring managing system and method
CN102968173A (en) * 2012-09-28 2013-03-13 北京航空航天大学 Bandwidth self-adaption code migration-based energy saving method for mobile equipment
CN105763619A (en) * 2016-03-31 2016-07-13 广州华多网络科技有限公司 Method and device for communication of client and server
CN105893052A (en) * 2016-04-20 2016-08-24 中国银行股份有限公司 War packet analyzer
CN106897620A (en) * 2017-02-13 2017-06-27 中国科学院信息工程研究所 A kind of Android application program secure visual analysis method based on malicious act function call graph

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023906B (en) * 2012-12-20 2017-04-19 北京奇虎科技有限公司 Method and system aiming at remote procedure calling conventions to perform status tracking

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101256612A (en) * 2008-04-01 2008-09-03 北京飞天诚信科技有限公司 Program protection method and system based on .Net card
CN102420697A (en) * 2011-09-07 2012-04-18 北京邮电大学 Service-configurable comprehensive resource monitoring managing system and method
CN102968173A (en) * 2012-09-28 2013-03-13 北京航空航天大学 Bandwidth self-adaption code migration-based energy saving method for mobile equipment
CN105763619A (en) * 2016-03-31 2016-07-13 广州华多网络科技有限公司 Method and device for communication of client and server
CN105893052A (en) * 2016-04-20 2016-08-24 中国银行股份有限公司 War packet analyzer
CN106897620A (en) * 2017-02-13 2017-06-27 中国科学院信息工程研究所 A kind of Android application program secure visual analysis method based on malicious act function call graph

Also Published As

Publication number Publication date
CN109981546A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
CN110708346B (en) Information processing system and method
CN111309375B (en) Method, device, medium and electronic equipment for generating remote procedure call toolkit
CN112507005B (en) Method and device for processing message
CN111478781B (en) Message broadcasting method and device
CN112202744B (en) Multi-system data communication method and device
CN111045833A (en) Interface calling method and device
CN111666293A (en) Database access method and device
CN113076294A (en) Information sharing method and device
CN113505302A (en) Method, device and system for supporting dynamic acquisition of buried point data and electronic equipment
CN110704200A (en) Method and device for converting call interface
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN114500481A (en) Service request processing method, system and device
CN110807535A (en) Construction method and construction device of unified reservation platform and unified reservation platform system
CN110795741A (en) Method and device for carrying out security processing on data
CN113821352A (en) Remote service calling method and device
CN110619101B (en) Method and apparatus for processing information
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN111953718A (en) Page debugging method and device
CN113779018A (en) Data processing method and device
CN113765983A (en) Site service deployment method and device
CN113448602A (en) Version updating method and device
CN109660573B (en) Data transmission method and device
CN113556370A (en) Service calling method and device
CN112306984A (en) Data source routing method and device
CN113495747B (en) Gray scale release method and device

Legal Events

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