CN115866009A - Service instance calling method, system, electronic equipment and readable storage medium - Google Patents

Service instance calling method, system, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN115866009A
CN115866009A CN202211296973.5A CN202211296973A CN115866009A CN 115866009 A CN115866009 A CN 115866009A CN 202211296973 A CN202211296973 A CN 202211296973A CN 115866009 A CN115866009 A CN 115866009A
Authority
CN
China
Prior art keywords
service
instance
address
proxy
target
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
Application number
CN202211296973.5A
Other languages
Chinese (zh)
Inventor
王晓虎
邓春龙
彭杰
谭谈
舒润
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Geely Holding Group Co Ltd
Guangyu Mingdao Digital Technology Co Ltd
Original Assignee
Zhejiang Geely Holding Group Co Ltd
Guangyu Mingdao Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Geely Holding Group Co Ltd, Guangyu Mingdao Digital Technology Co Ltd filed Critical Zhejiang Geely Holding Group Co Ltd
Priority to CN202211296973.5A priority Critical patent/CN115866009A/en
Publication of CN115866009A publication Critical patent/CN115866009A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to the technical field of service management, and discloses a service instance calling method, a system, electronic equipment and a readable storage medium.

Description

Service instance calling method, system, electronic equipment and readable storage medium
Technical Field
The present invention relates to the technical field of service management, and in particular, to a method, a system, an electronic device, and a readable storage medium for invoking a service instance.
Background
At present, because the product services have different uses and belongings, corresponding SaaS (Software-as-a-Service, which provides Software services based on the internet) environments, trial environments, and privatized deployment environments are also different, and product services in the same application environment are usually registered and managed through a registration center.
However, due to the lack of a method for dynamically switching target services in different environments, if a service caller and a service provider are in different application environments and different registries, the service caller cannot call the service provider across the environments and the registries, which is inconvenient for calling between service instances.
Disclosure of Invention
The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview nor is intended to identify key/critical elements or to delineate the scope of such embodiments but rather as a prelude to the more detailed description that is presented later.
In view of the above shortcomings in the prior art, the present invention discloses a service instance calling method, system, electronic device and readable storage medium, so as to realize calling between service instances in different environments.
The invention discloses a service instance calling method, which comprises the following steps: acquiring a plurality of application environments, wherein at least one service instance is deployed in each application environment, and any two service instances are respectively determined as a service calling end and a service providing end; establishing a registration center corresponding to each application environment, and performing service registration on corresponding service instances by using the registration center to obtain service instance addresses corresponding to each service instance; establishing proxy service, connecting each registration center by using the proxy service, and establishing a service address table according to a service instance address in each registration center; and matching the service calling terminal from the service address table of the proxy service to obtain a target address corresponding to the service providing terminal, and calling the service providing terminal through the target address.
Optionally, establishing a service address table according to the service instance address in each registration center includes: acquiring service instance information corresponding to each service instance from each registration center by using the proxy service, wherein the service instance information comprises an instance name of the service instance, an application environment corresponding to the service instance and a service instance address corresponding to the service administration; and generating a service address table according to the service instance information corresponding to each service instance.
Optionally, after the service address table is established according to the service instance address in each registration center, the method further includes at least one of: after a preset time interval, the proxy service is used for reacquiring service instance information corresponding to each service instance from each registration center, and the service address table is updated according to the reacquired service instance information; and monitoring each registration center by using the proxy service, responding to the existence of new service instance information in any registration center, and adding the new service instance information into the service address table.
Optionally, obtaining, by using the service invocation end, a target address corresponding to the service provider from a service address table of the proxy service in a matching manner, includes: acquiring a target name and a target environment corresponding to the service provider by using the service calling terminal; generating an address acquisition request according to the target name and the target environment, and sending the address acquisition request to the proxy service, so that the proxy service matches the received target name and the target environment according to the service address table to obtain a target address corresponding to the service provider, wherein an instance name corresponding to the target address is the same as the target name, and an application environment corresponding to the target address is the same as the target environment; and receiving the target address fed back by the proxy service.
Optionally, before the target address corresponding to the service provider is obtained by using the service invocation end to match from the service address table of the proxy service, the method further includes: determining the application environment of the service calling end as a first environment, and determining the application environment of the service providing end as a second environment; comparing the first environment with the second environment to obtain an environment comparison result; if the environment comparison results comprise the same, acquiring a target address corresponding to the service provider from a corresponding registration center by using the service calling end; and if the environment comparison results comprise different environment comparison results, matching the service calling end from a service address table of the proxy service to obtain a target address corresponding to the service providing end.
Optionally, the connection between the proxy service and the registry is established by: acquiring connection information corresponding to the registration center, wherein the connection information comprises at least one of a registration center address, a user account and a user password; and generating a connection request according to the user account and the user password by using the proxy service, sending the connection request to a registration center address corresponding to the registration center, so that the registration center performs user authentication on the received user account and the user password according to preset user information, and establishing a connection link between the proxy service and the registration center after the authentication is passed, wherein the preset user information comprises at least one preset account and the preset password corresponding to the preset account.
Optionally, invoking the service provider through a target address includes: acquiring a service implementation method corresponding to the target address; and establishing a service calling request corresponding to the target address according to the service implementation method, and sending the service calling request to the target address so as to execute the service implementation method.
The invention discloses a service instance calling system, which comprises: the system comprises an acquisition module, a service calling module and a service providing module, wherein the acquisition module is used for acquiring a plurality of application environments, at least one service instance is deployed in each application environment, and any two service instances are respectively determined as a service calling end and a service providing end; the registry module is used for establishing a registry corresponding to each application environment, and performing service registration on corresponding service instances by using the registry to obtain service instance addresses corresponding to each service instance; the agent module is used for establishing agent service, connecting each registration center by using the agent service and establishing a service address table according to service instance addresses in each registration center; and the calling module is used for obtaining a target address corresponding to the service provider by matching the service calling terminal from the service address table of the proxy service and calling the service provider through the target address.
The invention discloses an electronic device, comprising: a processor and a memory; the memory is used for storing computer programs, and the processor is used for executing the computer programs stored by the memory so as to make the electronic equipment execute the method.
The invention discloses a computer-readable storage medium, on which a computer program is stored: which when executed by a processor implements the method described above.
The invention has the beneficial effects that:
registering the service instances in the application environment through the registration centers corresponding to the application environments to obtain service instance addresses corresponding to the service instances, establishing a service address table according to the service instance addresses in the registration centers through the proxy service, enabling the service calling end to match a target address from the service address table of the proxy service, and calling the service providing end through the target address. Therefore, the service instance addresses in the same application environment are managed in a unified mode through the registration centers, the service instance addresses corresponding to the registration centers are managed in a unified mode through the proxy service based on the service address table, the service calling end can call the service providing end through the service address table, the calling environment among the service instances is opened, and calling among the service instances in different environments is achieved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 is a flow diagram illustrating a service instance invocation method in accordance with an embodiment of the present invention;
FIG. 2 is a schematic diagram of a proxy service scheme according to an embodiment of the present invention;
FIG. 3 is a flow diagram illustrating another service instance invocation method in accordance with an embodiment of the present invention;
FIG. 4 is a schematic diagram of a service instance invocation system in accordance with an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It should be noted that, in the following embodiments and examples, subsamples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention, and the drawings only show the components related to the present invention rather than being drawn according to the number, shape and size of the components in actual implementation, and the type, amount and proportion of each component in actual implementation can be changed freely, and the layout of the components can be more complicated.
In the following description, numerous details are set forth to provide a more thorough explanation of embodiments of the present invention, however, it will be apparent to one skilled in the art that embodiments of the present invention may be practiced without these specific details, and in other embodiments, well-known structures and devices are shown in block diagram form, rather than in detail, to avoid obscuring embodiments of the present invention.
The terms "first," "second," and the like in the description and in the claims, and the above-described drawings of embodiments of the present disclosure, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the present disclosure described herein may be made. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions.
The term "plurality" means two or more unless otherwise specified.
In the embodiment of the present disclosure, the character "/" indicates that the preceding and following objects are in an or relationship. For example, A/B represents: a or B.
The term "and/or" is an associative relationship that describes objects, meaning that three relationships may exist. For example, a and/or B, represents: a or B, or A and B.
As shown in fig. 1, an embodiment of the present disclosure provides a service instance calling method, including:
step S101, acquiring a plurality of application environments, wherein at least one service instance is deployed in each application environment;
wherein, any two service instances are respectively determined as a service calling end and a service providing end;
step S102, establishing a registration center corresponding to each application environment, and performing service registration on the corresponding service instance by using the registration center to obtain a service instance address corresponding to each service instance;
step S103, establishing proxy service, connecting each registration center by using the proxy service, and establishing a service address table according to the service instance address in each registration center;
and step S104, matching the service calling terminal with a service address table of the proxy service to obtain a target address corresponding to the service provider, and calling the service provider through the target address.
By adopting the service instance calling method provided by the embodiment of the disclosure, the service instances in the application environments are registered through the registration centers corresponding to the application environments to obtain the service instance addresses corresponding to the service instances, and the service address table is established according to the service instance addresses in the registration centers through the proxy service, so that the service calling end matches the target addresses from the service address table of the proxy service and calls the service providing end through the target addresses. Therefore, the service instance addresses in the same application environment are managed in a unified mode through the registration centers, the service instance addresses corresponding to the registration centers are managed in a unified mode through the proxy service based on the service address table, the service calling end can call the service providing end through the service address table, the calling environment among the service instances is opened, and calling among the service instances in different environments is achieved.
Optionally, the connection between the proxy service and the registry is established by: acquiring connection information corresponding to a registration center, wherein the connection information comprises at least one of a registration center address, a user account and a user password; the method comprises the steps that a connection request is generated by using proxy service according to a user account and a user password, the connection request is sent to a registration center address corresponding to a registration center, the registration center conducts user verification on the received user account and the received user password according to preset user information, and a connection link between the proxy service and the registration center is established after the verification is passed, wherein the preset user information comprises at least one preset account and a preset password corresponding to the preset account.
In some embodiments, registry environment variables are configured, and registries relating to multiple environments in a business are managed in a unified manner, wherein the registry environment variables include registry addresses, account numbers, passwords and environment variables.
Optionally, establishing a service address table according to the service instance address in each registration center includes: acquiring service instance information corresponding to each service instance from each registration center by using proxy service, wherein the service instance information comprises an instance name of the service instance, an application environment corresponding to the service instance and a service instance address corresponding to service administration; and generating a service address table according to the service instance information corresponding to each service instance.
Optionally, after the service address table is established according to the service instance address in each registration center, the method further includes at least one of: after each preset time interval, the service instance information corresponding to each service instance is obtained again from each registration center by using the proxy service, and the service address table is updated according to the obtained service instance information again; and monitoring each registration center by using the proxy service, responding to the existence of new service instance information in any registration center, and adding the new service instance information into the service address table.
In some embodiments, after the proxy service is successfully started, the proxy service is actively connected with a registration center in the configuration; caching the service instance information in each environment registration center so as to facilitate the dynamic switching of the proxy service; and updating the cache information by periodically detecting and activating the registration center.
Optionally, the obtaining, by using the service invocation end, the target address corresponding to the service provider from the service address table of the proxy service in a matching manner includes: acquiring a target name and a target environment corresponding to a service provider by using a service calling end; generating an address acquisition request according to the target name and the target environment, and sending the address acquisition request to the proxy service, so that the proxy service matches the received target name and the target environment according to the service address table to obtain a target address corresponding to a service provider, wherein the instance name corresponding to the target address is the same as the target name, and the application environment corresponding to the target address is the same as the target environment; and receiving the target address fed back by the proxy service.
In some embodiments, the service invocation end matches a service address table of the proxy service to obtain a target address corresponding to the service provider through a proxy SDK (Software Development Kit).
Therefore, the service instance obtains the target address corresponding to the service providing end from the service address table of the proxy service through the proxy SDK in a matching mode, and compared with the mode that the service instance directly interacts with the proxy service, the coupling degree between the service instance and the proxy service is reduced.
Optionally, before the target address corresponding to the service provider is obtained by using the service invocation end to match the service address table of the proxy service, the method further includes: determining an application environment of a service calling end as a first environment, and determining an application environment of a service providing end as a second environment; comparing the first environment with the second environment to obtain an environment comparison result; if the environment comparison results comprise the same, acquiring a target address corresponding to the service provider from the corresponding registration center by using the service calling end; and if the environment comparison results comprise different environment comparison results, matching the service call end from the service address table of the proxy service to obtain a target address corresponding to the service provider.
In some embodiments, if the service invocation end and the service provider are in the same application environment, the service invocation end obtains a target address corresponding to the service provider through the proxy SDK, or the service invocation end obtains the target address corresponding to the service provider from a corresponding registry based on the service discovery call.
In some embodiments, if the service invocation end and the service provider are in different application environments, the service invocation end obtains a target address corresponding to the service provider through the proxy SDK.
Therefore, if the service calling side and the service providing side are in the same application environment, compared with the method that a target address corresponding to a service provider is obtained through a registration center through an agent SDK, the obtaining efficiency is higher, meanwhile, the target address obtaining mode is expanded, another obtaining mode is used after any obtaining mode fails, and therefore the stability of address obtaining is improved.
Optionally, the invoking the service provider by the target address includes: acquiring a service implementation method corresponding to a target address; and establishing a service calling request corresponding to the target address according to the service implementation method, and sending the service calling request to the target address so as to execute the service implementation method.
In some embodiments, the service invocation end constructs a request to execute HTTP (Hyper Text Transfer Protocol) or RPC (Remote Procedure Call) Remote interface invocation by obtaining the service instance information corresponding to the service providing end.
With reference to fig. 2, an embodiment of the present disclosure provides a proxy service scheme, which includes a service invocation end 201, a service provider 202, a registration center a 203 corresponding to the service invocation end, a registration center B204 corresponding to the service provider, and a proxy service 205; the proxy service respectively calls a service instance address of a service calling end and a service instance address of a service providing end through a registration center A and a registration center B and generates a service address table; the service calling terminal accesses the proxy service through the proxy SDK and acquires a target address of the service providing terminal through a service address table of the proxy service; and the service calling terminal calls the service providing terminal through the target address.
By adopting the proxy service scheme provided by the embodiment of the disclosure, the service instances in the application environments are registered through the registration centers corresponding to the application environments to obtain the service instance addresses corresponding to the service instances, and the service address table is established according to the service instance addresses in the registration centers through the proxy service, so that the service calling end matches the target address from the service address table of the proxy service and calls the service providing end through the target address. Therefore, the service instance addresses in the same application environment are managed in a unified mode through the registration centers, the service instance addresses corresponding to the registration centers are managed in a unified mode through the proxy service based on the service address list, the service calling end can call the service providing end through the service address list, the calling environment among the service instances is opened, and calling among the service instances in different environments is achieved.
As shown in fig. 3, an embodiment of the present disclosure provides a service instance calling method, including:
step S301, registering the service calling terminal and the service providing terminal to a registration center terminal;
the registration center end comprises a registration center corresponding to the service calling end and a registration center corresponding to the service providing end;
step S302, the register center end sends a service instance address to the agent module;
step S303, the agent module establishes a service address table according to the service instance address;
step S304, the service calling terminal sends an address acquisition request corresponding to the service providing terminal to the proxy module;
step S305, the proxy service matches the service address table to obtain the target address corresponding to the service provider;
step S306, the proxy service sends a target address to the service calling terminal;
step S307, the service calling terminal calls the service providing terminal through the target address.
By adopting the proxy service scheme provided by the embodiment of the disclosure, the service instances in the application environments are registered through the registration centers corresponding to the application environments to obtain the service instance addresses corresponding to the service instances, and the service address table is established according to the service instance addresses in the registration centers through the proxy service, so that the service calling end matches the target address from the service address table of the proxy service and calls the service providing end through the target address, and the proxy service scheme has the following advantages:
the method comprises the steps that firstly, service instance addresses in the same application environment are managed in a unified mode through a registry, service instance addresses corresponding to all registries are managed in a unified mode through proxy services based on a service address table, so that a service calling end can call a service providing end through the service address table, calling environments among service instances are opened, and calling among the service instances in different environments is achieved;
secondly, the service instance obtains a target address corresponding to the service providing end from a service address table of the proxy service through proxy SDK matching, and compared with the situation that the service instance directly interacts with the proxy service, the coupling degree between the service instance and the proxy service is reduced;
thirdly, if the service calling end and the service providing end are in the same application environment, the target address corresponding to the service providing end is obtained through the registration center, and the obtaining efficiency is higher than that of the target address corresponding to the service providing end obtained through the proxy SDK;
and fourthly, the acquisition modes of the target address are expanded, and another acquisition mode is used after any acquisition mode fails, so that the stability of address acquisition is improved.
As shown in fig. 4, the embodiment of the present disclosure provides a service instance invoking system, which includes an obtaining module 401, a registry module 402, a proxy module 403, and an invoking module 404; the obtaining module 401 is configured to obtain a plurality of application environments, where at least one service instance is deployed in an application environment, where any two service instances are respectively determined as a service invoking end and a service providing end; the registry module 402 is configured to establish a registry corresponding to each application environment, and perform service registration on a corresponding service instance by using the registry to obtain a service instance address corresponding to each service instance; the agent module 403 is configured to establish an agent service, connect each registration center with the agent service, and establish a service address table according to a service instance address in each registration center; the invoking module 404 is configured to obtain a target address corresponding to the service provider by using the service invoking terminal through matching in the service address table of the proxy service, and invoke the service provider through the target address.
By adopting the service instance calling system provided by the embodiment of the disclosure, the service instances in the application environments are registered through the registration centers corresponding to the application environments to obtain the service instance addresses corresponding to the service instances, and the service address table is established according to the service instance addresses in the registration centers through the proxy service, so that the service calling end matches the target addresses from the service address table of the proxy service and calls the service providing end through the target addresses. Therefore, the service instance addresses in the same application environment are managed in a unified mode through the registration centers, the service instance addresses corresponding to the registration centers are managed in a unified mode through the proxy service based on the service address table, the service calling end can call the service providing end through the service address table, the calling environment among the service instances is opened, and calling among the service instances in different environments is achieved.
FIG. 5 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application. It should be noted that the computer system 500 of the electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various suitable actions and processes, such as executing the method in the above-mentioned embodiment, according to a program stored in a Read-Only Memory (ROM) 502 or a program loaded from a storage portion 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for system operation are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An Input/Output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output section 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to embodiments of the present application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. When the computer program is executed by a Central Processing Unit (CPU) 501, various functions defined in the system of the present application are executed.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer-readable signal medium may comprise a propagated data signal with a computer-readable computer program embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The disclosed embodiments also provide a computer-readable storage medium on which a computer program is stored, which when executed by a processor implements any of the methods in the embodiments.
The computer-readable storage medium in the embodiments of the present disclosure may be understood by those skilled in the art as follows: all or part of the steps for implementing the above method embodiments may be performed by hardware associated with a computer program. The aforementioned computer program may be stored in a computer readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The electronic device disclosed in this embodiment includes a processor, a memory, a transceiver, and a communication interface, where the memory and the communication interface are connected to the processor and the transceiver and perform mutual communication, the memory is used to store a computer program, the communication interface is used to perform communication, and the processor and the transceiver are used to run the computer program, so that the electronic device performs the steps of the above method.
In this embodiment, the Memory may include a Random Access Memory (RAM), and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The above description and drawings sufficiently illustrate embodiments of the disclosure to enable those skilled in the art to practice them. Other embodiments may incorporate structural, logical, electrical, process, and other changes. The examples merely typify possible variations. Individual components and functions are optional unless explicitly required, and the sequence of operations may vary. Portions and subsamples of some embodiments may be included in or substituted for portions and subsamples of other embodiments. Furthermore, the words used in the specification are words of description for example only and are not limiting upon the claims. As used in the description of the embodiments and the claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. Similarly, the term "and/or" as used in this application is meant to encompass any and all possible combinations of one or more of the associated listed. Furthermore, the terms "comprises," "comprising," and variations thereof, when used in this application, specify the presence of stated sub-samples, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other sub-samples, integers, steps, operations, elements, components, and/or groups thereof. Without further limitation, an element defined by the phrase "comprising one of 8230," does not exclude the presence of another identical element in a process, method or device comprising the element. In this document, each embodiment may be described with emphasis on differences from other embodiments, and the same and similar parts between the respective embodiments may be referred to each other. For methods, products, etc. of the embodiment disclosures, reference may be made to the description of the method section for relevance if it corresponds to the method section of the embodiment disclosure.
Those of skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software may depend upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the apparatus and the unit described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments disclosed herein, the disclosed methods, products (including but not limited to devices, apparatuses, etc.) may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit may be merely a division of a logical function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or may be integrated into another system, or some subsamples may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form. Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to implement the present embodiment. In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. In the description corresponding to the flowcharts and block diagrams in the figures, operations or steps corresponding to different blocks may also occur in different orders than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two sequential operations or steps may in fact be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. Each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

