Intersystem calling method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for intersystem call.
Background
In an Information Technology (IT) system of a large enterprise or an internet large system architecture, a large system is often required to be deployed into a distributed multi-system architecture based on requirements of system expansibility and stability.
In a distributed multi-system architecture, based on the requirement of service logic, interface data communication between different application systems needs to be realized based on a Remote Procedure Call Protocol (RPC). When a service request needs to be completed by matching a plurality of application systems, each level of application system can process the transmitted method parameter object according to the own requirements, and transmit the processed method parameter object to the next level of application system for continuous processing. It can be seen that the method parameter object received by the last stage application system is data after multi-stage processing, if a problem occurs in the data (for example, a certain attribute is missing or does not conform to format convention), when problem location is required, the problem location can be performed only from bottom to top, and the location efficiency is low.
In order to avoid tracing and positioning the first-level and the second-level of the application system, a scheme is provided, a transfer service is provided through a third-party system such as a message bus, when the next-level application system is called, a calling method and a transferred method parameter object are sent to the message bus, the message bus acquires and records context information corresponding to the transferred method parameter object based on the calling method, and the next-level application system can acquire the context information corresponding to the transferred method parameter object through the message bus.
Disclosure of Invention
The embodiment of the application provides an intersystem calling method, which is used for improving the problem positioning efficiency under a distributed multi-system architecture on the premise of not introducing a third-party system such as a message bus.
The embodiment of the application provides an intersystem calling method, which comprises the following steps:
when the first application system determines that a second application system needs to be called, context information is configured for a method parameter object to be transmitted by the first application system based on a remote procedure call protocol (RPC) framework;
and the first application system serializes the parameter object and the configured context information based on the RPC framework and transmits the serialized parameter object and the configured context information to the second application system.
Optionally, the configuring, by the first application system, context information for the method parameter object to be transmitted by the first application system based on the RPC framework includes:
and the first application system configures context information for the method parameter object after detecting that the method parameter object has a context information configuration indication identifier through an RPC frame.
Optionally, the first application system serializes the parameter object and the configured context information based on an RPC framework, and includes:
creating a composite object containing the method parameter object and the configured context information, and carrying out serialization processing on the created composite object; or,
and respectively carrying out serialization processing on the method parameter object and the configured context information.
Optionally, the context information comprises one or more of the following information:
name of the first application system, server IP address of the first application system, class name called, method name.
Another embodiment of the present application provides an inter-system call method, including:
the second application system carries out deserialization processing on the serialized method parameter object and the context information transmitted by the first application system based on a remote procedure call protocol (RPC) framework;
and the second application system calls the deserialized method parameter object based on the RPC framework and stores the deserialized context information.
Optionally, the second application system performs deserialization processing on the serialized method parameter object and the context information transmitted by the first application system based on the RPC framework, including:
performing deserialization processing on the serialized composite object containing the method parameter object and the context information; or,
and performing deserialization processing on the serialized method parameter object and the serialized context information respectively.
Optionally, the second application system, based on the RPC framework, after performing a method call on the deserialized method parameter object and storing the deserialized context information, further includes:
when the third application system is determined to be called, configuring context information for a method parameter object to be transmitted, which is obtained after the second application system is called by a method, based on an RPC (remote procedure call) frame;
and on the basis of an RPC (remote procedure call) framework, serializing the method parameter object to be transmitted of the second application system, the context information configured for the method parameter object to be transmitted and the context information sent by the first application system, and then transmitting the serialized context information to the third application system.
Optionally, the second application system, based on the RPC framework, after performing a method call on the deserialized method parameter object and storing the deserialized context information, further includes:
and after receiving a query request aiming at the context information, extracting and feeding back the stored context information.
An embodiment of the present application provides an intersystem call apparatus, including:
the configuration module is used for configuring context information for the method parameter object to be transmitted of the first application system based on a remote procedure call protocol (RPC) framework when the second application system is determined to be called;
and the transmission module is used for transmitting the parameter object and the configured context information to a second application system after the parameter object and the configured context information are serialized on the basis of the RPC framework.
Another embodiment of the present application provides an inter-system call apparatus, including:
the processing module is used for performing deserialization processing on the serialized method parameter object and the context information transmitted by the first application system based on a remote procedure call protocol (RPC) framework;
and the execution module is used for calling the method of the deserialized method parameter object based on the RPC framework and storing the deserialized context information.
In the embodiment of the application, when a second application system is called through an RPC framework of a first application system, context information is configured for a transferred method parameter object, and the configured context information and the transferred method parameter object are serialized and then transmitted to the second application system. Therefore, each level of application system can increase the context information corresponding to the transmitted method parameter object when the application system carries out the serialization processing of the method parameter object based on the RPC frame; therefore, the information of the whole calling link corresponding to the finally output method parameter object is recorded in the context information stored in the last-stage application system, namely the bottom-layer application system, so that the problem positioning efficiency under the distributed multi-system architecture can be improved on the premise of not introducing third-party systems such as a message bus and the like.
Drawings
Fig. 1 is a flowchart of an inter-system call method according to an embodiment of the present application;
fig. 2 is a flowchart of an inter-system calling method according to a second embodiment of the present application;
fig. 3 is a flowchart of an intersystem call method provided in the third embodiment of the present application;
FIG. 4 is a schematic diagram of inter-system calls;
fig. 5 is a schematic structural diagram of an inter-system call device according to a fourth embodiment of the present application;
fig. 6 is a schematic structural diagram of an inter-system call device according to a fifth embodiment of the present application.
Detailed Description
The basic idea of the embodiment of the application is as follows: and expanding an RPC frame for inter-system call, and adding context information during serialization processing. Specifically, when a second application system is called through an RPC framework of a first application system, context information is configured for the transferred method parameter object, and the configured context information and the transferred method parameter object are serialized and then transmitted to the second application system. Therefore, each level of application system can increase the context information corresponding to the transmitted method parameter object when the application system carries out the serialization processing of the method parameter object based on the RPC frame; therefore, the information of the whole calling link corresponding to the finally output method parameter object is recorded in the context information stored in the last-stage application system, namely the bottom-layer application system, so that the problem positioning efficiency under the distributed multi-system architecture can be improved on the premise of not introducing third-party systems such as a message bus and the like.
The embodiments of the present application will be described in further detail with reference to the drawings attached hereto.
Example one
As shown in fig. 1, a flowchart of an inter-system call method provided in an embodiment of the present application includes the following steps:
s101: when the first application system determines that the second application system needs to be called, context information is configured for the method parameter object to be transmitted by the first application system based on a remote procedure call protocol (RPC) framework.
In the service processing related to multi-system call, after the first application system completes service logic processing, a method parameter object obtained after processing needs to be transferred to the second application system for processing continuously, that is, a request for calling the second application system is sent to an RPC frame of the second application system through the RPC frame of the first application system, so as to call a service method of the second application system for continuous service logic processing.
Here, the context information may include one or more of the following information:
name of the first application system, server IP address of the first application system, class name called, method name.
Through the context information configured by the first application system, the method calling process responsible for the first application system in the whole calling link of the method parameter object can be tracked.
S102: and the first application system serializes the parameter object and the configured context information based on the RPC framework and transmits the serialized parameter object and the configured context information to the second application system.
In this step, the RPC framework of the first application system serializes the context information and the method parameter object to be transferred, and then transmits the serialized context information and the method parameter object to the next-stage application system. In fact, the serialization processing mechanism of the RPC call is utilized, and the addition of the context information is completed in the serialization processing process.
S103: and the second application system carries out deserialization processing on the serialized method parameter object and the context information transmitted by the first application system based on a remote procedure call protocol (RPC) framework.
Here, the RPC framework of the second application system performs deserialization processing on the received serialized method parameter object and context information to obtain the original method parameter object and context information.
S104: and the second application system carries out method calling based on the deserialized method parameter object and stores the deserialized context information.
The second application system calls a service method based on the deserialized method parameter object to process the service logic of the second application system; and storing the deserialized context information, wherein the stored context information can be used for continuing to be transmitted to a next-level application system or used for inquiring.
Example two
As shown in fig. 2, a flowchart of an inter-system call method provided in the second embodiment of the present application includes the following steps:
s201: when the first application system needs to call the second application system, whether a method parameter object to be transmitted has a context information configuration indication mark is detected through an RPC frame, if so, S203 is entered, and if not, S202 is entered.
In specific implementation, which classes, methods, attributes and the like need to be configured with context information may be preset, and a context information configuration indication identifier, such as @ HoldContext, is added at a set position such as a name of the class/method/attribute where the context information needs to be configured; after the service logic processing is performed to obtain the relevant method parameter object, it is usually searched whether a set position of the class/method/attribute corresponding to the method parameter object has a context information configuration indication identifier to determine whether the context information corresponding to the method parameter object needs to be configured.
S202: the first application system is based on the RPC framework, and transmits the parameter object to be transmitted to the second application system after serialization processing.
Here, if the method parameter object to be transmitted does not need to be configured with context information, the RPC framework of the first application system may directly serialize the method parameter object and transmit the serialized method parameter object to the second application system.
S203: the first application system configures context information for the method parameter object based on an RPC framework, creates a composite object containing the method parameter object and the configured context information, and transmits the created composite object to a second application system after serialization processing; or, the parameter object and the configured context information are respectively serialized and then transmitted to a second application system.
Here, the RPC framework of the first application system may perform the serialization processing on the method parameter object and the configured context information as a composite object, or may perform the serialization processing on the two objects separately.
S204: the second application system performs deserialization processing on the serialized composite object containing the method parameter object and the context information based on the RPC framework; or performing deserialization processing on the serialized method parameter object and the serialized context information respectively.
Corresponding to S203, when performing deserialization, the RPC framework of the second application system may perform deserialization on a composite object of the method parameter object and the context information, or may perform deserialization on two objects of the method parameter object and the context information, respectively.
S205: and the second application system calls the deserialized method parameter object based on the RPC framework and stores the deserialized context information.
Here, the RPC framework of the second application system calls a service method based on the deserialized method parameter object, and the second application system performs the processing of its own service logic; and the RPC framework of the second application system stores the deserialized context information, and the stored context information can be used for continuing to be transmitted to the next-level application system or used for querying. Specifically, if the second application system is not the application system at the bottom layer of the current service, the second application system serializes the method parameter object obtained after the service logic is performed and the context information corresponding to the method parameter object and the previously received context information and transmits the serialized context information to the next-stage application system based on the RPC framework. If the second application system is the lowest application system of the current service, the context information can be saved for subsequent query. This idea will be further described in example three.
EXAMPLE III
As shown in fig. 3, which is a flowchart of an inter-system call method provided in a third embodiment of the present application, fig. 4 is a schematic diagram of an inter-system call corresponding to the third embodiment, where the third embodiment includes the following steps:
s301: when the first application system determines that the second application system needs to be called, context information is configured for the method parameter object to be transmitted by the first application system based on the RPC framework.
As shown in fig. 4, firstly, a developer may add a context information configuration indication identifier, such as @ HoldContext, to a set location of a class/attribute/method or the like that needs to maintain a context through a development interface of the first application system.
After receiving an instruction for calling a second application system, an RPC frame of the first application system detects whether a set position corresponding to a method parameter object to be transmitted has a corresponding context information configuration indication mark, and if so, configures context information for the method parameter object to be transmitted.
S302: and the first application system serializes the parameter object and the configured context information based on the RPC framework and transmits the serialized parameter object and the configured context information to the second application system.
As shown in fig. 4, after the RPC framework of the first application system serializes the method parameter object to be transmitted and the configured context information, the serialized method parameter object and the configured context information are transmitted to the RPC framework of the second application system, that is, the second application system continues processing.
S303: the second application system carries out deserialization processing on the serialized method parameter object and the context information transmitted by the first application system based on the RPC framework; and carrying out method calling based on the deserialized method parameter object, and storing the deserialized context information.
As shown in fig. 4, the RPC framework of the second application system performs deserialization processing on the received listed method parameter object and context information; and the RPC framework of the second application system calls the service method based on the deserialized method parameter object, and the second application system performs self service logic processing based on the called service method.
S304: and when the second application system determines that a third application system needs to be called, configuring context information for the method parameter object to be transmitted, which is obtained after the second application system carries out method calling, based on the RPC framework.
S305: the second application system carries out serialization processing on the method parameter object to be transmitted of the second application system, the context information configured for the method parameter object to be transmitted and the context information sent by the first application system based on the RPC framework, and then transmits the method parameter object to a third application system.
As shown in fig. 4, after receiving an instruction for calling a third application system, the RPC framework of the second application system configures context information for a method parameter object to be transmitted, which is obtained after a service method is called, and transmits the method parameter object, the configured context information, and previous context information to the third application system after performing serialization processing.
S306: the third application system carries out deserialization processing on the serialized method parameter object and the context information transmitted by the second application system based on the RPC framework; and carrying out method calling based on the deserialized method parameter object, and storing the deserialized context information.
As shown in fig. 4, the RPC framework of the third application system performs deserialization processing on the received serialized information, and stores all the deserialized context information; and (3) using the deserialized method parameter object to call a service method, and performing self service logic processing (such as risk identification service logic processing) by the third application system based on the called service method.
And the RPC frame of the third application system provides a context information service interface, after receiving a context information query request aiming at any method parameter object, queries a call link corresponding to the method parameter object based on the RPC frame, and extracts context information corresponding to each method parameter object on the call link.
Based on the same inventive concept, the embodiment of the present application further provides an inter-system calling device corresponding to the inter-system calling method, and as the principle of the device for solving the problem is similar to the inter-system calling method in the embodiment of the present application, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Example four
As shown in fig. 5, a schematic structural diagram of an inter-system call device provided in the fourth embodiment of the present application includes:
a configuration module 51, configured to configure context information for a method parameter object to be transmitted by the first application system based on a remote procedure call protocol (RPC) framework when it is determined that the second application system needs to be called;
and the transmission module 52 is configured to perform serialization processing on the parameter object and the configured context information based on the RPC framework, and then transmit the serialized parameter object and the configured context information to the second application system.
Optionally, the configuration module 51 is specifically configured to:
and configuring context information for the method parameter object after detecting that the method parameter object has a context information configuration indication mark through an RPC frame.
Optionally, the transmission module 52 is specifically configured to:
creating a composite object containing the method parameter object and the configured context information, and carrying out serialization processing on the created composite object; or,
and respectively carrying out serialization processing on the method parameter object and the configured context information.
Optionally, the context information comprises one or more of the following information:
name of the first application system, server IP address of the first application system, class name called, method name.
EXAMPLE five
As shown in fig. 6, a schematic structural diagram of an inter-system call device provided in the fifth embodiment of the present application includes:
the processing module 61 is configured to perform deserialization processing on the serialized method parameter object and the context information transmitted by the first application system based on a remote procedure call protocol (RPC) framework;
and the execution module 62 is configured to perform method call on the deserialized method parameter object based on the RPC framework, and store the deserialized context information.
Optionally, the processing module 61 is specifically configured to:
performing deserialization processing on the serialized composite object containing the method parameter object and the context information; or,
and performing deserialization processing on the serialized method parameter object and the serialized context information respectively.
Optionally, the executing module 62 is further configured to:
when the third application system is determined to be called, configuring context information for a method parameter object to be transmitted, which is obtained after the second application system is called by a method, based on an RPC (remote procedure call) frame; and on the basis of an RPC (remote procedure call) framework, serializing the method parameter object to be transmitted of the second application system, the context information configured for the method parameter object to be transmitted and the context information sent by the first application system, and then transmitting the serialized context information to the third application system.
Optionally, the executing module 62 is further configured to:
and after receiving a query request aiming at the context information, extracting and feeding back the stored context information.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.