Remote calling method and device of service node, storage medium and electronic device

By automatically searching and calling multiple second service nodes within the preset range when the first service node cannot provide the target service, the target service node is remotely called to provide services, and the problem of insufficient flexibility in service call between devices in the prior art is solved, and efficient and flexible service call is achieved.

CN119854348APending Publication Date: 2025-04-18HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411843307.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In the existing RPC technology, service calls between devices are insufficient flexibility, and the flexibility problem of service calls between different devices cannot be effectively solved.

Method used

By automatically searching and calling a plurality of second service nodes that can provide the target service within the preset range when the first service node cannot provide the target service, the target service node is remotely called to provide the target service, and the service result returned by the target service node is received.

Benefits of technology

It realizes a flexible calling relationship between service nodes, and can dynamically select appropriate service nodes according to user needs, improving the efficiency and flexibility of service calls.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854348A_ABST
    Figure CN119854348A_ABST
Patent Text Reader

Abstract

The invention discloses a remote calling method of a service node, a storage medium and an electronic device, and relates to the technical field of smart home / smart home, and the remote calling method of the service node comprises the steps: receiving an external request instruction, and determining a target service indicated by the external request instruction; under the condition that the first service node cannot provide the target service, determining services which can be provided by a plurality of second service nodes in a preset range; under the condition of determining that a target service node capable of providing the target service exists in the plurality of second service nodes, remotely calling the target service node to provide the target service; and receiving a service result returned by the target service node. The service nodes can automatically search and call the service nodes capable of providing the target service in the preset range to provide the service when the local service cannot provide the target service, and the calling relationship between the service nodes is not fixed, so that the flexibility of service calling is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of service invocation, and in particular to a method, device, storage medium and electronic device for remotely invoking a service node. Background Art

[0002] With the development of science and technology, there are more and more devices in the Internet of Things. Different devices have different functions. For example, some devices can display pictures (such as TVs, electronic photo albums, refrigerators with screens, etc.), and some devices can play sounds (such as speakers, doorbells, etc.). In order to realize service interaction between different devices, Remote Procedure Call Protocol (RPC) technology has emerged.

[0003] In the related art, RPC technology is used to enable one device to remotely call another device through the network. The two devices act as a service caller and a service provider respectively, thereby realizing service interaction between the two devices.

[0004] However, the RPC technology in the related art lacks flexibility in service calling. Summary of the invention

[0005] The embodiments of the present invention provide a method and device for remotely calling a service node, a storage medium and an electronic device, so as to at least solve the problem of insufficient flexibility of service calling between different devices in the related art.

[0006] According to an embodiment of the present invention, a remote calling method of a service node is provided, which is applied to a first service node, and the method includes: receiving an external request instruction, and determining a target service indicated by the external request instruction; when the first service node cannot provide the target service, determining the services that can be provided by multiple second service nodes within a preset range respectively; when there is a target service node that can provide the target service among the multiple second service nodes, remotely calling the target service node to provide the target service; and receiving the service result returned by the target service node.

[0007] In an exemplary embodiment, determining the services that can be provided by multiple second service nodes within a preset range includes: searching for multiple second service nodes in a state of publishing services within the preset range; obtaining service information respectively published by the multiple second service nodes; parsing the service information respectively published by the multiple second service nodes to determine the services that can be provided by the multiple second service nodes.

[0008] In an exemplary embodiment, remotely calling a target service node to provide a target service includes: issuing an access request to the target service node to establish a connection with the target service node; encapsulating an external request instruction into a first data packet and sending it to the target service node to call the target service node to provide the target service; receiving a second data packet fed back by the target service node after processing the first data packet; and parsing the second data packet to obtain a service result returned by the target service node.

[0009] In an exemplary embodiment, the remote calling method of the service node also includes: after receiving a second data packet fed back by the target service node after processing the first data packet, disconnecting the connection with the target service node; and upon receiving the next external request instruction, determining a new target service node according to the next external request instruction.

[0010] In an exemplary embodiment, after determining the services that multiple second service nodes within a preset range can respectively provide, the remote calling method of the service node also includes: saving the service information corresponding to the multiple second service nodes respectively in a local database; when it is determined that the service information of the third service node has not been updated within a preset time period, deleting the service information of the third service node saved in the local database, wherein the third service node is one of the multiple second service nodes.

[0011] In an exemplary embodiment, after the service information corresponding to multiple second service nodes is saved in a local database, the remote calling method of the service node also includes: obtaining the service information published by multiple second service nodes within a preset range at preset time intervals; when the service information published by a fourth service node is obtained, determining whether the service information of the fourth service node is saved in the local database; when the service information of the fourth service node is not saved in the local database, adding the service information of the fourth service node to the local database; when the service information of the fourth service node is saved in the local database, updating the service information of the fourth service node saved in the local database according to the service information received from the fourth service node.

[0012] In an exemplary embodiment, the remote call method of the service node further includes: publishing service information of the first service node; upon receiving a remote call request from another node, providing corresponding services according to the remote call request and returning service results to the other node.

[0013] According to another embodiment of the embodiment of the present invention, a remote calling device of a service node is also provided, including: an instruction receiving module, used to receive an external request instruction and determine the target service indicated by the external request instruction; a service determination module, used to determine the services that can be provided by multiple second service nodes within a preset range when a first service node cannot provide the target service; a calling module, used to remotely call the target service node to provide the target service when it is determined that there is a target service node that can provide the target service among the multiple second service nodes; and a result receiving module, used to receive the service result returned by the target service node.

[0014] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the remote calling method of the service node when running.

[0015] According to another aspect of an embodiment of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the remote calling method of the service node through the computer program.

[0016] The above-mentioned remote calling method of the service node, when the first service node cannot provide the target service, when there is a target service node that can provide the target service among multiple second service nodes within a preset range, remotely calls the target service node to provide the target service, and finally receives the service result returned by the target service node. When the local service cannot provide the target service, the service node can automatically search and call the service node that can provide the target service within the preset range to provide the service, so that the calling relationship between the service nodes is not fixed, and the service node that can provide the target service can be remotely called according to the target service required by the user to meet the user's needs, which effectively improves the efficiency and flexibility of service calling. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0019] Figure 1is a schematic diagram of a hardware environment of an interaction method of a smart device according to an embodiment of the present application;

[0020] Figure 2 is a flowchart of a remote calling method of a service node according to an embodiment of the present invention;

[0021] Figure 3 is a flowchart of a method for determining services that can be provided by multiple second service nodes respectively according to an embodiment of the present invention;

[0022] Figure 4 is a flowchart of a method for remotely calling a target service node according to an embodiment of the present invention;

[0023] Figure 4a is a flow chart of an RPC process according to an embodiment of the present invention;

[0024] Figure 5 is a flowchart of a method for short connection calling according to an embodiment of the present invention;

[0025] Figure 6 is a flowchart of a method for storing and deleting service information of a service node according to an embodiment of the present invention;

[0026] Figure 7 is a flowchart of a method for adding and updating service information of a service node according to an embodiment of the present invention;

[0027] Figure 8 is a flow chart of a method for providing services according to an embodiment of the present invention;

[0028] Figure 8a is a schematic diagram of a distributed RPC system according to an embodiment of the present invention;

[0029] Fig. 9 The present invention is a structural block diagram of a remote calling device of a service node according to an embodiment of the present invention. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] According to one aspect of an embodiment of the present application, a remote calling method of a service node is provided. The remote calling method of the service node is widely used in smart home, smart home, smart home device ecology, smart residential (Intelligence House) ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the above-mentioned interaction method of smart home devices can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 104.

[0033] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.

[0034] In this embodiment, a remote calling method of a service node is provided, which is applied to the above terminal device. Figure 2 1 is a flowchart of a remote calling method of a service node according to an embodiment of the present invention, and the flow includes the following steps S200-S230:

[0035] Step S200: receiving an external request instruction and determining a target service indicated by the external request instruction.

