CN118055163A - Service calling method, device, electronic equipment and readable storage medium - Google Patents
Service calling method, device, electronic equipment and readable storage medium Download PDFInfo
- Publication number
- CN118055163A CN118055163A CN202410141346.7A CN202410141346A CN118055163A CN 118055163 A CN118055163 A CN 118055163A CN 202410141346 A CN202410141346 A CN 202410141346A CN 118055163 A CN118055163 A CN 118055163A
- Authority
- CN
- China
- Prior art keywords
- service
- grid
- configuration information
- registry
- list
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 88
- 238000012545 processing Methods 0.000 claims abstract description 101
- 230000008859 change Effects 0.000 claims description 6
- 230000006978 adaptation Effects 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 3
- 238000011161 development Methods 0.000 abstract description 11
- 238000010586 diagram Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 12
- 238000012423 maintenance Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 238000006243 chemical reaction Methods 0.000 description 4
- 230000003993 interaction Effects 0.000 description 4
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000004083 survival effect Effects 0.000 description 2
- 241000412611 Consul Species 0.000 description 1
- 239000000853 adhesive Substances 0.000 description 1
- 230000001070 adhesive effect Effects 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 239000003292 glue Substances 0.000 description 1
- 230000003862 health status Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
- H04L67/63—Routing a service request depending on the request content or context
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/2866—Architectures; Arrangements
- H04L67/30—Profiles
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/51—Discovery or management thereof, e.g. service location protocol [SLP] or web services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
- H04L69/085—Protocols for interworking; Protocol conversion specially adapted for interworking of IP-based networks with other networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a service calling method, a service calling device, electronic equipment and a readable storage medium, and belongs to the field of data processing. The service calling method comprises the following steps: invoking a service discovery interface of a control surface of the service grid to obtain a grid service list, wherein the grid service list comprises configuration information of grid services provided by the service grid application; and transmitting the grid service list to a service consumption end of the registry so that the service consumption end is used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry, wherein the non-grid service is a service provided by a non-service grid application. The application improves the development efficiency of the application program.
Description
Technical Field
The application belongs to the field of data processing, and particularly relates to a service calling method, a device, electronic equipment and a readable storage medium.
Background
Currently, micro-service technology and service grid technology have become mainstream trends in the development of application programs. Under micro-service technology, individual functions provided by applications are allowed to be independently developed and deployed in terms of independent services. The service grid technology provides a powerful network infrastructure for managing communications, load balancing, fault recovery, security authentication, etc. among multiple independent services. However, there are also many problems in practical applications between micro-service technology and service grid technology.
Under current micro-service architecture, each individual service typically uses a registry for service registration and discovery. The registry is a centralized service component for managing and maintaining instance information of individual services, including specifically access addresses, health status, metadata, etc. of individual services. In order to facilitate better management and support of each independent service, a service grid is generally applied under the micro service framework at present, so that the service grid is utilized to provide network basic functions for each independent service.
However, the current registry cannot manage the service network, so that the invocation between the non-grid service (i.e. the independent service) and the grid service under the micro-service architecture depends on manual configuration, thereby improving the operation and maintenance cost and reducing the development efficiency of the application program.
Disclosure of Invention
The service calling method, the device, the electronic equipment and the readable storage medium provided by the embodiment of the application can solve the problem that the service calling between the non-grid service and the grid service depends on manual configuration to a certain extent.
In a first aspect, a service invocation method is provided, applied to a relay component of a service processing system, where a registry, a non-service grid application, a service grid application, and the relay component in the service processing system are deployed in the same cluster environment, and the method further includes:
Invoking a service discovery interface of a control surface of the service grid to obtain a grid service list, wherein the grid service list comprises configuration information of grid services provided by the service grid application;
and transmitting the grid service list to a service consumption end of the registry so that the service consumption end is used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry, wherein the non-grid service is a service provided by a non-service grid application.
Optionally, the method further comprises:
acquiring a non-grid service list of the registry, wherein the non-grid service list comprises configuration information of all non-grid services registered in the registry;
Combining the non-grid service list and the grid service list to generate a first service list;
the transmitting the grid service list to the service consumer of the registry includes: and directly transmitting the first service list to the service consumption terminal, wherein the first service list is used for the service consumption terminal to call the service corresponding to the configuration information recorded by the first service list.
Optionally, the method further comprises:
intercepting a call request of a first service to be called, which is sent by a service consumption center of the registry according to the configuration information;
executing non-grid service calling processing under the condition that the first service to be called is the non-grid service, and returning a processing result to the service consumption terminal;
and executing grid service calling processing under the condition that the first service to be called is determined to be the grid service, and returning a processing result to the service consumption terminal.
Optionally, the first service list further includes a service type identifier of a service corresponding to the configuration information; the first service list is used for the service consumption end to execute non-grid service calling processing according to the configuration information of the first service to be called when the first service to be called is determined to be the non-grid service, and execute grid service calling processing according to the configuration information of the first service to be called when the first service to be called is determined to be the grid service.
Optionally, the method further comprises:
Registering the configuration information of the grid service in the registry so that the registry generates a second service list, wherein the second service list comprises the configuration information of all non-grid services registered in the registry and the configuration information of the grid service, and the second service list is used for the service consumer to call the service corresponding to the configuration information recorded by the second service list.
Optionally, the method further comprises:
Writing the configuration information of the non-grid service of the registry into a cluster management component of the cluster environment, so that the control plane issues the configuration information of the non-grid service to a service consumption terminal of the service grid under the condition that the configuration information of the non-grid service is written into the cluster management component, and the configuration information of the non-grid service is used for the service consumption terminal of the service grid to call the non-grid service.
Optionally, the cluster environment is a Kubernetes cluster environment, and the writing the configuration information of the non-grid service of the registry into a cluster management component of the cluster environment includes:
Converting the configuration information of the non-grid service into SERVICEENTRY-format configuration information, writing into kube-apiserver components of the cluster management component,
The kube-apiserver component is monitored by a cloud native service gateway of the service grid, and the cloud native service gateway is configured to perform format adaptation processing on the SERVICEENTRY format configuration information to obtain target format configuration information when the cloud native service gateway monitors that the SERVICEENTRY format configuration information is written in the kube-apiserver component, and send the target format configuration information to a service consumer of the service grid, where the target format configuration information is used for the service consumer of the service grid to call the non-grid service.
Optionally, the cloud native service gateway is further configured to issue a service type identifier of the configuration information to a service consumer of the service grid;
the service consumption end of the service grid is used for executing non-grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be the non-grid service;
And the service consumption end of the service grid is also used for executing grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be the grid service.
Optionally, writing configuration information of the non-grid service of the registry into a cluster management component of the cluster environment includes:
Writing configuration information of the non-grid services of the registry into a cluster management component of the cluster environment at a target opportunity, the target opportunity comprising: the method comprises the steps of connecting to the registry for the first time, detecting a configuration information change event of the registry, and meeting the update time of the non-grid service list.
In a second aspect, a service invocation method is provided, applied to a service consumer end of a registry, where the registry runs in a service processing system, and a registry, a relay component, a non-service grid application, a service grid and a service grid application in the service processing system are deployed in the same cluster environment, and the method further includes:
Acquiring a non-grid service list of the registry and a grid service list transmitted by the relay component, wherein the non-grid service list comprises configuration information of all non-grid services registered in the registry, the non-grid services are services provided by non-service grid applications, the grid service list comprises configuration information of grid services provided by the service grid applications in the service grid, and the grid service list is data acquired by the relay component calling a service discovery interface of a control surface of the service grid;
under the condition that the grid service is to be called, calling the grid service according to the configuration information of the grid service;
and calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
In a third aspect, a service calling method is provided and applied to a service consumption end of a service grid, the service grid is operated in a service processing system, a registration center, a relay component, a non-service grid application, the service grid and the service grid application in the service processing system are deployed in the same cluster environment, and a cluster management component of the cluster environment is also operated in the cluster environment; the method further comprises the steps of:
And receiving the configuration information of the non-grid service, which is issued under the condition that the control surface of the service grid monitors the configuration information of the non-grid service written in the cluster management component, wherein the configuration information of the non-grid service is the data written in the cluster management component by the relay component under the condition that the relay component acquires the configuration information of all the non-grid services registered in the registry from the registry. The non-grid service is a service provided by the non-service grid application;
and calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
In a fourth aspect, a service invocation apparatus is provided, which is applied to a relay component of a service processing system, where a registry, a non-service grid application, a service grid application, and the relay component are deployed in the same cluster environment, and the apparatus further includes:
The acquisition module is used for calling a service discovery interface of the control surface of the service grid to acquire a grid service list, wherein the grid service list comprises configuration information of grid services provided by the service grid application;
And the sending module is used for transmitting the grid service list to a service consumption end of the registry so that the service consumption end can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry, wherein the non-grid service is a service provided by the non-service grid application.
In a fifth aspect, a service invocation apparatus is provided, where the service invocation apparatus is applied to a service consumption end of a registry, where the registry runs in a service processing system, and a registry, a relay component, a non-service grid application, a service grid, and a service grid application in the service processing system are deployed in the same cluster environment, where the apparatus further includes:
the system comprises an acquisition module, a relay component and a relay component, wherein the acquisition module is used for acquiring a non-grid service list of the registry and a grid service list transmitted by the relay component, the non-grid service list comprises configuration information of all non-grid services registered in the registry, the non-grid services are services provided by non-service grid applications, the grid service list comprises configuration information of grid services provided by the service grid applications in the service grid, and the grid service list is data acquired by the relay component calling a service discovery interface of a control surface of the service grid;
The calling module is used for calling the grid service according to the configuration information of the grid service under the condition that the grid service is to be called; and the non-grid service is also used for calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
In a sixth aspect, a service calling device is provided and applied to a service consumption end of a service grid, the service grid is operated in a service processing system, a registration center, a relay component, a non-service grid application, the service grid and the service grid application in the service processing system are deployed in the same cluster environment, and a cluster management component of the cluster environment is also operated in the cluster environment; the apparatus further comprises:
and the receiving module is used for receiving the configuration information of the non-grid service which is issued when the control surface of the service grid monitors the configuration information of the non-grid service written in the cluster management assembly, wherein the configuration information of the non-grid service is data written in the cluster management assembly when the relay assembly acquires the configuration information of all the non-grid services registered in the registry from the registry. The non-grid service is a service provided by the non-service grid application;
And the calling module is used for calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
In a seventh aspect, there is provided an electronic device comprising: a processor and a memory; the memory is used for storing a computer program; the processor being configured to implement the method steps according to any one of the first aspect when executing the program stored on the memory; or performing the method steps of any of the second aspects; or to carry out the method steps of any of the third aspects.
In an eighth aspect, there is provided a readable storage medium having stored thereon a program or instructions which when executed by a processor performs the method steps of any of the first aspects; or performing the method steps of any of the second aspects; or to carry out the method steps of any of the third aspects.
The service calling method provided by the embodiment of the application is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
Drawings
FIG. 1 is one of the block diagrams of a service processing system provided by an embodiment of the present application;
FIG. 2 is a second flowchart of a service invocation method according to an embodiment of the present application;
FIG. 3 is a third flowchart of a service invocation method provided by an embodiment of the present application;
FIG. 4 is a fourth flowchart of a service invocation method provided by an embodiment of the present application;
FIG. 5 is one of the schematic diagrams of the service invocation method provided by the embodiment of the present application;
FIG. 6 is a second schematic diagram of a service invocation method according to an embodiment of the present application;
FIG. 7 is a fifth flowchart of a service invocation method provided by an embodiment of the present application;
FIG. 8 is a flowchart of a service invocation method provided by an embodiment of the present application;
FIG. 9 is one of the block diagrams of the service invocation apparatus provided by the embodiment of the present application;
FIG. 10 is a second block diagram of a service invocation apparatus according to an embodiment of the present application;
FIG. 11 is a third block diagram of a service invocation apparatus provided by an embodiment of the present application;
Fig. 12 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The service calling method, the device and the electronic equipment provided by the embodiment of the application are described in detail through specific embodiments and application scenes thereof with reference to the accompanying drawings.
Referring to fig. 1, a block diagram of a service processing system according to an embodiment of the present application is shown. As shown in fig. 1, the service processing system 10 includes: relay component 101, registry 102, service grid 103, non-service grid application 104, service grid application 105. The relay component 101, the registry 102, the service grid 103, the non-service grid application 104, and the service grid application 105 are deployed in the same cluster environment. Alternatively, the cluster environment may be a Kubernetes cluster environment, abbreviated as K8s.
The service grid 103 is divided into a control plane and a data plane. A plurality of application gateways and service grid applications 105 are deployed on the data plane in a one-to-one correspondence. A corresponding application gateway and service grid application 105 is deployed in the same Pod of the data plane. The application gateway is used to hijack the inbound traffic of the service grid application 105. Pod refers to the smallest deployable unit that can be created and managed in a Kubernetes cluster environment. The application gateway may be Envoy.
The control plane is provided with a cloud native service gateway. The cloud native service gateway is used for managing the service grid, and can realize control, safety protection and construction of observability of service grid flow. The cloud native service gateway is used for separating service management capability and business logic capability of the service gateway and has the capability of multi-language interaction. The unified service grid connection, safety guarantee, management and monitoring mode is provided. The cloud native service gateway may be Istio. Istio and Envoy communicate via xDS protocol. It should be noted that the service grid application may serve as a service provider of the service grid, and provide grid services for the service grid. Of course, the service grid application may also act as a service consumer of the service grid to invoke the grid services provided by the service grid.
The non-service grid application 104 is deployed under a micro-service framework, which may provide non-grid services. For example, the non-service grid application 104 may be a Spring Cloud micro-service application. Non-service grid application 104 may act as a service provider for the registry to register non-grid services it provides with the registry so that service consumers of the registry invoke the non-grid services. For example, the non-service grid application 104 will register with the registry via a software development kit (Software Development Kit, SDK) to complete registration of the non-grid services.
Of course, non-service grid application 104 may also act as a service consumer to the registry to invoke services registered with the registry. Alternatively, the registry may be of a variety of types, including but not limited to: consul, nacos, zookeeper, eureka, etc.
The relay component, also called service grid glue adhesive device 101, can be connected with a service grid and a registry, and is used as a bridge to realize the call of non-grid service to grid service through the service call method provided by the embodiment of the application. Of course, in an alternative implementation, the relay component 101 may also be used as a "bridge" to implement the invocation of the non-grid service by the grid service, and ensure seamless connection between the grid service and the non-grid service, as described in detail below. Alternatively, the relay component 101 may be a separate electronic device included with the service processing system 10. Or the relay component 101 may be a component running in the service processing system 10, etc.
Referring to fig. 2, a flowchart of a service calling method according to an embodiment of the application is shown. The service invocation method may be applied to the service processing system 10 shown in fig. 1. As shown in fig. 2, the service invocation method includes:
Step 201, the relay component invokes a service discovery interface of a control plane of the service grid to obtain a grid service list. The grid services list includes configuration information for the grid services provided by the service grid application.
Optionally, the relay component may obtain the grid services list through a service discovery interface of a cloud native services gateway on the control plane. The grid services list, also known as an instance list of grid services, includes configuration information for the grid services provided by the service grid application within the services grid. The configuration information of the grid service indicates a call address of the grid service, which is used to call the grid service. Illustratively, the configuration information may include: service name of the grid service, port name of the grid service port, port IP address, port number and other information of the grid service port. Grid services ports refer to ports that provide grid services.
It should be noted that, in some embodiments, the relay component may obtain the grid service list for the first time after starting. And then, the relay component can acquire the grid service list again when detecting that the grid service is changed, or periodically acquire the grid service list again so as to ensure that the latest configuration information of the grid service is transmitted to a service message end of the registry.
Step 202, the relay component transmits the grid service list to the service consumer end of the registry, so that the service consumer end of the registry is used for calling the grid service according to the configuration information of the grid service, and calling the non-grid service according to the configuration information of the non-grid service registered in the registry.
Optionally, the relay component may adapt the registration center after start-up to establish a connection with the registration intermediary. After the relay component acquires the grid service list, the relay component transmits the grid service list to a service consumer end of the registry so that the service consumer end can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. In some embodiments of the present application, the service consumer of the registry may be a non-grid service application registered with the registry. In this case, the non-grid services provided by the non-grid service application may also invoke the grid services.
In the embodiment of the present application, two modes of transmitting the grid service list to the service consumer end of the registry by the relay component are described in the following order.
In an alternative implementation, the relay component may have the same functionality as the registry. Based on this, the service invocation method further includes the following steps 001 and 002.
In step 001, a non-grid services list of the registry is obtained. The non-grid services list includes configuration information for all non-grid services registered with the registry.
Optionally, after the relay component is started, the registration center may be adapted, the adapted configuration of the registration center is loaded, and the non-grid service list of the registration center is pulled, so as to obtain the non-grid service list. The non-grid services list, also called service configuration list, includes configuration information of all non-grid services registered with the registry. Wherein the configuration information of the non-grid service indicates a call address of the non-grid service, which is used to call the non-grid service. Illustratively, the configuration information may include: service name of non-grid service, port name of non-grid service port, port IP address and port number of non-grid service port, etc. A non-mesh service port refers to a port that provides non-mesh services.
In this implementation, after loading the configuration of the adapted registry, the relay component may take over functions of authentication, authorization, traffic management, policy mechanism, etc. of the registry, and endow the application registered in the registry with meshing capability.
It should also be noted that in some embodiments, the relay component may first obtain the non-grid service list after startup. And then, the relay component can acquire the non-grid service list again when detecting the configuration information change event of the registry, or acquire the non-grid service list again when meeting the update time of the non-grid service list according to the update period of the non-grid service list so as to ensure that the latest configuration information of the non-grid service is transmitted to the service message end of the registry.
In step 002, the non-grid service list and the grid service list are combined to generate a first service list.
In the embodiment of the application, the first service list is obtained by combining the non-grid service list and the grid service list. The first service list includes configuration information of non-grid services registered by the registry and configuration information of grid services provided by the service grid. The grid service provided by the service grid may also be understood as a grid service registered with the service grid.
Illustratively, the non-grid services list includes: configuration information corresponding to the non-grid service 1 and configuration information corresponding to the non-grid service 2. The grid services list includes: configuration information corresponding to grid service 1, configuration information corresponding to grid service 2, and configuration information corresponding to grid service 3. The first service list includes: configuration information corresponding to non-grid service 1, configuration information corresponding to non-grid service 2, configuration information corresponding to grid service 1, configuration information corresponding to grid service 2, and configuration information corresponding to grid service 3.
Based on this, the process of the relay component transmitting the grid service list to the service consumer of the registry may include: the relay component transmits the first service list directly to the service consumer. The first service list is used for the service consumer of the registry to call the service corresponding to the configuration information recorded by the first service list.
Alternatively, the service consumer of the registry may subscribe to a non-grid service list of the registry when registering with the registry. After loading the configuration of the registry, the relay component determines that the service consumer of the registry subscribes to the first service list. After the relay component generates the first service list, the relay component directly sends the first service list to a service consumer of the registry.
Or the service consumer of the registry responds to the service call instruction and sends a first service list request to the relay component. And after receiving the first service list request, the relay component sends the first service list to a service consumer of the registry. The service call instruction is an instruction generated by the service consumer when the service consumer needs to initiate service call.
In this implementation, the following two implementations exist for the manner in which the service consumer of the registry invokes the first service to be invoked.
In one implementation, as shown in fig. 3, the service invocation method further includes:
Step 301, a service consumer of the registry sends a call request of a first service to be called according to the configuration information.
In some embodiments of the present application, when a service consumer of the registry needs to call a first to-be-called service, a call request of the first to-be-called service may be generated according to configuration information of the first to-be-called service in the first service list, and the call request may be sent to a call address indicated by the configuration information of the first to-be-called service. Or the service consumer of the registry may directly send the call request of the first service to be called to the relay component after generating the call request of the first service to be called.
Optionally, the service consumer of the registry generates and sends the service request of the first service to be invoked according to the configuration information of the first service to be invoked through RESTTEMPLATE tools. For example, the configuration information of the first service to be called is recorded with the URL address http:// go-service-a/A of the first service to be called. The service consumer of the registry executes the request generating function through RESTTEMPLATE tools to generate a call request of the first service to be called and sends the call request to the service provider or the relay component of the first service to be called. The request generation function is the restTemplite. GetForObject ("http:// go-service-a/A"), string. Class.
Of course, the service consumer of the registry may also generate and send the call request of the first service to be invoked in other manners. For example, the configuration information of the first service to be invoked includes an IP address of the service port and a port number. The service consumption end of the registry can obtain the URL address of the first service to be called through splicing the IP address and the port number, and further generates and sends a service request of the first service to be called.
Step 302, the relay component intercepts a call request of a first service to be called.
Alternatively, the relay component may define and register RESTTEMPLATE the interceptor to intercept the call request of the first service to be invoked. The RESTTEMPLATE interceptor is used for defining the processing to be executed by the calling request of the first service to be called before sending. Or the relay component directly receives a call request of the first service to be called sent by the service consumer end of the registry so as to intercept the call request.
In the embodiment of the application, after intercepting the call request, the relay component can judge whether the first service to be called is the grid service.
Optionally, the first service list further includes a service type identifier of the service corresponding to the configuration information. The relay component acquires a service identifier of a first service to be called in the first service list by pulling the first service list, and judges whether the first service to be called is a grid service or not.
For example, the first service list records a tag of a service corresponding to the configuration information. The content of the tag indicates the service type identification of the service. If the content of the tag is servicemesh, indicating that the service is grid service; if the tag content is not servicemesh, the service is indicated as non-grid service. And after intercepting the call request, the relay component pulls the first service list to acquire the label of the first service to be called, and judges whether the content of the label is servicemesh.
And 303, executing non-grid service calling processing by the relay component under the condition that the first service to be called is determined to be non-grid service, and returning a processing result to the service consumption terminal.
Optionally, the relay component determines that the first service to be called is a non-grid service under the condition that the service type identifier of the first service to be called indicates the non-grid service, executes non-grid service calling processing, and returns a processing result to the service consumption terminal.
For example, if the content of the tag of the first to-be-called service is determined not to be servicemesh, the relay component executes non-grid service calling processing, and returns a processing result to the service consumer.
And 304, the relay component executes grid service calling processing under the condition that the first service to be called is determined to be the grid service, and returns a processing result to the service consumption terminal.
Optionally, the relay component determines that the first service to be called is the grid service under the condition that the service type identifier of the first service to be called indicates the grid service, executes grid service calling processing, and returns a processing result to the service consumption terminal.
For example, the relay component executes the grid service call processing and returns a processing result to the service consumer terminal under the condition that the content of the tag of the first service to be called is servicemesh.
In another implementation, the first service list directly further includes a service type identifier of a service corresponding to the configuration information. The first service list is used for the service consumption end of the registry to execute non-grid service calling processing according to the configuration information of the first to-be-called service under the condition that the first to-be-called service is determined to be the non-grid service, and execute grid service calling processing according to the configuration information of the first to-be-called service under the condition that the first to-be-called service is determined to be the grid service.
That is, the first service list received by the service consumer of the registry directly includes the service type identifier of the service corresponding to the configuration information. Under the condition that the first service to be called needs to be called, the service consumption end of the registry can acquire the service type identification of the first service to be called from the first service list. And executing grid service calling processing according to the configuration information of the first service to be called under the condition that the service type is determined to be indicated as the grid service. And executing non-grid service calling processing according to the configuration information of the first service to be called under the condition that the service type is determined to be the non-grid service.
For example, the service consumer of the registry may first obtain the tag of the first service to be invoked from the first service list when the first service to be invoked needs to be invoked. Executing non-grid service call processing under the condition that the content of the tag is not servicemesh; in the case where the content of the tag is servicemesh, a grid service call process is performed.
In another alternative implementation, the relay component does not have the same functionality as the registry. Based on this, the service invocation method further includes:
The configuration information of the grid service is registered with the registry such that the registry generates a second service list. The second service list includes configuration information of all non-grid services registered with the registry, and configuration information of the grid services. The second service list is used for the service consumer to call the service corresponding to the configuration information recorded by the second service list.
In the embodiment of the application, the relay component can register the configuration information of the grid service in the registry under the condition of acquiring the configuration information of the new grid service. The relay component may update the configuration information of the grid service to the registry under the condition that the updated configuration information of the original grid service is obtained. The registry combines the configuration information of the non-grid service and the configuration information of the grid service to generate a second service list, and sends the second service list to the service consumer of the registry. It should be noted that, the timing of the registry sending the second service list to the service consumer may refer to the timing of the relay component sending the first service list to the service consumer of the registry, which is not described in detail in the embodiment of the present application.
Similarly, the specific implementation manner of calling the service corresponding to the configuration information of the second service list by the service consumer of the registry may refer to the specific implementation manner of calling the service corresponding to the configuration information of the first service list by the service consumer of the registry in the foregoing embodiment, which is not described in detail in the embodiment of the present application.
The second service list includes, for example, a service type identification of the service to which the configuration information corresponds. The second service list is used for the service consumption end of the registry to execute non-grid service calling processing according to the configuration information of the first to-be-called service under the condition that the first to-be-called service is determined to be the non-grid service, and execute grid service calling processing according to the configuration information of the first to-be-called service under the condition that the first to-be-called service is determined to be the grid service.
In some embodiments of the present application, not only the service consumer of the registry may invoke the grid service to implement invocation of the grid service by the non-grid service. And the service consumption end of the service grid can also call the non-grid service to realize the call of the grid service to the non-grid service, and the seamless connection between the grid service and the non-grid service is realized by using the relay component as a bridge, so that the communication between the grid service and the non-grid service is established. As shown in fig. 4, the service invocation method further includes:
step 401, the relay component writes configuration information of non-grid services of the registry into a cluster management component of the cluster environment.
In the embodiment of the application, after the relay component is started, a non-grid service list of the registry is obtained, and configuration information of the non-grid service of the registry is written into the cluster management component of the cluster environment. Optionally, after the relay component is started, the registration center can be adapted, the adapted configuration of the registration center is loaded, the non-grid service list of the registration center is pulled to obtain the non-grid service list, and configuration information of the non-grid service of the registration center is written into the cluster management component of the cluster environment.
Alternatively, the relay component may write configuration information of non-grid services of the registry to the cluster management component of the cluster environment at the target occasion. The target opportunity includes: the method comprises the steps of connecting to a registry for the first time, detecting a configuration information change event of the registry, and meeting update time of a non-grid service list.
For example, the relay component may obtain a non-grid service list of the registry in case it is first connected to the registry, and write configuration information of the non-grid service recorded in the non-grid service list into the cluster management component. And then, when detecting a configuration information change event of the registry, the relay component acquires the non-grid service list of the registry again and writes the configuration information of the non-grid service recorded in the non-grid service list into the cluster management component. And/or, when the relay component meets the update time of the non-grid service list, acquiring the non-grid service list of the registry again, and writing the configuration information of the non-grid service recorded in the non-grid service list into the cluster management component.
In some embodiments of the present application, where the cluster environment is a Kubernetes cluster environment, the cluster management component refers to a Kubernetes management component. The process of the relay component writing configuration information of the non-grid service to the cluster management component of the cluster environment may include: the configuration information of the non-grid service is converted into the configuration information in SERVICEENTRY format and written into kube-apiserver components of the cluster management component.
The relay component may convert the configuration information of the non-grid service into SERVICEENTRY format configuration information, call kube-APISERVER API interface, and write SERVICEENTRY format configuration information to kube-apiserver component of the cluster management component. Alternatively, the relay component may persist the SERVICEENTRY-formatted configuration information to the kube-apiserver component.
SERVICEENTRY is to add additional entries in the service registry inside Istio so that the service grid can automatically discover the service corresponding to the configuration information in SERVICEENTRY format and can access and route the service. Wherein, the SERVICEENTRY format configuration information at least needs to include service attributes. Such as Domain name system (Domain NAME SYSTEM, DNS) name, VIP, port, protocol, endpoint, and other service attributes. It will be appreciated that SERVICEENTRY may be used to register services outside of the service grid with the service grid, as well as services within the service grid that are not registered with the service grid (e.g., virtual machine services for communicating with the Kubernetes cluster environment).
Step 402, the control plane of the service grid issues configuration information of the non-grid service to the service consumer of the service grid under the condition that the control plane monitors that the configuration information of the non-grid service is written in the cluster management component.
In the embodiment of the application, the control plane of the service grid transmits the configuration information of the non-grid service to the data plane under the condition that the control plane monitors the configuration information of the non-grid service written in the cluster management component, so that the service consumption end of the service grid obtains the configuration information of the non-grid service. The configuration information of the non-grid service is used for the service consumer of the service grid to call the non-grid service. In some embodiments of the present application, the service consumer of the service grid may be a service grid application of the service grid. In this case, the grid service provided by the service grid application may also invoke a non-grid service.
Optionally, kube-apiserver components are listened to by a cloud native service gateway on the control plane of the service grid. And under the condition that the cloud primary service gateway of the service grid monitors that the kube-apiserver component is internally written with the configuration information in the SERVICEENTRY format, performing format adaptation processing on the configuration information in the SERVICEENTRY format to obtain the configuration information in the target format, and transmitting the configuration information in the target format to the service consumer side of the service grid. The target format refers to a data format that needs to be adapted to the data plane when data is transferred from the control plane to the data plane.
Illustratively, the pilot component of Istiod of the service grid listens to kube-apiserver components. In case of hearing the writing of the configuration information in the format SERVICEENTRY in the kube-apiserver component, the configuration information in the format SERVICEENTRY is subjected to format conversion and is issued to the data plane through the XDS protocol.
In such an implementation, the implementation of the service consumer of the service grid invoking its service to be invoked is as follows. Similar to the foregoing, the control plane of the service grid is further configured to issue a service type identifier of the configuration information of the non-grid service to the service consumer of the service grid. Specifically, for example, the cloud native service gateway is further configured to issue a service type identifier of the configuration information in the target format to a service consumer of the service grid.
Correspondingly, the service consumption end of the service grid executes non-grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be non-grid service. And the service consumption end of the service grid executes grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be the grid service.
It should be noted that, in the foregoing embodiment, the process that the service consumer side of the service grid invokes the second service to be invoked may refer to the related process that the service consumer side of the registry invokes the first service to be invoked, which is not described in detail in this embodiment.
In the embodiment of the application, the service calling method is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
For ease of understanding, the service invocation method provided by the embodiment of the present application is further schematically described below with reference to fig. 5. As shown in fig. 5, there are service providers (i.e., service providers) and service consumers (service consumers) under the micro-service framework.
The service provider of the registry registers the non-grid services provided by the service provider with the registry through the gateway after starting, and periodically sends heartbeat report survival status so that the registry confirms the available status of the registered non-grid services. After the service consumer starts, the service consumer registers information with the registry through the gateway, and periodically sends heartbeat report survival state, so that the registry confirms the available state of the service consumer. The service consumer may obtain the first service list (or the second service list) from the registry or relay component and cache locally.
The service consumer selects a first service to be called from the first service list (or the second service list) through a load balancing algorithm, and initiates a call to a service provider providing the first service to be called. Fig. 5 illustrates an example in which a service consumer 1 at a registry, a service provider 1 at a registry, and a service provider 2 at a registry exist. Also, fig. 5 shows that the registry may include three types of registries, namely, a registry including a first registry, a second registry, and a third registry.
Calling grid services for non-grid services:
after the relay component is started, the registration center is adapted, and the adapted registration center configuration is loaded. The relay component pulls the non-grid service list and synchronizes the non-grid service list to the service consumer of the registry. The relay component invokes a service discovery interface of the control plane of the service grid, obtains a grid service list, and synchronizes the grid service class to the service consumer of the registry. In this way, the service consumer of the registry may invoke either grid services or non-grid services.
For the case of a grid service invoking a non-grid service:
The relay component converts the configuration information of the non-grid services in the non-grid service list into the configuration information in SERVICEENTRY format, and writes the configuration information into kube-apiserver components (i.e., cluster management components) of the Kubernetes management component. The pilot component of Istiod of the service grid (i.e., the cloud native service gateway) listens to kube-apiserver components. After the kube-apiserver component is monitored to write configuration information, the configuration information in the SERVICEENTRY format is subjected to format conversion and is sent to a data surface through an XDS protocol. In this way, service consumers of the service grid may invoke both grid services and non-grid services.
Still further, the service calling method provided by the embodiment of the present application is further schematically described below with reference to fig. 6 on the basis of the description of fig. 5. As shown in figure 6 of the drawings,
After the traffic of the non-service grid (the traffic of the service consumer end of the registry or the traffic of the service provider end of the registry) enters the service processing system, the traffic first enters the gateway. The gateway can bear some large-flow access, and has the core capabilities of safety protection and http certificate authentication, and has universality, stability and high performance.
After the traffic enters the gateway, it enters the micro service gateway. The core capabilities of the micro service gateway are authentication of authentication and administration of services. For example, the micro-service gateway may have functions such as dynamic routing of traffic, protocol conversion (http to RESTful, http to Dubbo protocol, http to TCP/UDP protocol, etc.). The micro-service gateway may be a Spring Cloud gateway, a gateway, a Zuul gateway, etc.
Traffic, after being forwarded and routed through the micro-service gateway, enters the micro-service framework. In the micro-service framework, data carried by traffic of a service provider of the registry can be registered for non-grid services of the registry. The data carried by the traffic of the service consumer of the registry can be subscribed to the registry. For example, under SpringCloud microservice framework, data carried by traffic at a service provider of a registry may be registered by a non-grid service of the registry through an SDK service. The data carried by the traffic of the service consumer end of the registry can be subscribed by the SDK service, so that the service consumer end of the registry can acquire the configuration information of the grid service and the configuration information of the non-grid service.
After the traffic of the service grid enters the service processing system, the traffic enters the cloud native gateway through the gateway. The cloud native gateway comprises an Ingress gateway and an Envoy gateway. The Ingress gateway defines a standard set of interfaces. The Envoy gateway is used for traffic proxy using sidecar mode before service invocation.
Calling grid services for non-grid services:
after the relay component is started, the registration center is adapted, and the adapted registration center configuration is loaded. The relay component pulls the non-grid service list and synchronizes the non-grid service list to the service consumer of the registry. The relay component invokes a service discovery interface of the control plane of the service grid, obtains a grid service list, and synchronizes the grid service class to the service consumer of the registry. In this way, the service consumer of the registry may invoke either grid services or non-grid services.
Under the condition, when a service consumer of the registry calls a first service to be called, acquiring a label of the first service to be called, and under the condition that the content of the label is determined not to be servicemesh, executing non-grid service call processing; in the case where the content of the tag is determined to be servicemesh, a grid service call process is performed.
In another case, the service consumer of the registry sends a call request for a first service to be invoked. The relay component intercepts the call request, acquires a first label of the service to be called, executes non-grid service call processing under the condition that the content of the label is not servicemesh, and returns a call result; and executing grid service calling processing and returning a calling result under the condition that the content of the tag is servicemesh. In this case, the relay component issues an interface to the service consumer of the registry for intercepting the call request of the service consumer of the registry, thereby performing unified scheduling processing on the call request of the service consumer of the registry to call the non-grid service and the grid service.
For the case of a grid service invoking a non-grid service:
The relay component converts the configuration information of the non-grid services in the non-grid service list into the configuration information in SERVICEENTRY format, and writes the configuration information into kube-apiserver components (i.e., cluster management components) of the Kubernetes management component. The pilot component of Istiod of the service grid (i.e., the cloud native service gateway) listens to kube-apiserver components. After the kube-apiserver component is monitored to write the configuration information, the configuration information in the SERVICEENTRY format is subjected to format conversion and is sent to a service consumer on the data plane through an XDS protocol by using an application grid. In this way, service consumers of the service grid may invoke both grid services and non-grid services.
Under the service processing system, the service grid and the registry synchronize configuration information of various services (including non-grid services and grid services) provided by the service processing system, so that the interaction between the non-grid services and the grid services is realized, and the interaction operation between the grid services and the non-grid services is realized without perception.
It should be noted that the non-grid service and the grid service may not be in the same network segment. Non-grid services and grid services may also be located in the same namespace. Under the condition, the Yun Yuansheng gateway and the micro-service gateway need to support XDS protocol to carry out communication interaction so as to ensure that service consumers of the registry can realize the call of grid services through the micro-service gateway and the cloud native gateway in sequence, and similarly, ensure that service consumers of the service grid can realize the call of non-grid services through the cloud native gateway and the micro-service gateway in sequence.
In summary, the service calling method provided by the embodiment of the application is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
Referring to fig. 7, a block diagram of a service invocation method according to an embodiment of the present application is shown. The service calling method is applied to the service consumer end of the registry. The registry operates on a service processing system as shown in figure 1. As shown in fig. 7, the service invocation method further includes:
step 701, obtaining a non-grid service list of a registry and a grid service list transmitted by a relay component.
The non-grid service list comprises configuration information of all non-grid services registered in a registration center, the non-grid services are services provided by non-service grid applications, the grid service list comprises configuration information of grid services provided by service grid applications in a service grid, and the grid service list is data obtained by a relay component calling a service discovery interface of a control surface of the service grid;
step 702, calling the grid service according to the configuration information of the grid service under the condition that the grid service is to be called;
step 703, in the case of calling the non-grid service, calling the non-grid service according to the configuration information of the non-grid service.
In summary, the service calling method provided by the embodiment of the application is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
Referring to fig. 8, a block diagram of a service invocation method according to an embodiment of the present application is shown. The service calling method is applied to the service consumption end of the service grid. The registry operates on a service processing system as shown in figure 1. As shown in fig. 8, the service invocation method further includes:
step 801, the control plane receiving the service grid monitors the configuration information of the non-grid service written in the cluster management component, and issues the configuration information of the non-grid service.
The configuration information of the non-grid services is data written to the cluster management component by the relay component in the case of acquiring the configuration information of all the non-grid services registered in the registry from the registry. The non-grid service is a service provided by a non-service grid application;
step 802, in the case of calling the non-grid service, calling the non-grid service according to the configuration information of the non-grid service.
In summary, the service calling method provided by the embodiment of the application is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
Referring to fig. 9, a block diagram of a service calling device according to an embodiment of the present application is shown. As shown in fig. 9, the service invocation apparatus 900 further includes: an acquisition module 901 and a transmission module 902.
An acquisition module 901, configured to invoke a service discovery interface of a control plane of a service grid, and acquire a grid service list, where the grid service list includes configuration information of a grid service provided by a service grid application;
The sending module 902 is configured to transmit the grid service list to a service consumer of the registry, so that the service consumer is configured to invoke a grid service according to configuration information of the grid service, and invoke a non-grid service according to configuration information of a non-grid service registered in the registry, where the non-grid service is a service provided by a non-service grid application.
Optionally, the acquiring module 901 is further configured to acquire a non-grid service list of the registry, where the non-grid service list includes configuration information of all non-grid services registered in the registry;
The service invocation apparatus 900 further includes: the merging module is used for merging the non-grid service list and the grid service list to generate a first service list;
the sending module 902 is further configured to transmit the grid service list to a service consumer of the registry, including: and directly transmitting a first service list to the service consumption terminal, wherein the first service list is used for enabling the service consumption terminal to call the service corresponding to the configuration information recorded by the first service list.
Optionally, the service invocation apparatus 900 further includes: the interception module is used for intercepting a call request of a first service to be called, which is sent by a service consumption end of the registry according to the configuration information;
The calling module is used for executing non-grid service calling processing under the condition that the first service to be called is determined to be non-grid service, and returning a processing result to the service consumption terminal; and the method is also used for executing grid service calling processing and returning a processing result to the service consumption terminal under the condition that the first service to be called is determined to be the grid service.
Optionally, the first service list further includes a service type identifier of the service corresponding to the configuration information; the first service list is used for the service consumer to execute non-grid service calling processing according to the configuration information of the first service to be called when the first service to be called is determined to be the non-grid service, and execute grid service calling processing according to the configuration information of the first service to be called when the first service to be called is determined to be the grid service.
Optionally, the service invocation apparatus 900 further includes: the registration module is used for registering the configuration information of the grid service in the registration center so that the registration center generates a second service list, the second service list comprises the configuration information of all non-grid services registered in the registration center and the configuration information of the grid service, and the second service list is used for a service consumer to call the service corresponding to the configuration information recorded by the second service list.
Optionally, the service invocation apparatus 900 further includes: the writing module is used for writing the configuration information of the non-grid service of the registry into the cluster management component of the cluster environment, so that the control plane can send the configuration information of the non-grid service to the service consumption end of the service grid under the condition that the control plane monitors the configuration information of the non-grid service written in the cluster management component, and the configuration information of the non-grid service is used for the service consumption end of the service grid to call the non-grid service.
Optionally, the cluster environment is a Kubernetes cluster environment, the writing module is further configured to convert configuration information of the non-grid service into configuration information in SERVICEENTRY format, write the configuration information into kube-apiserver component of the cluster management component,
The kube-apiserver component is monitored by a cloud native service gateway of the service grid, the cloud native service gateway is used for performing format adaptation processing on the SERVICEENTRY format configuration information to obtain the target format configuration information under the condition that the SERVICEENTRY format configuration information is written in the kube-apiserver component, the target format configuration information is issued to a service consumer of the service grid, and the target format configuration information is used for enabling the service consumer of the service grid to call non-grid services.
Optionally, the cloud native service gateway is further configured to send a service type identifier of the configuration information to a service consumer of the service grid;
the service consumption end of the service grid is used for executing non-grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be non-grid service;
the service consumption end of the service grid is further used for executing grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be the grid service.
Optionally, the writing module is further configured to write configuration information of a non-grid service of the registry into a cluster management component of the cluster environment at a target opportunity, where the target opportunity includes: the method comprises the steps of connecting to a registry for the first time, detecting a configuration information change event of the registry, and meeting update time of a non-grid service list.
In the embodiment of the application, the service calling method is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
Referring to fig. 10, a block diagram of a service invocation apparatus according to an embodiment of the present application is shown. As shown in fig. 10, the service invocation apparatus 1000 further includes: an acquisition module 1001 and a call module 1002.
The acquiring module 1001 is configured to acquire a non-grid service list of the registry and a grid service list transmitted by the relay component, where the non-grid service list includes configuration information of all non-grid services registered in the registry, the non-grid services are services provided by a non-service grid application, the grid service list includes configuration information of grid services provided by a service grid application in a service grid, and the grid service list is data acquired by a service discovery interface of a control plane of a service grid invoked by the relay component;
a calling module 1002, configured to call the grid service according to the configuration information of the grid service in a case where the grid service is to be called; and the method is also used for calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
In the embodiment of the application, the service calling method is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
Referring to fig. 11, a block diagram of a service invocation apparatus according to an embodiment of the present application is shown. As shown in fig. 11, the service invocation apparatus 1100 further includes: a receiving module 1101 and a calling module 1102.
The receiving module 1101 is configured to receive, when the control plane of the service grid monitors that the configuration information of the non-grid service is written in the cluster management component, the configuration information of the non-grid service that is issued is data written in the cluster management component by the relay component when the relay component obtains the configuration information of all the non-grid services registered in the registry from the registry. The non-grid service is a service provided by a non-service grid application;
And a calling module 1102, configured to call the non-grid service according to the configuration information of the non-grid service in the case that the non-grid service is to be called.
In the embodiment of the application, the service calling method is applied to the service processing system. The relay component can invoke a service discovery interface of the service grid to obtain a grid services list of the service grid. The grid services list includes configuration information for grid services provided by a services grid application within the services grid. The grid service list is transmitted to the service consumer end of the registry, so that the service consumer end of the registry can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry. According to the technical scheme, the service consumption end (including the non-grid service of the registry) registered in the registry can call the grid service according to the acquired configuration information of the grid service without manually participating in calling configuration setting, so that the non-grid service can call the grid service efficiently, the operation and maintenance cost is reduced, and the development efficiency of the application program is improved.
Referring to fig. 12, a block diagram of an electronic device according to an embodiment of the application is shown. As shown in fig. 12, the electronic device includes a processor 1201, a communication interface 1202, a memory 1203, and a communication bus 1204, wherein the processor 1201, the communication interface 1202, the memory 1203 complete communication with each other through the communication bus 1204,
A memory 1203 for storing a computer program;
the processor 1201 is configured to implement any one of the service calling methods provided in the embodiments of the present application when executing the program stored in the memory 1203.
The communication bus mentioned above for the electronic device may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface 1204 is used for communication between the above-described electronic device and other devices.
The memory may include random access memory (Random Access Memory, RAM) or may include non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, abbreviated as CPU), a network processor (Network Processor, abbreviated as NP), etc.; but may also be a digital signal processor (DIGITAL SIGNAL Processing, DSP), application Specific Integrated Circuit (ASIC), field-Programmable gate array (FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
The embodiment of the application also provides a readable storage medium, and the readable storage medium stores a program or an instruction, which when executed by a processor, implements each process of the service calling method embodiment, and can achieve the same technical effects, so that repetition is avoided, and no further description is provided here.
Wherein, the processor is the processor in the electronic device in the above embodiment. Readable storage media include computer readable storage media such as computer readable memory ROM, random access memory RAM, magnetic or optical disks, and the like.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are to be protected by the present application.
Claims (16)
1. A service invocation method, applied to a relay component of a service processing system, where a registry 、 in the service processing system is not a service grid application, a service grid application, and the relay component are deployed in the same cluster environment, the method comprising:
Invoking a service discovery interface of a control surface of the service grid to obtain a grid service list, wherein the grid service list comprises configuration information of grid services provided by the service grid application;
And transmitting the grid service list to a service consumption end of the registry so that the service consumption end is used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry, wherein the non-grid service is a service provided by the non-service grid application.
2. The method according to claim 1, wherein the method further comprises:
acquiring a non-grid service list of the registry, wherein the non-grid service list comprises configuration information of all non-grid services registered in the registry;
Combining the non-grid service list and the grid service list to generate a first service list;
the transmitting the grid service list to the service consumer of the registry includes: and directly transmitting the first service list to the service consumption terminal, wherein the first service list is used for the service consumption terminal to call the service corresponding to the configuration information recorded by the first service list.
3. The method according to claim 2, wherein the method further comprises:
intercepting a call request of a first service to be called, which is sent by a service consumption center of the registry according to the configuration information;
executing non-grid service calling processing under the condition that the first service to be called is the non-grid service, and returning a processing result to the service consumption terminal;
and executing grid service calling processing under the condition that the first service to be called is determined to be the grid service, and returning a processing result to the service consumption terminal.
4. The method of claim 2, wherein the first service list further includes a service type identification of the service to which the configuration information corresponds;
the first service list is used for the service consumption end to execute non-grid service calling processing according to the configuration information of the first service to be called when the first service to be called is determined to be the non-grid service, and execute grid service calling processing according to the configuration information of the first service to be called when the first service to be called is determined to be the grid service.
5. The method according to claim 1, wherein the method further comprises:
Registering the configuration information of the grid service in the registry so that the registry generates a second service list, wherein the second service list comprises the configuration information of all non-grid services registered in the registry and the configuration information of the grid service, and the second service list is used for the service consumer to call the service corresponding to the configuration information recorded by the second service list.
6. The method according to any one of claims 1 to 5, further comprising:
Writing the configuration information of the non-grid service of the registry into a cluster management component of the cluster environment, so that the control plane issues the configuration information of the non-grid service to a service consumption terminal of the service grid under the condition that the configuration information of the non-grid service is written into the cluster management component, and the configuration information of the non-grid service is used for the service consumption terminal of the service grid to call the non-grid service.
7. The method of claim 6, wherein the cluster environment is a Kubernetes cluster environment, and wherein writing configuration information of the non-grid services of the registry to a cluster management component of the cluster environment comprises:
Converting the configuration information of the non-grid service into SERVICEENTRY-format configuration information, writing into kube-apiserver components of the cluster management component,
The kube-apiserver component is monitored by a cloud native service gateway of the service grid, and the cloud native service gateway is configured to perform format adaptation processing on the SERVICEENTRY format configuration information to obtain target format configuration information when the cloud native service gateway monitors that the SERVICEENTRY format configuration information is written in the kube-apiserver component, and send the target format configuration information to a service consumer of the service grid, where the target format configuration information is used for the service consumer of the service grid to call the non-grid service.
8. The method of claim 7, wherein the cloud native service gateway is further configured to issue a service type identification of the configuration information to a service consumer of the service grid;
the service consumption end of the service grid is used for executing non-grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be the non-grid service;
And the service consumption end of the service grid is also used for executing grid service calling processing according to the configuration information of the second service to be called under the condition that the second service to be called is determined to be the grid service.
9. The method of claim 6, wherein writing configuration information of the non-grid services of the registry to a cluster management component of the cluster environment comprises:
Writing configuration information of the non-grid services of the registry into a cluster management component of the cluster environment at a target opportunity, the target opportunity comprising: the method comprises the steps of connecting to the registry for the first time, detecting a configuration information change event of the registry, and meeting the update time of the non-grid service list.
10. The service calling method is characterized by being applied to a service consumption end of a registry, wherein the registry runs in a service processing system, and the registry, a relay component, a non-service grid application, a service grid and a service grid application in the service processing system are deployed in the same cluster environment, and the method further comprises the following steps:
Acquiring a non-grid service list of the registry and a grid service list transmitted by the relay component, wherein the non-grid service list comprises configuration information of all non-grid services registered in the registry, the non-grid services are services provided by the non-service grid application, the grid service list comprises configuration information of grid services provided by the service grid application in the service grid, and the grid service list is data acquired by the relay component calling a service discovery interface of a control surface of the service grid;
under the condition that the grid service is to be called, calling the grid service according to the configuration information of the grid service;
and calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
11. The service calling method is characterized by being applied to a service consumption end of a service grid, wherein the service grid is operated in a service processing system, a registration center, a relay component, a non-service grid application, the service grid and the service grid application in the service processing system are deployed in the same cluster environment, and a cluster management component of the cluster environment is also operated in the cluster environment; the method further comprises the steps of:
receiving data written into the cluster management component by the relay component under the condition that the relay component acquires configuration information of all non-grid services registered in the registry from the registry under the condition that the control surface of the service grid monitors the configuration information of the non-grid services written into the cluster management component, wherein the non-grid services are services provided by the non-service grid application;
and calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
12. A service invocation apparatus, applied to a relay component of a service processing system, where a registry, a non-service grid application, a service grid application, and the relay component are deployed in a same cluster environment, the apparatus further comprising:
The acquisition module is used for calling a service discovery interface of the control surface of the service grid to acquire a grid service list, wherein the grid service list comprises configuration information of grid services provided by the service grid application;
And the sending module is used for transmitting the grid service list to a service consumption end of the registry so that the service consumption end can be used for calling the grid service according to the configuration information of the grid service and calling the non-grid service according to the configuration information of the non-grid service registered in the registry, wherein the non-grid service is a service provided by the non-service grid application.
13. A service invocation apparatus, applied to a service consumption end of a registry, where the registry runs in a service processing system, and a registry, a relay component, a non-service grid application, a service grid, and a service grid application in the service processing system are deployed in a same cluster environment, the apparatus further comprising:
The system comprises an acquisition module, a relay component and a relay component, wherein the acquisition module is used for acquiring a non-grid service list of the registry and a grid service list transmitted by the relay component, the non-grid service list comprises configuration information of all non-grid services registered in the registry, the non-grid services are services provided by the non-service grid application, the grid service list comprises configuration information of grid services provided by the service grid application in the service grid, and the grid service list is data acquired by the relay component calling a service discovery interface of a control surface of the service grid;
The calling module is used for calling the grid service according to the configuration information of the grid service under the condition that the grid service is to be called; and the non-grid service is also used for calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
14. The service calling device is characterized by being applied to a service consumption end of a service grid, wherein the service grid is operated in a service processing system, a registration center, a relay component, a non-service grid application, the service grid and the service grid application in the service processing system are deployed in the same cluster environment, and a cluster management component of the cluster environment is also operated in the cluster environment; the apparatus further comprises:
The receiving module is used for receiving data written by the service grid from the trunking management module when the relay module acquires the configuration information of all the non-grid services registered in the registry from the registry under the condition that the control plane of the service grid monitors the configuration information of the non-grid services written in the trunking management module, and the non-grid services are services provided by the non-service grid application;
And the calling module is used for calling the non-grid service according to the configuration information of the non-grid service under the condition that the non-grid service is to be called.
15. An electronic device, the electronic device comprising: a processor and a memory;
The memory is used for storing a computer program;
The processor is configured to implement the method of any one of claims 1 to 11 when executing the program stored on the memory.
16. A readable storage medium, characterized in that it has stored thereon a program or instructions which, when executed by a processor, implement the method of any of claims 1 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410141346.7A CN118055163A (en) | 2024-01-31 | 2024-01-31 | Service calling method, device, electronic equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410141346.7A CN118055163A (en) | 2024-01-31 | 2024-01-31 | Service calling method, device, electronic equipment and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118055163A true CN118055163A (en) | 2024-05-17 |
Family
ID=91044162
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410141346.7A Pending CN118055163A (en) | 2024-01-31 | 2024-01-31 | Service calling method, device, electronic equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118055163A (en) |
-
2024
- 2024-01-31 CN CN202410141346.7A patent/CN118055163A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113301166B (en) | Service calling method and device, storage medium and electronic device | |
EP1775657B1 (en) | Method and apparatus for providing home network device service to an external device through WEB service | |
US8775651B2 (en) | System and method for dynamic adaptation service of an enterprise service bus over a communication platform | |
US8363663B2 (en) | Methods and apparatus for routing data to nodes | |
CN110262902B (en) | Information processing method and system, medium, and computing device | |
US20100281097A1 (en) | Method and device for communicating according to the standard protocol opc ua in a client/server system | |
JP2012216884A (en) | Network system, computer distribution device and distribution method | |
CN111163166B (en) | Enterprise service bus system | |
WO2009062414A1 (en) | Integrate client and method of desktop application communicating with net web application | |
JP7418996B2 (en) | Network management system, computer-implemented method for servicing remote procedure call requests, and optical communication system | |
CN111209127A (en) | Method for integrating Istio service grid by Dubbo frame | |
JP5679343B2 (en) | Cloud system, gateway device, communication control method, and communication control program | |
CN116633775B (en) | Container communication method and system of multi-container network interface | |
CN115086176B (en) | System for realizing dynamic issuing of service administration strategy based on spring cloud micro-service technology | |
CN112104640A (en) | Data processing method, device and equipment of gateway and readable storage medium | |
JP6423764B2 (en) | Method, device, system and network architecture for handling service requests | |
CN115379010A (en) | Container network construction method, device, equipment and storage medium | |
CN118055163A (en) | Service calling method, device, electronic equipment and readable storage medium | |
US11563721B2 (en) | Methods and systems for network address translation (NAT) traversal using a meet-in-the-middle proxy | |
CN113810448B (en) | Cloud service method, deployment method, device, electronic equipment and storage medium | |
CN108833434B (en) | Method for realizing cross-network video call system based on IP bidirectional network set top box | |
JP5438230B2 (en) | Internet connection system | |
CN102685261B (en) | Method, system and device for controlling address mapping state of equipment | |
JP2015201758A (en) | Repeater, communication system, information processing method, and program | |
KR101348927B1 (en) | Openapi adaptor for wsun |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |