CN112965832A - Remote Procedure Call (RPC) service calling method and related device - Google Patents

Remote Procedure Call (RPC) service calling method and related device Download PDF

Info

Publication number
CN112965832A
CN112965832A CN202110187616.4A CN202110187616A CN112965832A CN 112965832 A CN112965832 A CN 112965832A CN 202110187616 A CN202110187616 A CN 202110187616A CN 112965832 A CN112965832 A CN 112965832A
Authority
CN
China
Prior art keywords
rpc
service
target
access layer
layer code
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.)
Granted
Application number
CN202110187616.4A
Other languages
Chinese (zh)
Other versions
CN112965832B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110187616.4A priority Critical patent/CN112965832B/en
Publication of CN112965832A publication Critical patent/CN112965832A/en
Application granted granted Critical
Publication of CN112965832B publication Critical patent/CN112965832B/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
    • 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/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application discloses an RPC service calling method and a related device, and at least relates to a template engine technology, access layer codes corresponding to multiple RPC services are integrated in RPC access layer sets corresponding to a unified RPC interface, so that the situation that an RPC system corresponding to the unified RPC interface accesses multiple RPC services is realized, the RPC interfaces are unified for the multiple RPC services, the unified calling of a client to the multiple RPC services (a first RPC service and/or a second RPC service) based on the unified RPC interface is realized, the number of the RPC interfaces required to be connected when the client calls the multiple RPC services is reduced, the connection efficiency is improved while the connection process is simplified, and the user experience is also improved.

Description