[0036] Specifically, the first service node (i.e., the node receiving the request) needs to be able to process request instructions from the outside, which may come from an external control center or a user. The external request instruction usually includes an identifier of the target service (such as a service code or service name) and parameters required to call the service. For example, the instruction can be in the form of a message, including a target service code (svrcode) and service attributes (flags).

[0037] Specifically, the first service node parses the received external request instruction to identify the target service requested, and then queries the local service directory to determine whether the service code corresponds to the service that the first service node can provide. If the first service node can provide the target service, the local service can be directly called.

[0038] Step S210: when the first service node cannot provide the target service, determine the services that can be provided by a plurality of second service nodes within a preset range.

[0039] Specifically, if the first service node does not have the ability to provide the target service, the first service node starts to search for multiple surrounding second service nodes, among which there may be a service node that can provide the target service.

[0040] Exemplarily, the first service node starts a distributed search and discovery protocol and sends a service query request via broadcast, which includes a target service code (svrcode). After receiving the query request, the second service node within a preset range responds with an announcement message containing its service code and service attribute flags, which is sent via broadcast. The first service node collects and analyzes the responsive announcement message to determine which surrounding second service nodes can provide which services, as well as the attribute information of each service, such as the type of service, availability, etc. Through the distributed search and discovery mechanism, the first service node can quickly identify the nodes within a preset range that provide the target service, thereby improving the response speed of service requests and the overall flexibility of the system.

[0041] Step S220: when it is determined that there is a target service node that can provide the target service among the multiple second service nodes, remotely call the target service node to provide the target service.

[0042] Specifically, once a target service node that can provide the target service is identified from among the multiple second service nodes, the first service node remotely calls the target service node to provide the target service. When there are multiple target service nodes that can provide the target service, the first service node can remotely call any one or multiple of them, without limitation, as long as the target service can be provided for the first service node.

[0043] Step S230: receiving the service result returned by the target service node.

[0044] Specifically, after executing the target service, the target service node returns the service result to the first service node, and the first service node can present the service result. For example, a video doorbell captures a video outside the door, transmits the video outside the door to a TV near the user, and the TV plays and presents the video outside the door.

[0045] In this embodiment, when the first service node cannot provide the target service, if there is a target service node that can provide the target service among multiple second service nodes within a preset range, the target service node is remotely called to provide the target service, and finally the service result returned by the target service node is received. When the local service cannot provide the target service, the service node can automatically search and call the service node that can provide the target service within the preset range to provide the service, so that the calling relationship between the service nodes is not fixed, and the service node that can provide the target service can be remotely called to meet the user's needs according to the target service required by the user, which effectively improves the efficiency and flexibility of service calling.

[0046] In one embodiment, Figure 3 As shown, step S210, when the first service node cannot provide the target service, determines the services that can be provided by multiple second service nodes within a preset range. It includes: steps S300-S320, wherein:

[0047] Step S300: searching for a plurality of second service nodes in a state of publishing services within a preset range.

[0048] Specifically, the first service node can search and find service nodes in a state of publishing services within a preset range, and the searched service nodes serve as the second service nodes.

[0049] Step S310: Obtain service information published by multiple second service nodes respectively.

[0050] Specifically, during the search and discovery process, a plurality of second service nodes broadcast and publish service information, and the first service node can obtain the service information.

[0051] Step S320: parsing the service information respectively published by the plurality of second service nodes to determine the services that the plurality of second service nodes can respectively provide.

[0052] Specifically, after acquiring the service information, the first service node needs to parse the service information to determine the services that each second service node can provide.

[0053] In this embodiment, a second service node in a state of publishing services within a preset range is discovered through a broadcast search, so that the first service node can dynamically detect service providers in the surrounding environment without relying on the central service directory, which provides a basis for dynamic service calls and enhances the adaptability and robustness of the system. By obtaining service information published by multiple second service nodes respectively, the first service node can build a dynamic and updated service node directory. By accurately parsing the service information, the first service node can clearly understand the services that the second service nodes in the surrounding environment can provide, thereby facilitating accurate remote calls to service nodes.

