Communication method, distributed system, electronic device and storage medium

The server returns the function type value to dynamically determine the service call order, which solves the problem that communication links and node orders are difficult to flexibly set in the prior art, simplifies the implementation of the requesting end and improves the flexibility of the communication link.

CN110618875BActive Publication Date: 2025-06-20BEIJING SANKUAI ONLINE TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201810641256.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-06-20
Publication Date
2025-06-20
Estimated Expiration
2038-06-20

AI Technical Summary

Technical Problem

In the prior art, in service calls between devices, communication links and node orders are difficult to flexibly set, and the requesting end needs to understand service details, resulting in complex implementation.

Method used

The server executes the currently requested function to obtain the next requested function and returns it to the requesting end in the form of a function type value. The requesting end generates the next service request based on the return value, thereby dynamically determining the service call order.

Benefits of technology

Decoupling of communication links and nodes is realized, allowing flexible settings of communication links, while reducing the dependence of the requesting end on service details, and simplifying the implementation of the requesting end.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110618875B_ABST
    Figure CN110618875B_ABST
Patent Text Reader

Abstract

The present invention provides a communication method, a distributed system, an electronic device, and a storage medium. The communication method of the requesting end includes: sending an i-th service request to a server, where the i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, and i is an integer greater than 0; and receiving a first return value sent by the server, where the first return value is a function type value obtained by encoding information for indicating the (i + 1)-th requested function, and the information for indicating the (i + 1)-th requested function is obtained by the server based on executing the i-th requested function using the parameters associated with the i-th requested function; generating an (i + 1)-th service request based on the first return value sent by the server. The method and device provided by the present invention can achieve functional communication.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] When a device needs to call the service of another device, the prior art uses RPC (Remote Procedure Call) technology to achieve it. Specifically, when device A requests a service from device B using RPC technology over a network, it needs to send a request to device B. After device B finishes the execution, it directly returns the execution result to device A. When multiple service calls are involved, generally, device A needs to set the order of communication nodes in the communication link (i.e., the order of service calls) in advance, and device A needs to understand the details of each service to achieve sequential service calls.

[0003] It can be seen that, on the one hand, due to the fact that the communication link and the order of communication nodes are determined in advance in the prior art solution, it is difficult to flexibly set the communication link. On the other hand, since the device requesting the service needs to understand the details of each service, the implementation of the device requesting the service is relatively complex. Summary of the Invention

[0004] The present invention aims to overcome the defects existing in the above related technologies, and provides a communication method, a distributed system, an electronic device and a storage medium, so as to at least overcome one or more problems caused by the limitations and defects of the related technologies to a certain extent.

[0005] According to one aspect of the present invention, there is provided a communication method for a request end, including:

[0006] Sending an i-th service request to a server end, where the i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0; and

[0007] Receiving a first return value sent by the server end, where the first return value is a function type value obtained by encoding the information for indicating the (i + 1)-th requested function, and the information for indicating the (i + 1)-th requested function is obtained by the server end executing the i-th requested function using the parameters associated with the i-th requested function;

[0008] Generating an (i + 1)-th service request based on the first return value sent by the server end.

[0009] According to another aspect of the present invention, there is also provided a communication method for a server end, including:

[0010] Receiving an i-th service request from a request end, where the i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0;

[0011] If, according to the i-th service request, the i-th requested function is executed using the parameters associated with the i-th requested function to obtain information for indicating the (i + 1)-th requested function, then the information for indicating the (i + 1)-th requested function is encoded to obtain a first return value, and the first return value is sent to the request side, where the first return value is a function type value.

[0012] According to another aspect of the present invention, there is also provided a communication method, including:

[0013] The request side sends an i-th service to the service side, and the i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0;

[0014] If the service side, according to the i-th service request, uses the parameters associated with the i-th requested function to execute the i-th requested function to obtain information for indicating the (i + 1)-th requested function, then the service side encodes the information for indicating the (i + 1)-th requested function to obtain a first return value and sends it to the request side, where the first return value is a function type value;

[0015] The request side receives the first return value sent by the service side,

[0016] The request side generates an (i + 1)-th service request based on the first return value sent by the service side.

[0017] According to another aspect of the present invention, there is also provided a distributed system, including:

[0018] A request side, including:

[0019] A sending module, configured to send an i-th service request to the service side, where the i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0;

[0020] A first receiving module, configured to receive the first return value sent by the service side, where the first return value is a function type value obtained by encoding the information for indicating the (i + 1)-th requested function, and the information for indicating the (i + 1)-th requested function is obtained by the service side using the parameters associated with the i-th requested function to execute the i-th requested function;

[0021] A generating module, configured to generate an (i + 1)-th

[0022] service request; and

[0023] A service side, including:

[0024] A second receiving module, configured to receive the i-th service request from a request end; and

[0025] An encoding module, if, according to the i-th service request, the i-th requested function is executed using a parameter associated with the i-th requested function to obtain information for indicating the (i + 1)-th requested function, then the encoding module is configured to: encode the information for indicating the (i + 1)-th requested function to obtain a first return value, and send the first return value to the request end, where the first return value is a function type value.

[0026] According to still another aspect of the present invention, there is also provided an electronic device, including: a processor; a storage medium, on which a computer program is stored, and when the computer program is run by the processor, the steps described above are executed.

[0027] According to still another aspect of the present invention, there is also provided a storage medium, on which a computer program is stored, and when the computer program is run by a processor, the steps described above are executed.

[0028] Compared with the prior art, the advantages of the present invention are as follows:

[0029] The server executes the currently requested function to obtain the next requested function, and returns the next requested function to the request end in the form of a function type value as a return value. The request end generates the next request according to the received return value in the form of a function type value. Thus, the execution order of the requested functions is not determined in advance, and accordingly, the communication order of the server for executing the requested functions is not determined in advance, thereby achieving decoupling of the communication link and the communication node, and further enabling flexible setting of the communication link. On the other hand, the request end does not need to understand the details of each requested function, thus simplifying the implementation of the request end. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] By referring to the drawings and describing its exemplary embodiments in detail, the above and other features and advantages of the present invention will become more apparent.

[0031] Figure 1 FIG. shows a flowchart of a communication method of a request end according to an embodiment of the present invention.

[0032] Figure 2 FIG. shows a flowchart of a communication method of a server according to an embodiment of the present invention.

[0033] Figure 3 FIG. shows a flowchart of a communication method according to an embodiment of the present invention.

[0034] Figure 4 FIG. shows a schematic diagram of a distributed system according to an embodiment of the present invention.

[0035] Figure 5 A timing diagram of a communication method according to an embodiment of the present invention is shown.

[0036] Figure 6 A schematic diagram of a computer-readable storage medium in an exemplary embodiment of the present invention is schematically shown.

[0037] Figure 7 A schematic diagram of an electronic device in an exemplary embodiment of the present invention is schematically shown. Detailed implementation manners

[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0039] In addition, the drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0040] The flowcharts shown in the drawings are merely illustrative and do not necessarily include all the steps. For example, some steps can be decomposed, while some steps can be combined or partially combined. Therefore, the actual execution order may be changed according to the actual situation.

[0041] Figure 1 A flowchart of the communication method of the requesting end according to an embodiment of the present invention is shown. Referring to Figure 1 , the communication method of the requesting end may include the following steps:

[0042] Step S110: Send the generated i-th service request to the server, where the i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, and i is an integer greater than 0; and

[0043] Step S120: Receive the first return value sent by the server in response to the i-th service request. The first return value is a function type value obtained by encoding information indicating the (i + 1)-th requested function, and the information indicating the (i + 1)-th requested function is obtained by the server executing the i-th requested function using the parameters associated with the i-th requested function.

[0044] Step S130: Generate the (i + 1)-th service request based on the first return value sent by the server in response to the i-th service request.

[0045] Wherein, when i is greater than 1, the i-th service request is generated according to the first return value sent by the server in response to the (i - 1)-th service request.

[0046] In the communication method of the request side in the exemplary embodiment of the present invention, the request side requests the server to execute the currently requested function to obtain the next requested function, and the server returns the next requested function to the request side in the form of a function type value. The request side generates the next service request according to the return value in the form of a function type value. Thus, the execution order of the requested functions is not determined in advance, and the communication order of the server executing the requested functions is not determined in advance, thereby realizing the decoupling of the communication link and the communication node and enabling the flexible setting of the communication link. On the other hand, the request side does not need to understand the details of each requested function, thus simplifying the implementation of the request side.

[0047] Specifically, in various embodiments of the present invention, the communication of the present invention transmits function information at runtime. The transmitted function type value includes a function flag bit, the name of the function, and the context associated with the function. The function flag bit can be used to identify that the currently transmitted value is a function type value. When the request side receives the return value, it can determine whether the return value is a function type value according to the function flag bit, and thus can perform different steps. The name of the function can be a globally unique identifier in the network. According to the name of the function, the address and / or access method or protocol of the function in the network can be obtained, and thus the function can be called. The context associated with the function can refer to the context data when the function runs. The context associated with the function can be called through implicit pointers such as this and self within the function body, or through function input parameters. Specifically, the "context" refers to a set of external variables or data objects that can be referenced or operated within the function. In the present invention, the "context" can be passed as a parameter into the function, that is, it can be agreed that the first parameter of the function is a reference to the "kernel object" and the "context".

[0048] Next, the functional communication method of the server in the exemplary embodiment of the present invention will be described.

[0049] Specifically, in various embodiments of the present invention, i starts from 1 and executes the above steps S110 to S130. The requesting end can determine whether to make the next call according to the current first return value or a pre-set calling rule. If the requesting end determines to make the next call, it assigns the value of i + 1 to i and continues to execute the above steps S110 to S130, and so on. In other words, after step S120 and before step S130, the requesting end can also determine whether to end the current function chaining call process according to the current first return value or a pre-set calling rule (such as a pre-set upper limit of i).

[0050] When i is equal to 1, that is, when the requesting end generates the first service request, the first requested function and the parameters associated with the first requested function are determined in advance. In some embodiments, the requesting end can directly use the service definition of the first requested function as the information indicating the first requested function. The service definition described in the present invention generally includes but is not limited to the network protocol of the function, the network address of the function, and the function interface parameters, etc. The service definition of the function can be obtained through the name of the function. In still other embodiments, the requesting end can obtain the service definition of the first requested function according to the name of the first requested function, convert the first requested function into a function object according to the service definition of the first requested function, and use the function object as the information indicating the first requested function. In other embodiments, the requesting end can set the context associated with the first requested function according to the name of the first requested function, and encode the name of the first requested function and the context associated with the first requested function to obtain a function type value, and use the function type value as the information indicating the first requested function. Further, in the first service request, it can be agreed that the parameter associated with the first requested function is a reference to the runtime context of the first requested function, and the first requested function accesses and operates on the context through this reference.

[0051] When the requesting end generates the (i + 1)-th service request, the service request is generated based on the first return value sent by the server in response to the i-th service request. In some embodiments, after the requesting end receives the first return value sent by the server in response to the i-th service request, the requesting end may decode the first return value (sent by the server in response to the i-th service request) into a function object of the (i + 1)-th requested function, as information for indicating the (i + 1)-th requested function. Specifically, the requesting end may implement the decoding of the first return value in the following manner: The requesting end first parses the first return value, obtains the function name of the (i + 1)-th requested function and the context associated with the (i + 1)-th requested function according to the first return value, constructs a function object of the (i + 1)-th requested function based on the function name of the (i + 1)-th requested function and the context associated with the (i + 1)-th requested function, and binds the context associated with the (i + 1)-th requested function. In still other embodiments, after the requesting end receives the first return value sent by the server in response to the i-th service request, the first return value sent by the server in response to the i-th service request may be directly used as information for indicating the (i + 1)-th requested function.

[0052] Further, in each of the above embodiments, the requesting end may also generate the (i + 1)-th service request according to the parameters associated with the (i + 1)-th requested function and the information for indicating the (i + 1)-th requested function. In some embodiments, the parameters associated with the (i + 1)-th requested function may be determined according to the (i + 1)-th requested function. In still other embodiments, the parameters associated with the i-th requested function may be predetermined by the requesting end.

[0053] Specifically, in some embodiments, after the requesting end receives the first return value sent by the server in response to the i-th service request, the (i + 1)-th service request may be directly generated according to the first return value. In still other embodiments, after the requesting end receives the first return value sent by the server in response to the i-th service request, the (i + 1)-th service request may be generated according to the first return value based on certain set triggering conditions. In the embodiments of the set triggering conditions, after the requesting end receives the first return value sent by the server in response to the (i - 1)-th service request, the first return value may be first decoded into a function object, and when the triggering conditions are met, the function object is reversely converted into information for indicating the i-th requested function (for example, in the form of a function type value). The sending of the service request may be executed immediately after the generation of the service request, or may be triggered by the set triggering conditions.

[0054] Further, multiple service requests sent by the requesting end can be sent to the same server. Preferably, multiple service requests sent by the requesting end can be sent to at least two different servers. In some embodiments, each server can execute different functions. In still other embodiments, multiple servers can execute the same function. In embodiments where multiple servers can execute the same function, the requesting end can select which server to send the service request to based on one or more of the performance metrics such as the communication bandwidth with the multiple servers, the performance of the multiple servers, the current CPU usage or memory usage of the multiple servers, and the storage throughput.

[0055] In each of the above embodiments, when the server obtains the execution result according to the service request, it can directly send the execution result as the second return value to the requesting end. When the requesting end receives the second return value, it no longer generates a service request until it obtains a new instruction to start regenerating the first service request. In still other embodiments, when the service request sent by the requesting end cannot be executed by the server, the server will send a special type of return value or not send a return value. When the requesting end receives the special type of return value or does not receive a return value within the set time threshold, an error is reported to check the service request sent by the requesting end.

[0056] Further, an embodiment of the present invention also provides a communication method for a server.

[0057] Figure 2 The flowchart of the communication method for the server according to an embodiment of the present invention is shown. Refer to Figure 2 , the communication method for the server may include the following steps:

[0058] Step S210: Receive the i-th service request from the requesting end, where the i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0; and

[0059] Step S220: If, according to the i-th service request, the i-th requested function is executed using the parameters associated with the i-th requested function to obtain information for indicating the (i + 1)-th requested function, then encode the information for indicating the (i + 1)-th requested function to obtain a first return value, and send the first return value to the requesting end, where the first return value is a function type value.

[0060] In the communication method of the server in the exemplary embodiment of the present invention, the next requested function is obtained by the server executing the currently requested function, and the next requested function is returned to the requesting end as a return value in the form of a function type value for the requesting end to generate the next service request. Thus, the execution order of the requested functions is not determined in advance, and accordingly, the communication order of the server executing the requested functions is not determined in advance, thereby achieving decoupling of the communication link and communication nodes and enabling flexible setting of the communication link. On the other hand, the requesting end does not need to understand the details of each requested function, thus simplifying the implementation of the requesting end.

[0061] Specifically, the function type value has the same meaning as the function type value in the description related to the requesting end, and will not be elaborated herein.

[0062] Next, the functional communication method of the server in the exemplary embodiment of the present invention will be described.

[0063] Specifically, according to the generation of service requests in different embodiments in the functional communication mode of the requesting end described above, the information for indicating the i-th requested function in step S210 may be any one of: the service definition of the i-th requested function, the function object of the i-th requested function, and the function type value including the name of the i-th requested function.

[0064] Specifically, the information for indicating the (i + 1)-th requested function obtained in step S220 may be: the service definition of the (i + 1)-th requested function or the function name of the (i + 1)-th requested function.

[0065] Furthermore, in various embodiments of the present invention, the step of encoding the information for indicating the (i + 1)-th requested function in step S220 to obtain the first return value may further include:

[0066] Setting a context associated with the (i + 1)-th requested function; and

[0067] Encoding according to the information for indicating the (i + 1)-th requested function and the context associated with the (i + 1)-th requested function to obtain the first return value.

[0068] According to the above steps, the first return value is made to conform to the definition of the function type value.

[0069] If, in the above step S220, according to the service request, the i-th requested function is executed using the parameters associated with the i-th requested function to obtain an execution result, the server can directly use the execution result as the second return value and send it to the requesting end. In some other embodiments, when the service request sent by the requesting end cannot be executed by the server, the server will send a special type of return value or not send a return value. When the requesting end receives the special type of return value or does not receive a return value within the set time threshold, an error is reported to check the service request sent by the requesting end.

[0070] Furthermore, an embodiment of the present invention also provides a communication method. Figure 3 The flowchart of the communication method according to an embodiment of the present invention is shown. Refer to Figure 3 The communication method may include the following steps:

[0071] Step S310: The requesting end sends the i-th service request to the server. The i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0;

[0072] Step S320: If the server, according to the i-th service request, uses the parameters associated with the i-th requested function to execute the i-th requested function and obtains information for indicating the (i + 1)-th requested function, the server encodes the information for indicating the (i + 1)-th requested function to obtain a first return value and sends it to the requesting end. The first return value is a function type value;

[0073] Step S330: The requesting end receives the first return value sent by the server in response to the i-th service request;

[0074] Step S340: The requesting end generates the (i + 1)-th service request based on the first return value sent by the server in response to the i-th service request

[0075] In the communication method of the exemplary embodiment of the present invention, the requesting end requests the server to execute the currently requested function to obtain the next requested function, and the server returns the next requested function to the requesting end in the form of a function type value. The requesting end generates the next service request according to the return value in the form of a function type value. Thus, the execution order of the requested functions is not determined in advance, and the communication order of the server for executing the requested functions is not determined in advance either. In this way, the communication link and communication nodes are decoupled, and the communication link can be flexibly set. On the other hand, the requesting end does not need to understand the details of each requested function, thus simplifying the implementation of the requesting end.

[0076] Specifically, the function type value is the same as the meaning of the function type value in the description of the request side, and will not be elaborated here.

[0077] Furthermore, an embodiment of the present invention also provides a distributed system.

[0078] Figure 4 The schematic diagram of the distributed system according to an embodiment of the present invention is shown. Refer to Figure 4 , the distributed system may include multiple network nodes (such as network node A410, network node B420, network node C430). In some embodiments, some of the multiple network nodes can be used only as request sides. In some other embodiments, some of the multiple network nodes can be used only as server sides. In yet some other embodiments, some of the multiple network nodes can be used both as request sides and server sides.

[0079] The network node that is only used as a request side (such as network node A410) includes a sending module 411 and a first receiving module 412.

[0080] The sending module 411 is used to send the generated i-th service request to the server side. The i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0.

[0081] The first receiving module 412 is used to receive the first return value sent by the server side in response to the i-th service request. The first return value is a function type value obtained by encoding the information for indicating the (i + 1)-th requested function, and the information for indicating the (i + 1)-th requested function is obtained by the server side executing the i-th requested function using the parameters associated with the i-th requested function.

[0082] The generating module 413 is used to generate the (i + 1)-th service request based on the first return value sent by the server side in response to the i-th service request.

[0083] The network node that is only used as a server side (such as network node B420) includes a second receiving module 421 and an encoding module 422.

[0084] The second receiving module 421 is used to receive the i-th service request from the request side.

[0085] If, according to the i-th service request, the i-th requested function is executed using the parameters associated with the i-th requested function, and information for indicating the (i + 1)-th requested function is obtained, then the encoding module 422 is configured to: encode the information for indicating the (i + 1)-th requested function to obtain a first return value, and send the first return value to the request side, where the first return value is a function type value.

[0086] The network node that can act as both a request side and a service side (such as network node C430) includes a sending module 411, a first receiving module 412, a generating module 413, a second receiving module 421, and an encoding module 422.

[0087] When network node C430 acts as the request side, the sending module 411, the first receiving module 412, and the generating module 413 operate. When network node C430 acts as the service side, the second receiving module 421 and the encoding module 422 operate.

[0088] Figure 4 Only one embodiment of the distributed system provided by the present invention is shown, and the present invention is not limited thereto. In various embodiments of the distributed system provided by the present invention, multiple requested functions may be distributed among different network nodes.

[0089] In the distributed system according to the exemplary embodiment of the present invention, the network node acting as the request side requests the network node acting as the service side to execute the currently requested function to obtain the next requested function, and the network node acting as the service side returns the next requested function in the form of a function type value to the network node acting as the request side. The network node acting as the request side generates the next service request according to the return value in the form of a function type value. Thus, the execution order of the requested functions is not determined in advance, and accordingly, the communication order of the network nodes executing the requested functions is not determined in advance, thereby achieving decoupling of the communication link and the network nodes in the communication and enabling flexible setting of the communication link. On the other hand, the request side does not need to know the details of each requested function, thus simplifying the implementation of the request side.

[0090] The following combines Figure 5 to describe a specific embodiment of the functional communication method provided by the present invention. Figure 5 A timing diagram of a communication method according to an embodiment of the present invention is shown. Figure 5 An interaction process among a request side 591, a service side A592, a service side B593, and a service side C594 is shown.

[0091] Step S501, the request side 591 obtains the service definition of function A.

[0092] Step S502: The requesting end 591 generates a function object of function A according to the service definition of function A.

[0093] Step S503: The requesting end 591 generates a first service request according to function A and the parameters associated with function A.

[0094] Step S504: The requesting end 591 sends the first service request to the server end A592.

[0095] Step S505: The server end A592 executes function A using the parameters associated with function A to obtain the service definition of function B.

[0096] Step S506: The server end A592 sets the context associated with function B as needed, determines the name of function B according to the service definition of function B, encodes the name of function B and the context of function B, and obtains a first return value of the function type value.

[0097] Step S507: The server end A592 sends the first return value to the requesting end 591.

[0098] Step S508: The requesting end 591 decodes the first return value sent by the server end A592 to generate a function object of function B. In some embodiments, step S508 can be omitted.

[0099] In a specific implementation, the system kernel of the requesting end 591 converts the first return value sent by the server end A592 into an executable function object in the following way:

[0100] Assume that the name of the first return value in the first return value in the form of a function type value is fnVal, and its structure is:

[0101] {functionName,context}, where context represents the context

[0102] Assume that the reference name of the system kernel is BND, and the method name for the system kernel to send a network message to the target function of the requesting end 591 is invoke, that is

[0103] a. BND.invoke(functionName, context, …params);

[0104] Then the function object is:

[0105] Fn’ = function(…params) {

[0106] return BND.invoke(fnVal.functionName, fnVal.context, …params)

[0107] }

[0108] Among them, params represents parameters.

[0109] In step S509, the requesting end 591 generates a second service request according to the function object of function B and the parameters associated with function B. The information used to indicate function B in this second service request can be a function type value in some embodiments. The parameters associated with function B can be dynamically generated according to the first return value sent by the server end A592 in some embodiments. In some other embodiments, the parameters associated with function B can be preset.

[0110] In step S510, the requesting end 591 sends the second service request to the server end B593.

[0111] In step S511, the server end B593 executes function B using the parameters associated with function B to obtain the service definition of function C.

[0112] In step S512, the server end B593 sets the context associated with function C as needed, determines the name of function C according to the service definition of function C, and encodes the name of function C and the context of function C into a first return value of a function type value.

[0113] In step S513, the server end B593 sends this first return value to the requesting end 591.

[0114] In step S514, the requesting end 591 decodes the first return value sent by the server end B593 to generate a function object of function C. In some embodiments, step S514 can be omitted.

[0115] In step S515, the requesting end 591 generates a third service request according to the function object of function C and the parameters associated with function C. The information used to indicate function C in this third service request can be a function type value in some embodiments. The parameters associated with function C can be dynamically generated according to the first return value sent by the server end B592 in some embodiments. In some other embodiments, the parameters associated with function C can be preset.

[0116] In step S516, the requesting end 591 sends the third service request to the server end C594.

[0117] In step S517, the server end C594 executes function C using the parameters associated with function C and obtains an execution result.

[0118] In step S518, the server end C594 directly uses the execution result as the second return value.

[0119] Step S519: The server C594 sends the second return value to the requestor 591.

[0120] Step S520: The requestor 591 obtains the execution result.

[0121] Thus, the function chaining communication can be achieved through the above steps, and the obtained execution result result:

[0122] result = Fn(...params1)(…params2)(…params3);

[0123] This execution result result is equivalent to:

[0124] Fn’ = Fn(…params1);

[0125] Fn” = Fn’(…params2);

[0126] result = Fn”(…params3);

[0127] Among them, Fn’ = Fn(…params1) is the function object of function A, and params1 is the parameter associated with function A; Fn” = Fn’(…params2) is the function object of function B, and params2 is the parameter associated with function B; result = Fn”(…params3) is the function object of function C, and params3 is the parameter associated with function C.

[0128] Figure 5 Only one embodiment of the present invention is schematically shown. Without departing from the concept of the present invention, various variations are within the protection scope of the present invention. For example, the above functions A, B, and C can be executed on the same server, and the above servers A592, B593, and C594 can all execute functions A, B, and C, which will not be elaborated here.

[0129] In an exemplary embodiment of the present invention, a computer-readable storage medium is further provided, on which a computer program is stored. When the program is executed by, for example, a processor, the steps of the electronic prescription transfer processing method described in any one of the above embodiments can be implemented. In some possible implementation manners, various aspects of the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above electronic prescription transfer processing method part of this specification.

[0130] Reference Figure 6As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described. It can be a portable compact disc read-only memory (CD-ROM) and includes program code, and can run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0131] The program product can adopt any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0132] The computer-readable storage medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium can also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium can be transmitted by any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the above.

[0133] The program code for performing the operations of the present invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the tenant computing device, partially on the tenant device, executed as an independent software package, partially on the tenant computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the tenant computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, by using an Internet service provider to connect through the Internet).

[0134] In an exemplary embodiment of the present invention, an electronic device is further provided. The electronic device may include a processor and a memory for storing executable instructions of the processor. Among them, the processor is configured to execute the steps of the electronic prescription circulation processing method described in any of the above embodiments by executing the executable instructions.

[0135] Those skilled in the art can understand that various aspects of the present invention can be implemented as a system, a method, or a program product. Therefore, various aspects of the present invention can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which can be collectively referred to as "circuit", "module", or "system" here.

[0136] The following refers to Figure 7 to describe the electronic device 600 according to this embodiment of the present invention. Figure 7 The electronic device 600 shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.

[0137] As Figure 7 shown, the electronic device 600 is presented in the form of a general-purpose computing device. The components of the electronic device 600 may include but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0138] Among them, the storage unit stores program code, and the program code can be executed by the processing unit 610, so that the processing unit 610 executes the steps according to various exemplary embodiments of the present invention described in the above-mentioned electronic prescription circulation processing method part of this specification. For example, the processing unit 610 can execute the steps shown in any of the figures such as Figures 1 to 3 shown.

[0139] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 6201 and / or a cache storage unit 6202, and may further include a read-only storage unit (ROM) 6203.

[0140] The storage unit 620 may further include a program / utilities 6204 having a set (at least one) of program modules 6205. Such program modules 6205 include but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment.

[0141] The bus 630 can represent one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of the various bus structures.

[0142] The electronic device 600 can also communicate with one or more external devices 700 (such as a keyboard, a pointing device, a Bluetooth device, etc.), can also communicate with one or more devices that enable a tenant to interact with the electronic device 600, and / or can communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (such as a router, a modem, etc.). Such communication can be carried out through the input / output (I / O) interface 650. Moreover, the electronic device 600 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 660. The network adapter 660 can communicate with other modules of the electronic device 600 through the bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0143] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or can be implemented by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above-mentioned electronic prescription circulation processing method according to the embodiments of the present invention.

[0144] Compared with the prior art, the advantages of the present invention are as follows:

[0145] By the server executing the currently requested function to obtain the next requested function, and returning the next requested function in the form of a function type value as a return value to the requesting end, the requesting end generates the next request according to the received return value in the form of a function type value. Thus, the execution order of the requested functions is not determined in advance, and thus the communication order of the server that executes the requested functions is not determined in advance, realizing the decoupling of the communication link and the communication nodes, and further enabling the flexible setting of the communication link. On the other hand, the requesting end does not need to understand the details of each requested function, thus simplifying the implementation of the requesting end.

[0146] Other embodiments of the present invention will be readily apparent to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following the general principles of the invention and including known common general knowledge or conventional technical means in the technical field not disclosed by the present invention. The specification and examples are to be considered as illustrative only, and the true scope and spirit of the invention are pointed out by the appended claims.

Claims

1. A communication method for a requesting end, characterized in that, including: sending an i-th service request to a server, where the i-th service request includes at least: information for indicating an i-th requested function, and parameters associated with the i-th requested function, and i is an integer greater than 0; and receiving a first return value sent by the server, where the first return value is a function type value obtained by encoding information for indicating an (i + 1)-th requested function, and the information for indicating the (i + 1)-th requested function is obtained by the server executing the i-th requested function using the parameters associated with the i-th requested function; generating an (i + 1)-th service request based on the first return value sent by the server, where the function type value includes the name of the function, the context associated with the function, and a function flag bit, before sending the first service request to the server, the requester does not limit the execution order of the requested functions and the communication order between the requester and the server of the requested functions.

2. The communication method for a requesting end according to claim 1, characterized in that, The generating an (i + 1)-th service request based on the first return value sent by the server includes: decoding the first return value sent by the server into a function object of the (i + 1)-th requested function, and using the function object of the (i + 1)-th requested function as the information for indicating the (i + 1)-th requested function.

3. The communication method for a requesting end according to claim 1, characterized in that, The generating an (i + 1)-th service request based on the first return value sent by the server includes: using the first return value sent by the server as the information for indicating the (i + 1)-th requested function.