Remote Procedure Call (RPC) service calling method and related device
Technical Field
The present application relates to the technical field of Remote Procedure Call (RPC), and in particular, to a RPC service Call method and a related apparatus.
Background
The RPC means that a client sends an RPC service call request to an RPC interface on a server, the RPC service is called by executing an access layer code, and a return result is obtained, for example, the client draws and displays commodity prices from the server by calling database service.
Generally, a server side often needs to access a plurality of different kinds of external systems to build an RPC system, so as to provide a plurality of RPC services for a client side, wherein corresponding access layer codes of different types of RPC services are different.
Because different types of external systems have different access modes, for example, some RPC services provide a flow document, some RPC services provide a Software Development Kit (SDK) of a synchronous mode, some RPC services provide a semi-asynchronous SDK, and some RPC services provide an SDK of a callback mode, when different types of external systems are accessed, a plurality of RPC interfaces are often generated, thereby causing a large and repeated access workload. In a scene that a client needs to call multiple RPC services of an RPC system, the client needs to be connected with multiple RPC interfaces, the connection process is complicated, the efficiency is low, and the use experience of a developer is poor.
Disclosure of Invention
In order to solve the technical problems, the application provides an RPC service calling method and a related device, so that the number of RPC interfaces for calling various RPC services in an RPC system by a client is reduced, and the user experience is improved.
In view of this, the embodiment of the present application discloses the following technical solutions:
in one aspect, an embodiment of the present application provides a Remote Procedure Call (RPC) service calling method, including:
acquiring an RPC service call request through a unified RPC interface; the RPC service call request comprises a first identifier corresponding to a first RPC service in an RPC system;
determining a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
acquiring a first call result corresponding to a first RPC service according to the first access layer code;
and sending the first calling result through the unified RPC interface.
On the other hand, the embodiment of the application provides a Remote Procedure Call (RPC) service calling device, which comprises a first acquisition unit, a determination unit, a second acquisition unit and a sending unit:
the first acquisition unit is used for acquiring an RPC service call request through a unified RPC interface; the RPC service call request comprises a first identifier corresponding to a first RPC service in an RPC system;
the determining unit is used for determining a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
the second obtaining unit is used for obtaining a first calling result corresponding to the first RPC service according to the first access layer code;
and the sending unit is used for sending the first calling result through the unified RPC interface.
On the other hand, the embodiment of the application provides an RPC service calling system, which comprises a terminal device and a server:
the terminal equipment is used for sending an RPC service call request to the server through the unified RPC interface;
the server is used for acquiring an RPC service call request sent by the terminal equipment through a unified RPC interface;
the server is further used for determining a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface;
the server is further used for acquiring a first calling result corresponding to the first RPC service according to the first access layer code;
the server is further used for sending the first calling result to the terminal equipment through the unified RPC interface;
the terminal equipment is further used for obtaining the first calling result sent by the server through the unified RPC interface.
In another aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of the above aspect according to instructions in the program code.
In another aspect, the present application provides a computer-readable storage medium for storing a computer program for executing the method of the above aspect.
In another aspect, embodiments of the present application provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method of the above aspect.
According to the technical scheme, the RPC service call request acquired through the unified RPC interface determines the first access layer code corresponding to the first identifier from the RPC access layer code set corresponding to the unified RPC interface, then the first call result corresponding to the first RPC service is generated according to the first access layer code, the first call result is sent through the unified RPC interface, and the call of the first RPC service through the unified RPC interface is achieved. Because the RPC access layer code set corresponding to the unified RPC interface at least comprises the first access layer code and the second access layer code, the second access layer code corresponds to the second RPC service, the first RPC service and the second RPC service are different types of RPC services, namely, the access layer codes corresponding to the plurality of RPC services are integrated in the RPC access layer set corresponding to the unified RPC interface, the condition that the RPC system corresponding to the unified RPC interface accesses the plurality of RPC services is realized, the unification of the RPC interfaces corresponding to the plurality of RPC services is realized, the unified call of the client to the plurality of RPC services (the first RPC service and/or the second RPC service) based on the unified RPC interface is realized, the number of the RPC interfaces required to be connected when the client calls the plurality of RPC services is reduced, the connection process is simplified, the connection efficiency is improved, and the user experience is also improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic view of an application scenario of an RPC service invocation method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for calling an RPC service according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating a method for accessing RPC service based on a template engine according to an embodiment of the present application;
fig. 4 is a schematic flowchart of generating an access stratum code based on a template engine according to an embodiment of the present application;
fig. 5 is a schematic flowchart of another access stratum code generation based on a template engine according to an embodiment of the present application;
fig. 6 is a schematic flowchart of generating an access stratum code according to an embodiment of the present application;
fig. 7 is a schematic diagram of custom description information corresponding to an iTop service provided in an embodiment of the present application;
fig. 8 is a schematic diagram of a custom template corresponding to the iTop service provided in the embodiment of the present application;
fig. 9 is a schematic diagram of RPC declaration corresponding to a database service provided in an embodiment of the present application;
fig. 10 is a schematic view of access stratum codes corresponding to a database service provided in an embodiment of the present application;
fig. 11 is a schematic view of an access layer code corresponding to RPC between services provided in the embodiment of the present application;
fig. 12 is a schematic view of access layer codes corresponding to WebSocket and HTTP services provided in an embodiment of the present application;
fig. 13a is a schematic structural diagram of an RPC service invocation device according to an embodiment of the present application;
FIG. 13b is a schematic structural diagram of another RPC service invocation device provided in the present application;
fig. 14 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
Because the client calls various RPC services and needs to be connected with a plurality of RPC interfaces, the connection process is complicated and the use experience is poor. In view of this, the embodiment of the application provides an RPC service calling method and a related device, which implement calling of multiple RPC services based on a unified RPC interface, and improve user experience.
The RPC service calling method provided by the embodiment of the application can be applied to RPC service calling equipment with data processing capacity, such as terminal equipment or a server, can be independently executed through the terminal equipment, can also be independently executed through the server, can also be applied to a network scene of communication between the terminal equipment and the server, and can be executed through the cooperation between the terminal equipment and the server. The terminal equipment can be a mobile phone, a desktop computer, a portable computer and the like; the server may be understood as an application server or a Web server, and in actual deployment, the server may be an independent server or a cluster server. The following describes an embodiment of the present application with a server as an RPC service invocation device.
Referring to fig. 1, fig. 1 is a schematic view of an application scenario of an RPC service invocation method provided in the embodiment of the present application. In the RPC call scenario shown in fig. 1, a Client-Server (CS) mode is adopted, which includes a terminal device 101 and a Server 102 and 104. The terminal device 101 is a client that needs to call RPC service; the server 102 comprises an RPC system, the RPC system integrates a first RPC service and a second RPC service, and the server 102 serves as a server to provide and call various RPC services for the client; the server 103 is used to provide the first RPC service, and the server 104 is used to provide the second RPC service.
In the related art, a plurality of different RPC interfaces are generated for different types of RPC services, so that a plurality of RPC interfaces need to be connected in a scenario where a client needs to call a plurality of RPC services. According to the RPC service integration method and device, the access layer codes corresponding to different types of RPC services are integrated in the RPC interface layer code set corresponding to the unified RPC interface, and unification of the RPC interfaces corresponding to various RPC services is achieved.
In the scenario shown in fig. 1, the terminal device 101 establishes a connection with the server 102 via the unified RPC interface 105. The server 102 acquires, through the unified RPC interface 105, an RPC service invocation request sent by the terminal device 101, where the RPC service invocation request includes a first identifier corresponding to a first RPC service in an RPC system, and is used to invoke the first RPC service.
For the RPC system included in the server 102 in fig. 1, since the RPC access layer code set corresponding to the unified RPC interface 105 at least includes the first access layer code and the second access layer code, the first access layer code corresponds to the first RPC service, the second access layer code corresponds to the second RPC service, and the first RPC service and the second RPC service are different types of RPC services. That is to say, at least the first RPC service and the second RPC service are integrated in the RPC system corresponding to the unified RPC interface 105, that is, the terminal device 101 may call the first RPC service and/or the second RPC service in the RPC system through the unified RPC interface.
Taking the terminal device 101 as an example of calling the first RPC service in the RPC system through the unified RPC interface 105, in an actual calling process, the server 102 obtains an RPC service calling request sent by the terminal device 101 through the unified RPC interface 105, where the RPC service calling request includes a first identifier corresponding to the first RPC service, and is used for calling the first RPC service in the RPC system.
Then, the server 102 determines a first access layer code corresponding to the first identifier from the RPC access layer code set corresponding to the unified RPC interface 105. Then, the server 102 calls the server 102 to provide the first RPC service by executing the first access layer code, and obtains a first call result corresponding to the first RPC service returned by the server 103. Based on this, the server 102 sends the first call result to the terminal device 101 through the unified RPC interface 105. Correspondingly, the terminal device 101 obtains a first call result corresponding to the first RPC service through the unified RPC interface 105.
Similar to the above process, the terminal device 101 may also send an RPC service invocation request with a second identifier to the server 102 through the unified RPC interface 105, determine a second access layer code corresponding to the second identifier from the RPC access layer code set, and obtain a corresponding second invocation result by invoking the second RPC service, where the second identifier is used to identify the second RPC service in the RPC system, and is not described herein again.
The access layer code corresponding to the RPC services is integrated in the RPC access layer set corresponding to the unified RPC interface, the scene that the RPC system corresponding to the unified RPC interface accesses the RPC services is achieved, the RPC interfaces correspond to the RPC services in a unified mode, the client side calls the RPC services in a unified mode based on the unified RPC interfaces, the number of the RPC interfaces required to be connected when the client side calls the RPC services is reduced, the connection process is simplified, connection efficiency is improved, and user experience is improved.
For better understanding, the RPC service call method provided in the embodiment of the present application is described below from the perspective of an RPC service call system in conjunction with the application scenario shown in fig. 1.
Referring to fig. 2, fig. 2 is a schematic flowchart of an RPC service invocation method provided in the embodiment of the present application. In the scenario shown in fig. 2, a terminal device and a server are included. The terminal equipment is a client terminal needing to call RPC service, and the server is a service side providing the RPC service. As shown in fig. 2, the RPC service call method has the following steps:
s201: and the terminal equipment sends an RPC service call request to the server through the unified RPC interface.
In the actual calling process, the terminal equipment establishes contact with the server through the unified RPC interface. If the terminal equipment needs to call the first RPC service in the RPC system corresponding to the server, the terminal equipment sends an RPC service call request to the server through the unified RPC interface, and the RPC service call request comprises a first identifier of the first RPC service in the RPC system. The RPC service call request is used for calling RPC service in the RPC system.
It should be noted that the RPC system is only a conceptual definition, and there are no fixed implementations and communication systems, such as gRPC, bRPC, tRPC, and the like. For some proprietary frameworks and services, there are also some RPC models that are deeply integrated with the service framework. In the embodiment of the present application, the RPC system refers to a system that has access to at least one RPC service.
In a possible implementation manner, the RPC service may be any one or more of a database service, an inter-service RPC, a WebSocket service, a Hypertext Transfer Protocol (HTTP), an information technology Operation Portal (iTop), a monitoring alarm, a link tracking, or a proxy forwarding, which is not limited herein.
S202: and the server acquires the RPC service call request sent by the terminal equipment through the unified RPC interface.
S203: and the server determines a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface.
Because the different types of external systems have different access modes, when the RPC system accesses a plurality of different types of external systems, a plurality of RPC interfaces are generated for establishing contact with the client, so that RPC service call is provided for the client. In order to reduce the number of RPC interfaces connected by a client calling various RPC services and unify the modes of calling various RPC services by the client, in the embodiment of the application, the unification of the RPC interfaces corresponding to various RPC services is realized by integrating access layer codes corresponding to different types of RPC services in an RPC access layer set corresponding to the unified RPC interfaces.
In the embodiment of the application, the RPC access layer code set at least includes a first access layer code and a second access layer code, wherein the first access layer code corresponds to a first RPC service, the second access layer code corresponds to a second RPC service, and the first RPC service and the second RPC service are different types of RPC services. In practical application, the number of the plurality of access layer codes integrated by the RPC access layer code set corresponding to the unified RPC interface can be determined by the type of the RPC system needing to access the RPC service, and is not limited herein.
In the scene that the terminal equipment needs to call the first RPC service, after the server acquires an RPC service call request sent by the terminal equipment, the server determines a first access layer code corresponding to the first identifier from an RPC access layer set corresponding to the unified RPC interface so as to call the first RPC service according to the first access layer code.
The access layer codes corresponding to the RPC services are integrated in the RPC access layer code set corresponding to the unified RPC services, the unification of the RPC interfaces corresponding to the RPC services is achieved, namely, the client side is called to the unified RPC services based on the unified RPC interfaces, the number of the client side for calling the multiple RPC services to be connected is reduced, the connection process is simplified, the connection efficiency is improved, and the user experience is improved.
S204: and the server acquires a first calling result corresponding to the first RPC service according to the first access layer code.
In the actual calling process, the server executes the first access layer code, calls the first RPC service through a pre-accessed external system, and acquires a first calling result corresponding to the first RPC service from the external system. Wherein the external system is a system providing RPC services, e.g. a database system providing database services.
S205: and the server sends the first calling result to the terminal equipment through the unified RPC interface.
Based on the above, after the server obtains the first call result corresponding to the first RPC service, the server sends the first call result to the terminal device through the unified RPC interface.
S206: and the terminal equipment acquires a first calling result sent by the server through the unified RPC interface.
In the RPC service invocation method provided by the above embodiment, the RPC service invocation request obtained by the unified RPC interface is used to determine the first access layer code corresponding to the first identifier from the RPC access layer code set corresponding to the unified RPC interface, then the first invocation result corresponding to the first RPC service is generated according to the first access layer code, and the first invocation result is sent by the unified RPC interface, so that the invocation of the first RPC service by the unified RPC interface is realized. Because the RPC access layer code set corresponding to the unified RPC interface at least comprises the first access layer code and the second access layer code, the second access layer code corresponds to the second RPC service, the first RPC service and the second RPC service are different types of RPC services, namely, the access layer codes corresponding to the plurality of RPC services are integrated in the RPC access layer set corresponding to the unified RPC interface, the situation that the RPC system corresponding to the unified RPC interface accesses the plurality of RPC services is realized, the RPC interfaces correspond to the unification of the RPC services, the unified call of the client to the plurality of RPC services (the first RPC service and/or the second RPC service) based on the unified RPC interface is realized, the number of the RPC interfaces required to be connected when the client calls the plurality of RPC services is reduced, the connection process is simplified, the connection efficiency is improved, and the user experience is also improved.
It should be noted that, in the related art, most access code generation of RPC systems uses protobuf plug-in mode, where protobuf is a serialization and deserialization tool widely used in the industry. Using this mode requires either accessing the protobuf protocol or using the protobuf's libprotoc components and compiling out the executable file and implementing the given binary format in standard inputs and outputs. In this case, when the function needs to be rebuilt or added, the executable program needs to be recompiled, which causes the development of cross-platform and the need for quick test to be very tedious, and the programs often only provide a few fixed variable replacements, and the flexibility is greatly reduced.
Based on the foregoing, because different types of external systems have different access modes, when an RPC system accesses a plurality of different types of external systems, the RPC system often has a relatively large and repetitive workload, and when a structure or a document is changed, the RPC system needs to manually process the change and check whether the referenced place is correct. Such operations are extremely prone to omission and neglect when the system is large in scale.
Therefore, the embodiment of the application utilizes the template engine technology to generate the access layer code corresponding to the RPC service, and the access layer code is added into the RPC access layer code set to generate the unified RPC interface, so that the access workload of accessing the RPC service in the RPC system is reduced, and the expansibility of the RPC system is improved. The process of generating the access stratum code based on the template engine will be described in detail below with reference to the accompanying drawings.
Referring to fig. 3, fig. 3 is a schematic diagram of a method for accessing an RPC service based on a template engine according to an embodiment of the present application. As shown in fig. 3, the method comprises the steps of:
s301: and acquiring a target template corresponding to the target RPC service and target description information corresponding to the target template.
In the process of generating the access layer code, a target template and target description information corresponding to a target RPC service are obtained, wherein the target RPC service is an RPC service to be accessed into an RPC system, the target template is used for identifying interface specifications of a unified RPC interface, and the target description information corresponds to the target template and is used for identifying configuration information for calling the target RPC service. The interface specification may be set in advance according to a unified RPC interface corresponding to the RPC system, and the target template may be set based on the interface specification without any limitation.
In the embodiment of the application, the target PC service includes a built-in RPC service and/or a custom RPC service, where the built-in RPC service is a pre-configured RPC service of an RPC system, and the custom RPC service is an RPC service that a user developing or using the RPC system extends the RPC system. In actual application, a built-in RPC service and/or a custom RPC service may be selected according to an actual application scenario, which is not limited herein. And if the target RPC service is the built-in RPC service, acquiring a built-in template and an RPC statement corresponding to the built-in RPC service. And if the target RPC service is the custom RPC service, acquiring a custom template and custom description information corresponding to the custom RPC service.
Based on the above, the access layer code corresponding to the RPC service is generated based on the template engine technology, the built-in RPC service can be accessed to the RPC system, the RPC service can be expanded, namely, the user-defined RPC service is accessed to the RPC system, and therefore the expansibility of the RPC system is improved.
It should be noted that the template engine is a technology for separating data and a specific format document, and is commonly used for web page componentization rendering. The user can quickly realize the target document which is generated for the same data and realizes the same mode by writing different templates, and simultaneously, better readability is reserved and later maintenance is facilitated. As shown in fig. 4, the template engine 400 preprocesses the user template 401 to obtain a template compiling intermediate result 402, and then adds the user data 403 to generate the target document and the code 404. In the embodiment of the application, the access layer code of the RPC service is generated based on the template and the RPC description information.
There are two types of template engines: the first is a static template engine that registers only some of several fixed types of data and field names during the enrollment phase and allows some given functions to be enrolled. Before use, the executable program needs to be compiled, user data must be input in a fixed format during rendering, and the data and the registered function can be directly used in a template, but cannot be expanded at a user level. Such as go-template, last handlebars, etc. The other is a dynamic template engine realized by using the characteristics of the dynamic language, the dynamic language code is regenerated in the template stage, the user data is injected in a variable form during the template rendering, and the generated code is executed to generate the final output. Such as mako, jinja2, etc. The template system is not uniformly and fixedly realized, and different template engine frameworks and realization modes can be realized without language and scenes. In the embodiment of the present application, a dynamic template engine is taken as an example to introduce an access layer code corresponding to the RPC service generation.
S302: and generating the target access layer code corresponding to the target RPC service according to the target template and the target description information.
And generating a target access layer code corresponding to the target RPC service based on the target template and the corresponding target description information acquired in S201. Because the target template identifies the interface specification of the unified RPC interface, the target access layer code generated based on the target template meets the access condition of the RPC access layer code set corresponding to the unified RPC interface.
And if the target RPC service is the built-in RPC service, generating a target access layer code corresponding to the built-in RPC service according to a built-in template and an RPC statement corresponding to the built-in service. And if the target RPC service is the custom RPC service, generating a target access layer code corresponding to the custom RPC service according to the custom template and the custom description information.
It will be appreciated that the object description information is typically text and cannot be directly read or recognized by a computer. Therefore, the target description information needs to be preprocessed before being read by the computer. For a better understanding, the process of generating the access stratum code based on the template engine described above is described below in conjunction with fig. 5.
Referring to fig. 5, fig. 5 is a schematic flowchart of generating an access stratum code based on a template engine according to an embodiment of the present application. As shown in fig. 5, the target description information 501 (i.e., RPC declaration and/or user extension description) is converted by accessing an RPC template into a data layer, and a corresponding RPC description data layer code 502 is generated. In addition, the template engine 500 is utilized to pre-render the target template 503 (i.e., the built-in service template and/or the user-defined template), and generate a corresponding template compilation intermediate result 504. Based on this, the intermediate result 504 is compiled from the data layer code 502 and the template, and the target access layer code 505 corresponding to the target RPC service is generated.
The target description information is converted into the data layer code, the access layer code corresponding to the RPC service is generated based on the template engine technology, and a foundation is provided for subsequently adding the access layer code into the RPC access layer code set, so that various RPC services can be accessed into the RPC system and a uniform RPC interface can be generated. Due to the process of generating the access layer code based on the template, repeated access workload in the process of accessing various RPC services is avoided, and the access efficiency is improved.
S303: and accessing the target RPC service to the RPC system by adding the target access layer code to the RPC access layer code set.
Based on the above S202, the target access layer is added to the RPC access layer set corresponding to the unified RPC interface, that is, the target RPC service is accessed to the RPC system. For example, when the link tracking service needs to be accessed, the access layer code of the link tracking service is generated based on the steps and is added into the RPC access layer code set corresponding to the unified RPC interface. Wherein, link trace generally refers to trace analysis of the flow, dependency and status of remote procedure call.
Based on this, through integrating a plurality of access layer codes of multiple RPC services in the RPC access layer code set, the unification of corresponding RPC interfaces of the RPC services is realized, namely, the RPC services can be called through the unified RPC interfaces corresponding to the RPC access layer code set, so that the number of the RPC interfaces required to be connected by the client for calling the multiple RPC services is simplified, and the user experience is improved.
By integrating the template engine and the RPC system, the dynamic template engine technology is selected to support a complex logic statement flow, and a library in a language ecological chain can be used for accessing some system resources. Then, the description information based on the template is added on the basis, the description information is connected to the data layer of the template engine, the RPC template access interface (506 shown in FIG. 5) is provided to access the basic information and the extension information of the RPC system, and finally, the generated access layer code is added into the RPC access layer code set, namely, a unified RPC interface 508 is generated, so that the unification of the user layer interface is realized. Wherein the RPC access layer code set further includes an RPC public access layer, as shown in 507 of fig. 5.
It should be noted that the access stratum code generation method provided in the foregoing embodiment may also be implemented based on a static template engine, and may be selected according to a specific application scenario in practical application, which is not limited herein.
Since the static template engine can hardly dynamically expand the functions, the template engine must be recompiled when the functions need to be added. Although the dynamic template engine allows the user to perform limited extension at the user layer, the user must ensure the safety of the extension function by himself and the extension process is cumbersome. The template engine typically does not provide a plug-in mechanism, and for RPC systems typically some different options of functionality are required for different types of calls, and even some options and functionality are provided by the user, while the options may be complex structures (arrays, nested structures, etc.).
Based on the above, the template engine does not support the plug-in function, i.e. cannot identify the custom description information. Therefore, the embodiment of the application utilizes the RPC symbol preprocessor to perform secondary loading, so that the template engine can support the custom plug-in the custom RPC service.
Referring to fig. 6, fig. 6 is a schematic flowchart of generating an access stratum code according to an embodiment of the present application. As shown in fig. 6, it includes RPC symbol preprocessor 600, RPC built-in protocol description file set 601 and user protocol description file set 603. The RPC symbol preprocessor 600 is used for loading and analyzing description information, the RPC built-in protocol description file set 601 comprises built-in RPC description information 603 corresponding to an RPC system, and the user protocol description file set 603 comprises custom description information corresponding to a custom RPC service.
In the process of constructing the custom description information, because a composite structure and an extension are involved, in the embodiment of the application, the description information is analyzed in a way of establishing a symbol library. In addition, the syntax structure of the built-in RPC description information of the RPC system and the developer customized description information is the same.
Because the custom description information generally depends on the built-in RPC description information of the RPC system, before the RPC symbol preprocessor is used for loading and analyzing, the built-in RPC description information needs to be loaded first to analyze the built-in plug-in of the RPC system. Therefore, in the process of constructing the custom description information which can be identified by the template engine, the built-in RPC description is input to the RPC symbol preprocessor 600 (S601), the plug-ins and the dependency structures in the built-in RPC description information are analyzed by loading the built-in RPC description information, and the built-in RPC symbol library 604 with the built-in plug-ins is generated and output (S602). In this case, the RPC built-in plug-in may be used based on the built-in RPC symbol library, but does not support user-defined plug-ins.
In order to support the custom plug-in, the user custom description information needs to be constructed secondarily. Specifically, the generated built-in plug-in is input into the RPC symbol preprocessor 600(S603), the built-in RPC description information and the custom description information 605 are integrated together, and are input into the RPC symbol preprocessor 600 for analysis (S604), and a full RPC symbol library corresponding to the custom RPC service is generated and output (S605). The full RPC symbol library 606 extracts the plug-in part described by the user and all the resources that the plug-in depends on, including the built-in plug-ins and the custom plug-ins.
And in the process of accessing the user-defined RPC service by using the template engine, generating an access layer code corresponding to the user-defined RPC service by using the generated full RPC symbol library, the user-defined description information and the user-defined template. In practical application, the generated full-scale plug-in is input into the RPC symbol preprocessor 600(S606), the built-in RPC description information and the custom description information 605 are input again, and the RPC symbol preprocessor 600 processes the full-scale plug-in and the custom description information to output a full-scale RPC symbol library, where the full-scale plug-in (i.e., the built-in plug-in and the custom plug-in) is applied. The access layer code generated based on the method not only supports the built-in plug-in, but also supports the self-defined plug-in.
The custom template conforms to the interface specification of the unified RPC interface, so that the access layer code generated based on the custom template meets the access condition of the unified RPC interface corresponding to the RPC access layer code set, and the access layer code generated based on the custom description information supports the built-in plug-in and the custom plug-in, so that the access layer code is added into the RPC access layer code set, and the custom RPC service is accessed into the RPC system.
The access layer code generated based on the template engine supports the built-in plug-in and also supports the user-defined plug-in through secondary loading of the description information, so that the user-defined RPC service is accessed to the RPC system, and the expansibility of the RPC system is improved. Based on the method, in the process of constructing the RPC system framework, no matter a user-defined template is used, or some functional built-in modules provided by the RPC framework are used, the access layer codes can be generated in a module-based mode, and the purpose of accessing the RPC service to the RPC system is achieved.
For better understanding, the procedure of accessing the customized service to the RPC system is described below by taking the iTop service as the customized service as an example.
Because the iTop service only provides interface description in a document form, when the iTop service is accessed, the RPC system needs to write a custom template and custom description information, specifically referring to fig. 7 and 8, where fig. 7 is a schematic diagram of custom description information corresponding to the iTop service provided in the embodiment of the present application, where the schematic diagram includes a custom plug-in, and fig. 8 is a schematic diagram of a custom template corresponding to the iTop service provided in the embodiment of the present application. As shown in fig. 7 and 8, the user can perform a custom plug-in extension in the custom template to extend the functionality of the iTop service.
It should be noted that, during the process of accessing the RPC service, some interfaces related to RPC need to be injected for use by the template. The interfaces comprise tool class functions and name conversion functions of RPC composite specifications, and the interfaces are beneficial to unifying access of different external processes and SDKs and enabling a use form finally provided for RPC system users to be consistent. The usage form here can be changed according to the project framework flow change, such as the protocol model interface of a certain project used in the product test example.
In the application process, the user accesses the user-defined RPC service into the RPC system and expands the RPC system. In addition, the user can also use the RPC built-in template to access the built-in RPC service to the RPC system. Based on the foregoing, the static template engine can hardly dynamically expand the functions, and the template engine must be recompiled when the functions need to be added. In order to further improve the extension performance of the RPC system provided in the embodiment of the present application, in one possible implementation manner, the function corresponding to the built-in RPC service is extended by adding a code extension point in the built-in RPC template.
Because the code extension point can be used for extending the access layer code corresponding to the built-in RPC service, in the process of accessing the built-in RPC service to the RPC system, the access layer code can be extended at the code extension point of the built-in template corresponding to the built-in RPC service, and the function of the built-in RPC service is extended. In practical applications, the access stratum code may be added at the code extension point according to the actual demand increase, which is not limited herein. For better understanding, the built-in RPC service access RPC system is described below with reference to the drawings.
Taking a database service as an example, refer to fig. 9 and 10, where fig. 9 is a schematic diagram of RPC declaration corresponding to the database service provided in the embodiment of the present application, and fig. 10 is a schematic diagram of access layer code corresponding to the database service provided in the embodiment of the present application. As shown in fig. 9, the field with prefix tdr2pb in RPC declaration is the code extension point provided by the built-in template, which represents a generic type table, and the field ID in the structure for generating the automatic conversion of access layer code to protobuf is 1003.
Taking RPC between internal services of an RPC system as an example, refer to fig. 11, and fig. 11 is a schematic view of an access layer code corresponding to the RPC between services provided in the embodiment of the present application. And after the user provides the description information corresponding to the RPC between the services, generating an access layer code meeting the access condition, and adding the access layer code into an RPC access layer code set corresponding to the unified RPC interface. In addition, an empty task template may also be generated, and the user may fill the content according to the template, specifically refer to the template file identified by the arrow in fig. 11.
Taking the WebSocket service and the HTTP service as an example, after a user writes corresponding description information based on a template to specify a binding address and a protocol name of a Uniform Resource Identifier (URI) of the HTTP, a null task code is generated and automatically bound to a specified path, specifically referring to fig. 12, where fig. 12 is an access layer code diagram corresponding to the WebSocket and the HTTP service provided in the embodiment of the present application.
It should be noted that, in the process of constructing the RPC system, if all templates and description information are prepared, the corresponding relationship between each service and the RPC protocol and the template needs to be configured finally, and the configuration of the corresponding relationship may be manually edited or may be automatically generated by integrating into the construction system. The specific corresponding relationship configuration process is as follows:
Figure RE-GDA0003062814200000151
Figure RE-GDA0003062814200000161
in practical applications, the RPC service is configured according to the corresponding relationship between the service and the template and the description information, and moreover, there may be a plurality of RPC services, which is not limited herein, but is only one possible implementation manner.
Based on the above, by integrating the template engine, analyzing the description information and the RPC framework system, the high expandability of the RPC system is realized. And when the access mode is carried out on a plurality of external systems, the interface of the user layer or the client is unified. For example, if the openelement standard link tracking service is to be accessed, an openelement access layer code is generated based on the method for generating an access layer code provided by the embodiment, and then the access layer code is added into an RPC access layer code set corresponding to the RPC system, so that the link tracking service in the RPC system can be called through a uniform RPC interface corresponding to the RPC access layer code set, omission does not occur, and the reconstruction security is ensured.
It should be noted that, the method for generating an access layer code based on a template engine provided in the foregoing embodiments may also use a static template engine or a simple template to replace the access layer code, and provide a function with a specific access attribute, and may also implement a function supporting a user to define a plug-in, but there is a certain limitation in processing a complex logic function. In addition, the user-defined plug-in may be described by using a custom specification and a syntax, and the description information and the description of the plug-in may use protobuf, or may use other similar tools, which is not limited herein.
Aiming at the RPC service calling method provided by the embodiment, the embodiment of the application also provides an RPC service calling device. Referring to fig. 13a, fig. 13a is a schematic structural diagram of an RPC service invocation device according to an embodiment of the present application. As shown in fig. 13a, the RPC service calling apparatus 1300 includes a first obtaining unit 1301, a determining unit 1302, a second obtaining unit 1303, and a sending unit 1304:
the first obtaining unit 1301 is configured to obtain an RPC service call request through a unified RPC interface; the RPC service call request comprises a first identifier corresponding to a first RPC service in an RPC system;
the determining unit 1302 is configured to determine a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
the second obtaining unit 1303 is configured to obtain a first call result corresponding to the first RPC service according to the first access layer code;
the sending unit 1304 is configured to send the first call result through the unified RPC interface.
In a possible implementation manner, the apparatus further includes a third obtaining unit, a generating unit, and a joining unit:
the third acquisition unit is used for acquiring a target template corresponding to a target RPC service and target description information corresponding to the target template; the target description information is used for identifying configuration information for calling the target RPC service;
the generating unit is used for generating the target access layer code corresponding to the target RPC service according to the target template and the target description information; the target access layer code meets the access condition corresponding to the RPC access layer code set;
the adding unit is used for adding the target access layer code into the RPC access layer code set, and accessing the target RPC service into the RPC system.
In one possible implementation manner, the target RPC service is a custom RPC service, a target template corresponding to the custom RPC service is a custom template, and target description information corresponding to the custom RPC service is custom description information;
the generating unit is also used for generating a built-in RPC symbol library according to the built-in RPC description information corresponding to the RPC system; generating a full RPC symbol library corresponding to the custom service according to the custom description information, the built-in RPC description information and the built-in RPC symbol library;
and the generating unit is used for generating the target access layer code corresponding to the custom service according to the custom template, the custom description information and the full RPC symbol library.
In one possible implementation manner, the target RPC service is a built-in RPC service, the target template corresponding to the built-in RPC service is the built-in template corresponding to the unified RPC interface, the built-in template comprises a code extension point, and the code extension point is used for extending the access layer code corresponding to the built-in RPC service.
In a possible implementation manner, the generating unit is configured to:
rendering the target template to generate a template compiling intermediate result corresponding to the target template;
converting the target description information to generate a data layer code corresponding to the target description information;
and compiling an intermediate result and the data layer code according to the template to generate the target access layer code corresponding to the target RPC service.
In one possible implementation, the target RPC service includes: any one or more of database service, inter-service RPC, WebSocket service, HTTP service, iTop service, monitoring alarm, link tracking or proxy forwarding.
In addition, the embodiment of the application also provides a structural schematic diagram of another RPC service calling device. Referring to fig. 13b, fig. 13b is a schematic structural diagram of an RPC service invocation device according to an embodiment of the present application. As shown in fig. 13b, the RPC service invocation device 1310 includes a sending unit 1311 and an obtaining unit 1312:
the sending unit 1311 is configured to send the RPC service call request through the unified RPC interface, so that according to a first identifier corresponding to a first RPC service in the RPC system included in the RPC service call request, a first access layer code corresponding to the first identifier is determined from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
the obtaining unit 1312 is configured to obtain a first call result corresponding to the first RPC service through the unified RPC interface; the first call result is generated in accordance with the first access stratum code.
In one possible implementation manner, the apparatus further includes a generating unit and a joining unit:
the obtaining unit 1312 is further configured to obtain a target template corresponding to a target RPC service and target description information corresponding to the target template; the target description information is used for identifying configuration information for calling the target RPC service;
the generating unit is used for generating the target access layer code corresponding to the target RPC service according to the target template and the target description information; the target access layer code meets the access condition corresponding to the RPC access layer code set;
the adding unit is used for adding the target access layer code into the RPC access layer code set, and accessing the target RPC service into the RPC system.
In one possible implementation manner, the target RPC service is a custom RPC service, a target template corresponding to the custom RPC service is a custom template, and target description information corresponding to the custom RPC service is custom description information;
the generating unit is also used for generating a built-in RPC symbol library according to the built-in RPC description information corresponding to the RPC system; generating a full RPC symbol library corresponding to the custom service according to the custom description information, the built-in RPC description information and the built-in RPC symbol library;
and the generating unit is used for generating the target access layer code corresponding to the custom service according to the custom template, the custom description information and the full RPC symbol library.
In one possible implementation manner, the target RPC service is a built-in RPC service, the target template corresponding to the built-in RPC service is the built-in template corresponding to the unified RPC interface, the built-in template comprises a code extension point, and the code extension point is used for extending the access layer code corresponding to the built-in RPC service.
In a possible implementation manner, the generating unit is configured to:
rendering the target template to generate a template compiling intermediate result corresponding to the target template;
converting the target description information to generate a data layer code corresponding to the target description information;
and compiling an intermediate result and the data layer code according to the template to generate the target access layer code corresponding to the target RPC service.
In one possible implementation, the target RPC service includes: any one or more of database service, inter-service RPC, WebSocket service, HTTP service, iTop service, monitoring alarm, link tracking or proxy forwarding.
According to the RPC service calling device or system provided by the embodiment, the RPC service calling request acquired through the unified RPC interface determines the first access layer code corresponding to the first identifier from the RPC access layer code set corresponding to the unified RPC interface, then the first calling result corresponding to the first RPC service is generated according to the first access layer code, the first calling result is sent through the unified RPC interface, and calling of the first RPC service through the unified RPC interface is achieved. Since the set of RPC access layer codes corresponding to the unified RPC interface comprises at least a first access layer code and a second access layer code, the second access layer code corresponding to a second RPC service, and the first RPC service and the second RPC service are different types of RPC services, that is, by integrating the access layer codes corresponding to multiple RPC services into the RPC access layer set corresponding to the unified RPC interface, realizes that in the scene that the RPC system corresponding to the unified RPC interface is accessed to various RPC services, the unified call of the client to the plurality of RPC services (the first RPC service and/or the second RPC service) based on the unified RPC interface is realized, the number of the RPC interfaces required to be connected when the client calls the plurality of RPC services is reduced, the connection efficiency is improved while the connection process is simplified, and the user experience is also improved.
The embodiment of the present application further provides a computer device, and the computer device for RPC service invocation provided by the embodiment of the present application will be described in terms of hardware materialization.
Referring to fig. 14, fig. 14 is a schematic diagram of a server 1400 provided by an embodiment of the present application, which may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1422 (e.g., one or more processors) and a memory 1432, one or more storage media 1430 (e.g., one or more mass storage devices) for storing applications 1442 or data 1444. Memory 1432 and storage media 1430, among other things, may be transient or persistent storage. The program stored on storage medium 1430 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a server. Still further, a central processor 1422 may be disposed in communication with storage medium 1430 for executing a series of instruction operations on storage medium 1430 on server 1400.
The server 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input-output interfaces 1458, and/or one or more operating systems 1441, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The steps performed by the server in the above embodiment may be based on the server structure shown in fig. 14.
The CPU 1422 is configured to perform the following steps:
acquiring an RPC service call request through a unified RPC interface; the RPC service call request comprises a first identifier corresponding to a first RPC service in an RPC system;
determining a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
acquiring a first call result corresponding to a first RPC service according to the first access layer code;
and sending the first calling result through the unified RPC interface.
Or, the following steps are executed:
sending an RPC service call request through a unified RPC interface, so that according to a first identifier corresponding to a first RPC service in an RPC system included in the RPC service call request, a first access layer code corresponding to the first identifier is determined from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
acquiring a first call result corresponding to the first RPC service through the unified RPC interface; the first call result is generated in accordance with the first access stratum code.
Optionally, the CPU 1422 may further execute the RPC service call method provided in the foregoing embodiment, which is not described herein again.
For the above-described RPC service invocation method, the embodiment of the present application further provides a terminal device for RPC service invocation, so that the RPC service invocation method is implemented and applied in practice.
Referring to fig. 15, fig. 15 is a schematic structural diagram of a terminal device according to an embodiment of the present application. For convenience of explanation, only the parts related to the embodiments of the present application are shown, and details of the specific technology are not disclosed. The terminal device may be any terminal device including a mobile phone, a tablet computer, a Personal Digital Assistant (PDA for short), and the like, taking the terminal device as the mobile phone as an example:
fig. 15 is a block diagram illustrating a partial structure of a mobile phone related to a terminal device provided in an embodiment of the present application. Referring to fig. 15, the mobile phone includes: a Radio Frequency (RF) circuit 1510, a memory 1520, an input unit 1530, a display unit 1540, a sensor 1550, an audio circuit 1560, a wireless fidelity (WiFi) module 1570, a processor 1580, and a power supply 1590. Those skilled in the art will appreciate that the handset configuration shown in fig. 15 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 15:
the RF circuit 1510 may be configured to receive and transmit signals during information transmission and reception or during a call, and in particular, receive downlink information of a base station and then process the received downlink information to the processor 1580; in addition, the data for designing uplink is transmitted to the base station. In general, RF circuit 1510 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuit 1510 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), and the like.
The memory 1520 may be used to store software programs and modules, and the processor 1580 implements various functional applications and RPC service calls of the mobile phone by running the software programs and modules stored in the memory 1520. The memory 1520 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 1520 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The input unit 1530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 1530 may include a touch panel 1531 and other input devices 1532. The touch panel 1531, also referred to as a touch screen, can collect touch operations of a user (e.g., operations of the user on or near the touch panel 1531 using any suitable object or accessory such as a finger or a stylus) and drive corresponding connection devices according to a preset program. Alternatively, the touch panel 1531 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, and sends the touch point coordinates to the processor 1580, and can receive and execute commands sent by the processor 1580. In addition, the touch panel 1531 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 1530 may include other input devices 1532 in addition to the touch panel 1531. In particular, other input devices 1532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 1540 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The Display unit 1540 may include a Display panel 1541, and optionally, the Display panel 1541 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 1531 may cover the display panel 1541, and when the touch panel 1531 detects a touch operation on or near the touch panel 1531, the touch operation is transmitted to the processor 1580 to determine the type of the touch event, and then the processor 1580 provides a corresponding visual output on the display panel 1541 according to the type of the touch event. Although in fig. 15, the touch panel 1531 and the display panel 1541 are two separate components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 1531 and the display panel 1541 may be integrated to implement the input and output functions of the mobile phone.
The handset can also include at least one sensor 1550, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 1541 according to the brightness of ambient light and a proximity sensor that turns off the display panel 1541 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
Audio circuitry 1560, speaker 1561, and microphone 1562 may provide an audio interface between a user and a cell phone. The audio circuit 1560 may transmit the electrical signal converted from the received audio data to the speaker 1561, and convert the electrical signal into an audio signal by the speaker 1561 and output the audio signal; on the other hand, the microphone 1562 converts collected sound signals into electrical signals, which are received by the audio circuit 1560 and converted into audio data, which are processed by the audio data output processor 1580 and then passed through the RF circuit 1510 for transmission to, for example, another cellular phone, or for output to the memory 1520 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through a WiFi module 1570, and provides wireless broadband internet access for the user. Although fig. 15 shows WiFi module 1570, it is understood that it does not belong to the essential constitution of the handset and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 1580 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 1520 and calling data stored in the memory 1520, thereby integrally monitoring the mobile phone. Optionally, the processor 1580 may include one or more processing units; preferably, the processor 1580 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, and the like, and a modem processor, which mainly handles wireless communications. It is to be appreciated that the modem processor may not be integrated into the processor 1580.
The handset also includes a power supply 1590 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 1580 via a power management system to manage charging, discharging, and power consumption management functions via the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In an embodiment of the present application, the handset includes a memory 1520 that can store program code and transmit the program code to the processor.
The processor 1580 included in the mobile phone may execute the RPC service call method provided in the foregoing embodiment according to the instruction in the program code, which is not described herein again.
The embodiment of the present application further provides a computer-readable storage medium for storing a computer program, where the computer program is used to execute the RPC service calling method provided in the foregoing embodiment.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the RPC service call method provided in the various alternative implementations of the above aspects.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium may be at least one of the following media: various media that can store program codes, such as read-only memory (ROM), RAM, magnetic disk, or optical disk.
It should be noted that, in the present specification, all the embodiments are described in a progressive manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus and system embodiments, since they are substantially similar to the method embodiments, they are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described embodiments of the apparatus and system are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only one specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A Remote Procedure Call (RPC) service calling method, the method comprising:
acquiring an RPC service call request through a unified RPC interface; the RPC service call request comprises a first identifier corresponding to a first RPC service in an RPC system;
determining a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
acquiring a first call result corresponding to a first RPC service according to the first access layer code;
and sending the first calling result through the unified RPC interface.
2. The method of claim 1, further comprising:
acquiring a target template corresponding to a target RPC service and target description information corresponding to the target template; the target description information is used for identifying configuration information for calling the target RPC service;
generating the target access layer code corresponding to the target RPC service according to the target template and the target description information; the target access layer code meets the access condition corresponding to the RPC access layer code set;
and accessing the target RPC service to the RPC system by adding the target access layer code to the RPC access layer code set.
3. The method of claim 2, wherein the target RPC service is a custom RPC service, the target template corresponding to the custom RPC service is a custom template, and the target description information corresponding to the custom RPC service is custom description information.
4. The method of claim 3, further comprising:
generating a built-in RPC symbol library according to built-in RPC description information corresponding to the RPC system;
generating a full RPC symbol library corresponding to the custom service according to the custom description information, the built-in RPC description information and the built-in RPC symbol library;
the generating the target access layer code corresponding to the target RPC service according to the target template and the target description information comprises:
and generating the target access layer code corresponding to the custom service according to the custom template, the custom description information and the full RPC symbol library.
5. The method of claim 2, wherein the target RPC service is a built-in RPC service, and wherein the target template corresponding to the built-in RPC service is a built-in template corresponding to the unified RPC interface, and wherein the built-in template comprises a code extension point for extending an access layer code corresponding to the built-in RPC service.
6. The method of claim 2, wherein the generating the target access stratum code corresponding to the target RPC service according to the target template and the target description information comprises:
rendering the target template to generate a template compiling intermediate result corresponding to the target template;
converting the target description information to generate a data layer code corresponding to the target description information;
and compiling an intermediate result and the data layer code according to the template to generate the target access layer code corresponding to the target RPC service.
7. A Remote Procedure Call (RPC) service calling device is characterized by comprising a first acquisition unit, a determination unit, a second acquisition unit and a sending unit:
the first acquisition unit is used for acquiring an RPC service call request through a unified RPC interface; the RPC service call request comprises a first identifier corresponding to a first RPC service in an RPC system;
the determining unit is used for determining a first access layer code corresponding to the first identifier from an RPC access layer code set corresponding to the unified RPC interface; the set of RPC access layer codes comprises at least the first access layer code and a second access layer code; the second access layer code corresponds to a second RPC service in the RPC system; the first RPC service and the second RPC service are different types of RPC services;
the second obtaining unit is used for obtaining a first calling result corresponding to the first RPC service according to the first access layer code;
and the sending unit is used for sending the first calling result through the unified RPC interface.
8. The apparatus of claim 7, further comprising a third obtaining unit, a generating unit, and a joining unit:
the third acquisition unit is used for acquiring a target template corresponding to a target RPC service and target description information corresponding to the target template; the target description information is used for identifying configuration information for calling the target RPC service;
the generating unit is used for generating the target access layer code corresponding to the target RPC service according to the target template and the target description information; the target access layer code meets the access condition corresponding to the RPC access layer code set;
the adding unit is used for adding the target access layer code into the RPC access layer code set, and accessing the target RPC service into the RPC system.
9. A computer device, the computer device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of any of claims 1-6 according to instructions in the program code.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program for performing the method of any of claims 1-6.
CN202110187616.4A 2021-02-18 2021-02-18 Remote Procedure Call (RPC) service calling method and related device Active CN112965832B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110187616.4A CN112965832B (en) 2021-02-18 2021-02-18 Remote Procedure Call (RPC) service calling method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110187616.4A CN112965832B (en) 2021-02-18 2021-02-18 Remote Procedure Call (RPC) service calling method and related device