[0054] In one embodiment, Figure 4 As shown, step S220, when it is determined that there is a target service node that can provide the target service among the multiple second service nodes, remotely call the target service node to provide the target service. It includes: steps S400-S410, wherein:

[0055] Step S400: sending an access request to a target service node to establish a connection with the target service node.

[0056] Specifically, after determining the target service node, the first service node needs to issue an access request to establish a communication connection with the target service node to prepare a network environment for subsequent data transmission and remote service invocation.

[0057] Step S410: encapsulate the external request instruction into a first data packet and send it to the target service node to call the target service node to provide the target service.

[0058] Step S230, receiving the service result returned by the target service node. It includes: Steps S420-S430, wherein:

[0059] Step S420: Receive a second data packet fed back by the target service node after processing the first data packet.

[0060] Step S430: parse the second data packet to obtain a service result returned by the target service node.

[0061] For example, the entire RPC process is as follows: Figure 4aAs shown, the first service node encapsulates the external request and sends it to the request-side stub. After receiving the external request, the request-side stub assembles it into a message body that can be transmitted over the network, and then transmits it to the server-side stub through the network. After receiving the message body, the server-side stub decodes it. The target service node calls the local service according to the decoding result, executes the target service and returns the service result to the server-side stub. The server-side stub packages the return result into a message and sends it to the request-side stub. The request-side stub receives the message, decodes it, and obtains the service result.

[0062] In this embodiment, through standardized data packet encapsulation and transmission, the format of service requests is unified and the network transmission is efficient, so that the first service node can accurately send the request to the target service node, and the target service node can correctly parse and execute the service, thereby improving the accuracy and efficiency of the service call. Similarly, the first service node can also receive the service results returned by the target service node, thereby realizing the remote call of the service node.

[0063] In one embodiment, Figure 5 As shown, the remote calling method of the service node also includes: steps S500-S510, wherein:

[0064] Step S500: After receiving a second data packet fed back by the target service node after processing the first data packet, disconnect the connection with the target service node.

[0065] Specifically, the first service node and the target service node will not establish a long connection and keep it alive, but will access the target service node and obtain services through a short connection when making a remote call. In the distributed RPC framework, the short connection mechanism is an important strategy to optimize the use of connection resources and improve efficiency. When the target service node completes the service call and returns the result, the first service node will actively disconnect to avoid unnecessary resource occupation.

[0066] Step S510: upon receiving the next external request instruction, determining a new target service node according to the next external request instruction.

[0067] Specifically, in a distributed environment, service requests may arrive continuously, and each request may need to call a different service node or a different service instance of the same service node. The first service node needs to be able to quickly identify and locate the new target service node according to the new request instruction and prepare for the next service call. Therefore, the target service node called by the first service node is not fixed and can be flexibly adjusted as needed.

[0068] In this embodiment, the short connection mechanism can significantly reduce the connection overhead in the distributed network, avoid the complexity and resource waste of long connection maintenance, especially in the scenario where the service call is frequent and the service execution time is short, it can effectively improve the response speed and processing capacity of the system. The dynamic service call mechanism enables the first service node to flexibly respond to continuous service requests from the outside, and by quickly identifying and locating the target service node, it can achieve seamless service calls, improve the overall response capability of the system and user experience.

[0069] In one embodiment, Figure 6 As shown, in step S210, when the first service node cannot provide the target service, after determining the services that can be provided by multiple second service nodes within a preset range, the remote calling method of the service node further includes: steps S600-S610, wherein:

[0070] Step S600: Save service information corresponding to a plurality of second service nodes respectively into a local database.

[0071] Specifically, the first service node identifies and collects service information provided by the second service nodes within a preset range, and then locally stores service information corresponding to the plurality of second service nodes.

[0072] Step S610: When it is determined that the service information of the third service node is not updated within a preset period of time, the service information of the third service node stored in the local database is deleted.

[0073] The third service node is one of the multiple second service nodes.

[0074] Specifically, in order to ensure the accuracy of service information and the reliability of service calls, the system needs to regularly clean up outdated service information, and the service information published by the node also needs to be regularly broadcast and updated in the network. Therefore, if the service announcement update of the third service node is not received within the preset time, the first service node will think that the node may be offline or the service is unavailable, and remove the information of the node from the local database.

[0075] For example, a survival countdown may be set for each service node directory entry. When the service node sends a service announcement, the countdown is reset to a preset maximum value. The local database periodically performs a cleanup task to check the survival countdown of each service node directory entry. If the countdown is zero or has expired, it is considered that the node has not updated the service information within the preset time period and may be offline or unreachable. Then the service information of the third service node is removed from the local database, and the service node directory is updated to ensure that the directory only contains active and service-providing node information.

[0076] In this embodiment, the service information corresponding to multiple second service nodes in the local database improves the flexibility and speed of service calls, and does not require a full network search for each call, which reduces the consumption of network bandwidth and enhances the responsiveness of the system. By dynamically updating the service information in the local database, the accuracy and real-time nature of the information during service calls are ensured, and invalid service call attempts are avoided, thereby improving the success rate of service calls and the overall performance of the system. In addition, the node aging mechanism helps to reduce the complexity of database maintenance and avoids the waste of resources caused by storing unavailable nodes.

[0077] In one embodiment, Figure 7 As shown, in step S600, after the service information corresponding to the plurality of second service nodes is saved in the local database, the remote calling method of the service node further includes: steps S700-S730, wherein:

[0078] Step S700: acquiring service information published by a plurality of second service nodes within a preset range at preset time intervals.

[0079] Specifically, in order to maintain the real-time and accuracy of the current node's information about surrounding service providers, it is necessary to periodically search and update the service information. The selection of the preset duration needs to consider the balance between the real-time nature of the information and the consumption of network resources.

[0080] Step S710: When the service information published by the fourth service node is obtained, it is determined whether the service information of the fourth service node is stored in the local database.

[0081] Specifically, the fourth service node is any node that may provide services within a preset range. When the first service node receives the service announcement of the fourth service node, it needs to check whether there is a service information record of the node in the local database.

[0082] Step S720: If the service information of the fourth service node is not saved in the local database, the service information of the fourth service node is added to the local database.

[0083] Specifically, if the record of the fourth service node is not found in the local database, it means that this is a new service provider, and the service information needs to be added to the local database for use in subsequent service requests.

[0084] Step S730: When the service information of the fourth service node is stored in the local database, the service information of the fourth service node stored in the local database is updated according to the received service information of the fourth service node.

[0085] Specifically, if the information of the fourth service node already exists in the local database, its record needs to be updated to reflect the latest service status or attribute change.

[0086] In this embodiment, the regular acquisition of service information ensures that the first service node can timely understand the latest status of the surrounding service nodes, enhances the system's adaptability to dynamic environments, and improves the accuracy and efficiency of service calls. By quickly querying the local database, repeated records of known service nodes are avoided, database storage space is saved, and the uniqueness and accuracy of database information are also guaranteed. The addition of new operations to the database enables the first service node to quickly record the newly discovered service node information, expands the scope of service calls, and improves the overall redundancy and reliability of the system. By updating the service information in the local database in real time, the efficiency and accuracy of service calls are achieved.

[0087] In one embodiment, Figure 8 As shown, the remote calling method of the service node also includes: steps S800-S810, wherein:

[0088] Step S800: publishing service information of the first service node.

[0089] Specifically, publishing service information allows the first service node to be discovered and used by surrounding nodes, ensuring that the service capabilities of the first service node can be known by other nodes in the network, thereby facilitating service requests and calls in a distributed environment.

[0090] Step S810, when receiving a remote call request from another node, providing corresponding services according to the remote call request and returning the service results to the other node.

[0091] Specifically, the first service node can not only discover and call services of surrounding nodes, but also receive remote call requests from other nodes as a service provider, execute local services according to these requests and return results, thus realizing distributed provision of services.

[0092] It should be noted that each service node can be a home appliance, and multiple service nodes constitute a distributed RPC network. Figure 8a As shown, multiple service nodes are included, and the calling and providing relationships between the multiple service nodes can be flexibly adjusted as needed. Each service node can only call services without publishing any service information, or only publish service information without calling services of other nodes, or can also publish service information and call services of other nodes at the same time.

[0093] In this embodiment, by publishing service information, the first service node can let other nodes know its service provision capabilities without relying on central service registration. By supporting the reception and response of remote call requests, the first service node can not only act as a service caller, but also participate in the distributed RPC network as a service provider, realizing the two-way flow of services and the sharing of resources. This mechanism enhances the overall collaboration capability of the system, enabling all nodes to provide services to other nodes in the network according to their service capabilities, thereby building a more efficient and flexible distributed service network.

[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.

[0095] Fig. 9 1 is a structural block diagram of a remote calling device of a service node according to an embodiment of the present invention. Fig. 9 As shown, including:

[0096] The instruction receiving module 901 is used to receive an external request instruction and determine a target service indicated by the external request instruction.

[0097] The service determination module 902 is used to determine the services that can be provided by multiple second service nodes within a preset range respectively when the first service node cannot provide the target service.

[0098] The calling module 903 is used to remotely call the target service node to provide the target service when it is determined that there is a target service node that can provide the target service among the multiple second service nodes.

[0099] The result receiving module 904 is used to receive the service result returned by the target service node.

[0100] Through the above device, when the first service node cannot provide the target service, when there is a target service node that can provide the target service among multiple second service nodes within a preset range, the target service node is remotely called to provide the target service, and finally the service result returned by the target service node is received. When the local service cannot provide the target service, the service node can automatically search and call the service node that can provide the target service within the preset range to provide the service, so that the calling relationship between the service nodes is not fixed, and the service node that can provide the target service can be remotely called according to the target service required by the user to meet the user's needs, which effectively improves the efficiency and flexibility of service calling.

[0101] In an exemplary embodiment, the service determination module 902 is used to search for multiple second service nodes in a state of publishing services within a preset range, obtain service information respectively published by the multiple second service nodes, parse the service information respectively published by the multiple second service nodes, and determine the services that the multiple second service nodes can provide respectively.

[0102] In an exemplary embodiment, the calling module 903 is used to send an access request to the target service node to establish a connection with the target service node. The external request instruction is encapsulated into a first data packet and sent to the target service node to call the target service node to provide the target service.

[0103] In an exemplary embodiment, the result receiving module 904 is used to receive a second data packet fed back by the target service node after processing the first data packet, and parse the second data packet to obtain a service result returned by the target service node.

[0104] In an exemplary embodiment, the above device further comprises:

[0105] The short connection module is used to disconnect the connection with the target service node after receiving the second data packet fed back by the target service node after processing the first data packet.

[0106] The node determination module is used to determine a new target service node according to the next external request instruction when receiving the next external request instruction.

[0107] In an exemplary embodiment, the above device further comprises:

[0108] The saving module is used to save the service information corresponding to the plurality of second service nodes respectively into a local database.

[0109] The deleting module is used to delete the service information of the third service node stored in the local database when it is determined that the service information of the third service node has not been updated within a preset period of time, wherein the third service node is one of the plurality of second service nodes.

[0110] In an exemplary embodiment, the above device further comprises:

[0111] The information acquisition module is used to acquire service information published by multiple second service nodes within a preset range at preset time intervals.

[0112] The storage determination module is used to determine whether the service information of the fourth service node is stored in the local database when the service information published by the fourth service node is acquired.

[0113] The new adding module is used to add the service information of the fourth service node in the local database when the service information of the fourth service node is not saved in the local database.

[0114] The updating module is configured to update the service information of the fourth service node stored in the local database according to the received service information of the fourth service node when the service information of the fourth service node is stored in the local database.

[0115] An embodiment of the present invention further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.

[0116] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:

[0117] S1, receiving an external request instruction and determining a target service indicated by the external request instruction.

[0118] S2: When the first service node cannot provide the target service, determine the services that can be provided by multiple second service nodes within a preset range.

[0119] S3: When it is determined that there is a target service node that can provide the target service among the multiple second service nodes, remotely call the target service node to provide the target service.

[0120] S4, receiving the service result returned by the target service node.

[0121] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0122] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0123] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0124] S1, receiving an external request instruction and determining a target service indicated by the external request instruction.

[0125] S2: When the first service node cannot provide the target service, determine the services that can be provided by multiple second service nodes within a preset range.

[0126] S3: When it is determined that there is a target service node that can provide the target service among the multiple second service nodes, remotely call the target service node to provide the target service.

[0127] S4, receiving the service result returned by the target service node.

[0128] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0129] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0130] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0131] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A remote calling method of a service node, characterized in that: Applied to a first service node, the method includes: Receiving an external request instruction, and determining a target service indicated by the external request instruction; In the case where the first service node cannot provide the target service, determining services that can be provided by multiple second service nodes within a preset range respectively; When it is determined that there is a target service node that can provide the target service among the plurality of second service nodes, remotely calling the target service node to provide the target service; Receive the service result returned by the target service node.

2. The remote calling method of a service node according to claim 1, characterized in that: The determining of the services that can be provided by the plurality of second service nodes within the preset range respectively includes: Searching for a plurality of second service nodes in the preset range that are in a state of publishing services; Acquire service information respectively published by the plurality of second service nodes; The service information respectively published by the plurality of second service nodes is parsed to determine the services that the plurality of second service nodes can respectively provide.

3. The remote calling method of a service node according to claim 1, characterized in that: The remotely calling the target service node to provide the target service includes: Sending an access request to the target service node to establish a connection with the target service node; encapsulating the external request instruction into a first data packet and sending it to the target service node to call the target service node to provide the target service; The receiving the service result returned by the target service node includes: Receive a second data packet fed back by the target service node after processing the first data packet; The second data packet is parsed to obtain a service result returned by the target service node.

4. The remote calling method of a service node according to claim 3, characterized in that: The method further comprises: After receiving a second data packet fed back by the target service node after processing the first data packet, disconnecting the connection with the target service node; When a next external request instruction is received, a new target service node is determined according to the next external request instruction.

5. The remote calling method of a service node according to any one of claims 1 to 4, characterized in that: After determining the services that can be provided by the plurality of second service nodes within the preset range, the method further includes: Saving the service information respectively corresponding to the plurality of second service nodes into a local database; When it is determined that the service information of the third service node is not updated within a preset period of time, the service information of the third service node stored in the local database is deleted, wherein the third service node is one of the plurality of second service nodes.

6. The remote calling method of the service node according to claim 5, characterized in that: After the service information respectively corresponding to the plurality of second service nodes is saved in the local database, the method further includes: Acquire service information published by multiple second service nodes within a preset range at preset intervals; In the case of acquiring the service information published by the fourth service node, determining whether the service information of the fourth service node is stored in the local database; If the service information of the fourth service node is not stored in the local database, adding the service information of the fourth service node to the local database; In a case where the service information of the fourth service node is stored in the local database, the service information of the fourth service node stored in the local database is updated according to the received service information of the fourth service node.

7. The remote calling method of a service node according to any one of claims 1 to 4, characterized in that: The method further comprises: Publishing service information of the first service node; When receiving a remote call request from another node, the corresponding service is provided according to the remote call request and the service result is returned to the other node.

8. A remote calling device for a service node, characterized in that: include: An instruction receiving module, used for receiving an external request instruction and determining a target service indicated by the external request instruction; A service determination module, used to determine the services that can be provided by multiple second service nodes within a preset range respectively when the first service node cannot provide the target service; a calling module, configured to, when it is determined that there is a target service node that can provide the target service among the plurality of second service nodes, remotely call the target service node to provide the target service; The result receiving module is used to receive the service result returned by the target service node.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.

Citation Information

Cited By

  • Execution result determination method and device, storage medium and electronic equipment

    CN121357246A