4. The communication method for a requesting end according to claim 1, characterized in that, When i is equal to 1, using any one of the service definition of the first requested function, the function object of the first requested function, and the function type value including the name of the first requested function as the information for indicating the first requested function.

5. A communication method for a server end, characterized in that, including: receiving an i-th service request from a requester, where the i-th service request includes at least: information for indicating an i-th requested function, and parameters associated with the i-th requested function, and i is an integer greater than 0; if, according to the i-th service request, the i-th requested function is executed using the parameters associated with the i-th requested function to obtain information for indicating an (i + 1)-th requested function, then encoding the information for indicating the (i + 1)-th requested function to obtain a first return value, and sending the first return value to the requester, where the first return value is a function type value, where the function type value includes the name of the function, the context associated with the function, and a function flag bit, before receiving the first service request sent by the requester, the requester does not limit the execution order of the requested functions and the communication order between the requester and the server of the requested functions.

6. The communication method for a server end according to claim 5, characterized in that, The encoding the information for indicating the (i + 1)-th requested function to obtain a first return value further includes: setting a context associated with the (i + 1)-th requested function; and encoding the information for indicating the (i + 1)-th requested function and the context associated with the (i + 1)-th requested function to obtain the first return value.

7. The communication method for a server end according to claim 5 or 6, characterized in that, In the i-th service request, the information for indicating the i-th requested function is any one of the service definition of the i-th requested function, the function object of the i-th requested function, and the function type value including the name of the i-th requested function.

8. The communication method for a server end according to claim 5 or 6, characterized in that, If, according to the service request, the i-th requested function is executed using the parameters associated with the i-th requested function to obtain an execution result, the execution result is directly sent as the second return value to the request side.

9. A communication method, characterized in that, Including: The request side sends the i-th service request to the service side. The i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0; If the service side, according to the i-th service request, uses the parameters associated with the i-th requested function to execute the i-th requested function and obtains information for indicating the (i + 1)-th requested function, the service side encodes the information for indicating the (i + 1)-th requested function to obtain a first return value and sends it to the request side. The first return value is a function type value; The request side receives the first return value sent by the service side; The request side generates the (i + 1)-th service request based on the first return value sent by the service side, where the function type value includes the name of the function, the context associated with the function, and the function flag bit, Before the request side sends the first service request to the service side, the request side does not limit the execution order of the requested functions and the communication order between the request side and the service side of the requested functions.

10. The communication method according to claim 9, characterized in that, The multiple service requests generated by the request side are respectively sent to at least two different service sides.

11. A distributed system, characterized in that, Including: The request side includes: A sending module for sending the i-th service request to the service side. The i-th service request at least includes: information for indicating the i-th requested function, and parameters associated with the i-th requested function, where i is an integer greater than 0; A first receiving module for receiving the first return value sent by the service side. The first return value is a function type value obtained by encoding the information for indicating the (i + 1)-th requested function. The information for indicating the (i + 1)-th requested function is obtained by the service side using the parameters associated with the i-th requested function to execute the i-th requested function, A generating module for generating the (i + 1)-th service request based on the first return value sent by the service side; and The service side includes: A second receiving module for receiving the i-th service request from the request side; and an encoding module. If, according to the i-th service request, the i-th requested function is executed using the parameters associated with the i-th requested function to obtain information for indicating the (i + 1)-th requested function, the encoding module is used to: encode the information for indicating the (i + 1)-th requested function to obtain a first return value, and send the first return value to the request side. The first return value is a function type value, where the function type value includes the name of the function, the context associated with the function, and the function flag bit, Before the request side sends the first service request to the service side, the request side does not limit the execution order of the requested function and the communication order between the request side and the service side of the requested function.

12. An electronic device, characterized in that, The electronic device includes: a processor; a memory on which a computer program is stored, and when the computer program is run by the processor, it executes the method according to any one of claims 1 to 4 or the method according to any one of claims 5 to 8.

13. A storage medium, characterized in that, A computer program is stored on the storage medium, and when the computer program is run by a processor, it executes the method according to any one of claims 1 to 4 or the method according to any one of claims 5 to 8.

Citation Information

Patent Citations

  • Response communication method in application on on-line application platform and on-line application platform

    CN102693163A

  • Interface calling method, apparatus, and terminal

    CN104866383A

  • Remote process calling method, device and system

    CN106713238A