Claims (10)

1. A service instance invocation method, characterized by comprising:
acquiring a plurality of application environments, wherein at least one service instance is deployed in each application environment, and any two service instances are respectively determined as a service calling end and a service providing end;
establishing a registration center corresponding to each application environment, and performing service registration on corresponding service instances by using the registration center to obtain service instance addresses corresponding to each service instance;
establishing proxy service, connecting each registration center by using the proxy service, and establishing a service address table according to service instance addresses in each registration center;
and matching the service calling terminal from the service address table of the proxy service to obtain a target address corresponding to the service providing terminal, and calling the service providing terminal through the target address.
2. The method of claim 1, wherein building a service address table from the service instance addresses in each of the registries comprises:
acquiring service instance information corresponding to each service instance from each registration center by using the proxy service, wherein the service instance information comprises an instance name of the service instance, an application environment corresponding to the service instance and a service instance address corresponding to the service administration;
and generating a service address table according to the service instance information corresponding to each service instance.
3. The method of claim 2, wherein after establishing a service address table based on the service instance address in each of the registries, the method further comprises at least one of:
after a preset time interval, the proxy service is used for reacquiring service instance information corresponding to each service instance from each registration center, and the service address table is updated according to the reacquired service instance information;
and monitoring each registration center by using the proxy service, responding to the existence of new service instance information in any registration center, and adding the new service instance information into the service address table.
4. The method of claim 2, wherein obtaining, by using the service invocation end, the target address corresponding to the service provider from the service address table of the proxy service in a matching manner includes:
acquiring a target name and a target environment corresponding to the service provider by using the service calling terminal;
generating an address acquisition request according to the target name and the target environment, and sending the address acquisition request to the proxy service, so that the proxy service matches the received target name and the target environment according to the service address table to obtain a target address corresponding to the service provider, wherein an instance name corresponding to the target address is the same as the target name, and an application environment corresponding to the target address is the same as the target environment;
and receiving the target address fed back by the proxy service.
5. The method according to any one of claims 1 to 4, wherein before the target address corresponding to the service provider is obtained by matching from the service address table of the proxy service by using the service invocation end, the method further comprises:
determining the application environment of the service calling end as a first environment, and determining the application environment of the service providing end as a second environment;
comparing the first environment with the second environment to obtain an environment comparison result;
if the environment comparison results comprise the same, acquiring a target address corresponding to the service provider from a corresponding registration center by using the service calling end;
and if the environment comparison results comprise different environment comparison results, matching the service calling end from a service address table of the proxy service to obtain a target address corresponding to the service providing end.
6. The method according to any of claims 1 to 4, characterized in that the connection between the proxy service and the registry is established by:
acquiring connection information corresponding to the registration center, wherein the connection information comprises at least one of a registration center address, a user account and a user password;
and generating a connection request according to the user account and the user password by using the proxy service, sending the connection request to a registration center address corresponding to the registration center, so that the registration center performs user authentication on the received user account and the user password according to preset user information, and establishing a connection link between the proxy service and the registration center after the authentication is passed, wherein the preset user information comprises at least one preset account and the preset password corresponding to the preset account.
7. The method according to any one of claims 1 to 4, wherein invoking the service provider by a target address comprises:
acquiring a service implementation method corresponding to the target address;
and establishing a service calling request corresponding to the target address according to the service implementation method, and sending the service calling request to the target address so as to execute the service implementation method.
8. A service instance invocation system, comprising:
the system comprises an acquisition module, a service calling module and a service providing module, wherein the acquisition module is used for acquiring a plurality of application environments, at least one service instance is deployed in each application environment, and any two service instances are respectively determined as a service calling end and a service providing end;
the registry module is used for establishing a registry corresponding to each application environment, and performing service registration on corresponding service instances by using the registry to obtain service instance addresses corresponding to each service instance;
the agent module is used for establishing agent service, connecting each registration center by using the agent service and establishing a service address table according to service instance addresses in each registration center;
and the calling module is used for obtaining a target address corresponding to the service provider by matching the service calling terminal from the service address table of the proxy service and calling the service provider through the target address.
9. An electronic device, comprising: a processor and a memory;
the memory is configured to store a computer program and the processor is configured to execute the computer program stored by the memory to cause the electronic device to perform the method of any of claims 1 to 7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that:
the computer program, when executed by a processor, implements the method of any one of claims 1 to 7.
CN202211296973.5A 2022-10-21 2022-10-21 Service instance calling method, system, electronic equipment and readable storage medium Pending CN115866009A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211296973.5A CN115866009A (en) 2022-10-21 2022-10-21 Service instance calling method, system, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211296973.5A CN115866009A (en) 2022-10-21 2022-10-21 Service instance calling method, system, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN115866009A true CN115866009A (en) 2023-03-28

Family

ID=85661730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211296973.5A Pending CN115866009A (en) 2022-10-21 2022-10-21 Service instance calling method, system, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115866009A (en)

Similar Documents

Publication Publication Date Title
CN110149388B (en) Method, device and equipment for connecting HTTPDNS (hypertext transport protocol version transport protocol DNS) server
US9497274B2 (en) Extending functionality of web-based applications
US20210256431A1 (en) Methods for unlocking shared bikes
US20040122774A1 (en) Method and system for executing applications on a mobile device
CN110377440B (en) Information processing method and device
CN110071933B (en) Secure socket layer acceleration method, device, equipment and readable storage medium
WO2019015272A1 (en) Information processing method and device
US20220043898A1 (en) Methods and apparatuses for acquiring information
US9910724B2 (en) Fast and accurate identification of message-based API calls in application binaries
US20190108163A1 (en) Database expansion system, equipment, and method of expanding database
CN112202744B (en) Multi-system data communication method and device
CN110795343A (en) Test system, test method and computing device
US20200053084A1 (en) Intelligent redirection of authentication devices
CN108733527B (en) System, method and apparatus for testing server functionality
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN112714042B (en) Pressure testing method and device, electronic equipment and storage medium
CN112202605A (en) Service configuration method, device, equipment and storage medium
CN115866009A (en) Service instance calling method, system, electronic equipment and readable storage medium
CN113783966B (en) Data transmission method and device, readable medium and electronic equipment
CN115599669A (en) Debugging method and device of microservice, electronic equipment and readable storage medium
CN112732547B (en) Service testing method and device, storage medium and electronic equipment
CN114398035A (en) Method, apparatus, device and computer readable medium for providing service using component
CN113765983A (en) Site service deployment method and device
CN112685075A (en) Gray scale distribution method and device, electronic equipment and computer readable medium
CN112527669A (en) Self-testing method and system for local service

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