Publications (2)

Publication Number Publication Date
CN112965832A true CN112965832A (en) 2021-06-15
CN112965832B CN112965832B (en) 2023-09-26

Family

ID=76285003

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110187616.4A Active CN112965832B (en) 2021-02-18 2021-02-18 Remote Procedure Call (RPC) service calling method and related device

Country Status (1)

Country Link
CN (1) CN112965832B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114398179A (en) * 2022-01-14 2022-04-26 北京思明启创科技有限公司 Method and device for acquiring tracking identifier, server and storage medium
CN115509513A (en) * 2022-11-16 2022-12-23 深圳市明源云采购科技有限公司 GRPC service layer code generation method, device, equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216760A (en) * 2007-12-28 2008-07-09 北京方正国际软件***有限公司 Dynamic mapping interface calling system and method
US20130159965A1 (en) * 2003-10-24 2013-06-20 Microsoft Corporation Interface for a Computer Platform
CN109871289A (en) * 2019-02-01 2019-06-11 北京顺丰同城科技有限公司 A kind of remote procedure call service creation method and device
CN110300082A (en) * 2018-03-21 2019-10-01 腾讯科技(深圳)有限公司 A kind of interface creation method, device and storage medium
CN110705983A (en) * 2019-09-29 2020-01-17 腾讯科技(深圳)有限公司 Code scanning payment processing method, device, equipment and storage medium
CN111324343A (en) * 2020-02-20 2020-06-23 支付宝(杭州)信息技术有限公司 Code generation method and device
CN111597061A (en) * 2020-05-25 2020-08-28 瑞斯康达科技发展股份有限公司 Method and device for remote procedure call of client or server
CN111861140A (en) * 2020-06-28 2020-10-30 微民保险代理有限公司 Service processing method, device, storage medium and electronic device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130159965A1 (en) * 2003-10-24 2013-06-20 Microsoft Corporation Interface for a Computer Platform
CN101216760A (en) * 2007-12-28 2008-07-09 北京方正国际软件***有限公司 Dynamic mapping interface calling system and method
CN110300082A (en) * 2018-03-21 2019-10-01 腾讯科技(深圳)有限公司 A kind of interface creation method, device and storage medium
CN109871289A (en) * 2019-02-01 2019-06-11 北京顺丰同城科技有限公司 A kind of remote procedure call service creation method and device
CN110705983A (en) * 2019-09-29 2020-01-17 腾讯科技(深圳)有限公司 Code scanning payment processing method, device, equipment and storage medium
CN111324343A (en) * 2020-02-20 2020-06-23 支付宝(杭州)信息技术有限公司 Code generation method and device
CN111597061A (en) * 2020-05-25 2020-08-28 瑞斯康达科技发展股份有限公司 Method and device for remote procedure call of client or server
CN111861140A (en) * 2020-06-28 2020-10-30 微民保险代理有限公司 Service processing method, device, storage medium and electronic device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114398179A (en) * 2022-01-14 2022-04-26 北京思明启创科技有限公司 Method and device for acquiring tracking identifier, server and storage medium
CN114398179B (en) * 2022-01-14 2023-03-14 北京思明启创科技有限公司 Method and device for acquiring tracking identifier, server and storage medium
CN115509513A (en) * 2022-11-16 2022-12-23 深圳市明源云采购科技有限公司 GRPC service layer code generation method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112965832B (en) 2023-09-26

Similar Documents

Publication Publication Date Title
CN112532564B (en) Service calling method and device and electronic equipment
CN106970790B (en) Application program creating method, related equipment and system
CN108880867B (en) Network equipment data acquisition method and system
CN108989384B (en) Data processing method, multi-cloud management system and related equipment
WO2018077041A1 (en) Method and apparatus for running application
CN107908407B (en) Compiling method and device and terminal equipment
CN112148579B (en) User interface testing method and device
CN109977013B (en) Debugging information acquisition method, system and device
CN112965832B (en) Remote Procedure Call (RPC) service calling method and related device
CN109800030B (en) Application program running method and device and terminal
CN111723002A (en) Code debugging method and device, electronic equipment and storage medium
CN107277031A (en) A kind of Internet video method for down loading, device, storage medium and terminal
CN111125602B (en) Page construction method, device, equipment and storage medium
CN112000566B (en) Method and device for generating test cases
CN105095161B (en) Method and device for displaying rich text information
CN115269361A (en) Software development kit testing method and device and readable storage medium
CN106230919B (en) File uploading method and device
CN112650498A (en) Static library integration method and device, electronic equipment and storage medium
CN111857672A (en) Business development method, device, equipment and medium based on SQL configuration
CN111562910A (en) Packaging method and related equipment
CN109240986B (en) Log processing method and device and storage medium
CN114490307A (en) Unit testing method, device and storage medium
CN116028099A (en) Method for generating installation package, related device, equipment and storage medium
CN110309454B (en) Interface display method, device, equipment and storage medium
CN108717382B (en) JSON structure-based audio and video file processing method and device and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40045492

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant