CN114217883A - Service registration method and method for calling service according to registration information - Google Patents
Service registration method and method for calling service according to registration information Download PDFInfo
- Publication number
- CN114217883A CN114217883A CN202111509321.0A CN202111509321A CN114217883A CN 114217883 A CN114217883 A CN 114217883A CN 202111509321 A CN202111509321 A CN 202111509321A CN 114217883 A CN114217883 A CN 114217883A
- Authority
- CN
- China
- Prior art keywords
- service
- services
- registration
- information
- private information
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4482—Procedural
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a service registration method and a method for calling service according to registration information. The invention comprises the following steps: splitting and grouping a plurality of services to obtain a plurality of service groups and a plurality of private information corresponding to the plurality of service groups; the service group is registered with a registration center to obtain corresponding registration information; and registering the private information corresponding to the service group to the registration center. The invention solves the problem that services and instances are respectively registered in the registration center in the related technology, and the registration center has too much pressure when the services and the instances needing to be registered reach a certain number.
Description
Technical Field
The invention relates to the field of service registration, in particular to a service registration method and a method for calling a service according to registration information.
Background
In the related art, under the micro-service framework, when the number of services and instances reaches a certain number, it is a very big challenge for the registry. Such as: there are 2000 services, 2000 instances of each service, which is 400 ten thousand instances to the registry, which has difficulty carrying this many instances.
In view of the above problems in the related art, no effective solution has been proposed.
Disclosure of Invention
The main objective of the present invention is to provide a service registration method and a method for invoking a service according to registration information, so as to solve the problem that in the related art, services and instances are respectively registered in a registration center, and when the number of the services and instances to be registered reaches a certain number, the registration center is under too much pressure.
In order to achieve the above object, according to one aspect of the present invention, there is provided a service registration method. The invention comprises the following steps: the method comprises the steps that a plurality of services are split and grouped to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, wherein the service groups comprise the services, and the private information comprises mapping relations between the services in each service group and example information corresponding to the services and service fields corresponding to the services; performing service registration on the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises services correspondingly provided by the service group and example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example; and registering the private information corresponding to the service group to the registration center.
Further, the splitting the plurality of services to obtain the plurality of service groups comprises at least one of: determining example information corresponding to each service, and determining a plurality of services with consistent example information as a service group; and determining an application package corresponding to the service, and determining a plurality of services belonging to the same application package as a service group.
Further, after registering the private information corresponding to the service group to the registry, the method further includes: caching private information corresponding to the service group to a preset position; when the mapping relation between any service and any instance in the service group and/or the service field corresponding to any service is detected to be changed, obtaining the change information corresponding to the change; and updating the private information of the preset position according to the change information.
To achieve the above object, according to one aspect of the present invention, there is provided a method of calling a service according to registration information. The invention comprises the following steps: determining target private information associated with the service to be called, wherein the private information comprises mapping relations between a plurality of services in each service group and instance information corresponding to the plurality of services and service fields corresponding to the plurality of services; determining a target service group corresponding to the target private information, wherein the target service group comprises a service to be called; and acquiring an instance corresponding to the service to be called according to the target service group, and calling the service to be called deployed on the instance.
Further, prior to determining the target private information associated with the service to be invoked, the method includes: and obtaining the private information from the preset position in which the private information is cached.
Further, before determining the target private information associated with the service to be invoked, the method further comprises: subscribing private information; and receiving reminding information triggered by change when the mapping relation between any service corresponding to the private information and any instance is detected and/or the service field corresponding to any service is changed.
In order to achieve the above object, according to another aspect of the present invention, there is provided a service registration apparatus. The device includes: the system comprises a splitting unit, a storage unit and a processing unit, wherein the splitting unit is used for splitting and grouping a plurality of services to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, the service groups comprise a plurality of services, and the private information comprises mapping relations between the plurality of services in each service group and example information corresponding to the plurality of services and service fields corresponding to the plurality of services; the registration unit is used for registering the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises the service correspondingly provided by the service group and the example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example; and a registration unit which registers the private information corresponding to the service group to the registration center.
Further, the splitting unit comprises at least one of: the first determining subunit determines the instance information corresponding to each service and determines a plurality of services with consistent instance information as a service group; and the second determining subunit determines the application package corresponding to the service, and determines a plurality of services belonging to the same application package as a service group.
In order to achieve the above object, according to another aspect of the present application, there is provided a computer-readable storage medium including a stored program, wherein the program performs a service registration method of any one of the above.
To achieve the above object, according to another aspect of the present application, there is provided a processor for executing a program, wherein the program performs a service registration method of any one of the above.
The invention adopts the following steps: the method comprises the steps that a plurality of services are split and grouped to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, wherein the service groups comprise the services, and the private information comprises mapping relations between the services in each service group and example information corresponding to the services and service fields corresponding to the services; performing service registration on the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises services correspondingly provided by the service group and example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example; the private information corresponding to the service group is registered to the registration center, so that the problem that the registration center is stressed too much when the services and the instances which need to be registered reach a certain number in the related technology are respectively registered to the registration center is solved, and the effect of relieving the pressure of the registration center is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a flowchart of a service registration method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a relationship between a service, a service group, and private information provided by an embodiment of the present application;
FIG. 3 is a flowchart of a method for invoking a service according to registration information according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the interaction of service providers and service consumers with a registry, respectively;
fig. 5 is a schematic diagram of a service registration apparatus provided in accordance with an embodiment of the present invention;
fig. 6 is a schematic diagram of an apparatus for invoking a service according to registration information according to an embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged under appropriate circumstances in order to facilitate the description of the embodiments of the invention herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, some terms or expressions referring to the embodiments of the present invention are explained below:
the registration center: and providing a service governance function for realizing service registration and service discovery of each micro-service instance.
Service registration: in a service administration framework, a registry is usually constructed, each service unit registers services provided by the service unit to the registry, the registry is informed of additional information such as a host, a port number, a version number, a communication protocol and the like, and the registry organizes a service list according to service name classification.
According to an embodiment of the present invention, there is provided a service registration method.
Fig. 1 is a flowchart of a service registration method according to an embodiment of the present invention. As shown in fig. 1, the present invention comprises the steps of:
step S101, splitting and grouping a plurality of services to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, wherein the service groups comprise a plurality of services, and the private information comprises mapping relations between the plurality of services and instance information corresponding to the plurality of services in each service group and service fields corresponding to the plurality of services.
Step S102, registering the service group with the registry to obtain a corresponding registration message, wherein the registration message at least includes the service correspondingly provided by the service group, the instance message corresponding to the service group, and the instance message at least includes the port number, version number and communication protocol corresponding to each instance.
The service is service content provided by a service provider, for example, taking a bank as an example, the service is deposit, withdrawal, bill inquiry and the like, where the example is a server deployed in the background, and the example information is information such as a port number, a version number, a communication protocol and the like of the example.
In the embodiment provided by the present application, each service group corresponds to a piece of private information, where the private information includes mapping relationships between services in the service group and instances where the services are deployed, and instance information, and a service field corresponding to each service, for example: the service group 1 comprises a telephone charge checking service and a point checking service, and the corresponding private information comprises embodiment information with the telephone charge checking service and embodiment information with the point checking service, and two service fields of 'telephone charge checking' and 'point checking'.
Step S103, registering the private information corresponding to the service group to the registration center.
By the method, the mapping relation between the plurality of services and the deployed server and the service fields corresponding to the plurality of services are registered in the registration center, the registration center can dynamically add information, the operation is simple, and quick switching is realized for the user to select the service. For example, taking a bank as an example, if the "deposit" service is deployed on servers No. 1, 2, and 3, it means that the "deposit" service has a mapping relationship with servers No. 1, 2, and 3.
Further, when a service consumer calls a service, the private information of a service group corresponding to the service is first found through the registry, and then the instance information of the service deployment to be called is determined through the private information.
In an alternative example, the de-grouping of the plurality of services to obtain the plurality of service groups comprises at least one of: determining example information corresponding to each service, and determining a plurality of services with consistent example information as a service group; and determining an application package corresponding to the service, and determining a plurality of services belonging to the same application package as a service group.
In the above, the plurality of services are split into two service groups, and the basis of splitting the service groups is divided into two types, as follows:
according to one: splitting and grouping a plurality of services according to deployed servers, and determining a plurality of services consistent with the servers as a service group;
according to the second step: and determining a plurality of services belonging to the same application package as a service group, wherein the services of the same series belong to the same application package.
For example, if the "query" service and the "query detail" service provided by the bank are deployed in the same server, the two services are determined to be the same service group. The service of 'printing withdrawal certificate' and the service of 'inquiring the balance in the card' provided by the bank belong to the same series of services, and the two services are determined as the same service group.
In an optional example, after registering the private information corresponding to the service group to the registry, the method further comprises: caching private information corresponding to the service group to a preset position; when the mapping relation between any service and any instance in the service group and/or the service field corresponding to any service is detected to be changed, obtaining the change information corresponding to the change; and updating the private information of the preset position according to the change information.
In the above manner, the private information corresponding to the service group is cached to the preset position, and the user can know the specific service group position when calling the interface of the service provider.
When the relation between any one of the plurality of services and the server where the service is deployed and the service field corresponding to any one of the plurality of services are changed, the private information is changed without extra operation to solve the problem of service discovery, the technical effects of dynamically adding the changed information and updating the private information of the preset position according to the changed information are achieved.
For example, the money withdrawing service provided by the bank has a mapping relationship with servers of 4, 5 and 6 respectively at the preset position in the registry, and after the money withdrawing service provided by the bank has a mapping relationship with servers of 7, 8 and 9 respectively, the original preset position in the registry is updated to the mapping relationship between the inquiry service and the servers of 7, 8 and 9. The updating operation is simple and convenient, no additional operation is needed, and dynamic updating is realized.
Fig. 2 is a schematic diagram of a relationship among services, service groups, and private information provided in an embodiment of the present application, and specifically, as shown in fig. 2, by grouping services to form a plurality of service groups and registering the service groups with a registry, it is implemented that only one registration information is registered for a plurality of services in one service group, and pressure of the registry is reduced.
It should be noted that the registry is a mechanism in the network, verifies the user digital authentication request, issues the authentication through the authentication center, and when the service provider adds nodes, IP changes, and the like, it is not necessary to perform additional operations to solve the problem of service discovery, thereby implementing dynamic joining. The service registration is to register the server, port, version number, communication protocol and the like of the service to the registration center.
According to an embodiment of the present invention, there is provided a method of invoking a service according to registration information.
Fig. 3 is a flow chart of a method for invoking a service according to registration information in accordance with an embodiment of the present invention. As shown in fig. 3, the present invention comprises the steps of:
step S301, determining target private information associated with the service to be called, wherein the private information includes mapping relations between a plurality of services in each service group and instance information corresponding to the plurality of services, and service fields corresponding to the plurality of services.
Step S302, a target service group corresponding to the target private information is determined, wherein the target service group comprises a service to be called.
Step S303, obtaining an instance corresponding to the service to be called according to the target service group, and calling the service to be called deployed on the instance.
In the above, when a service to be called is received, the private information corresponding to the service to be called is determined, where the service to be called and other services form a service group and submit a service registration to the registration center, the service group corresponds to a piece of private information, and the private information includes a mapping relationship between the service in the service group and an instance in which the service is deployed and a service field corresponding to each service, that is, the instance in which the service to be called is deployed can be obtained through the private information.
For example, when a user wants to withdraw money from a bank, the machine side calls a withdrawal service by acquiring private information corresponding to a withdrawal service when receiving a withdrawal service request.
In the above way, the user calls through the target service group according to personal requirements, and acquires and deploys the instances of the service to be called through private information.
In an alternative example, prior to determining the target private information associated with the service to be invoked, the method includes: and obtaining the private information from the preset position in which the private information is cached.
In the above manner, the private information party caches the preset position of the registration center, acquires the private information corresponding to the service group corresponding to the service to be called, and needs to perform an acquisition operation from the preset position in which the private information is cached.
In an optional example, before determining the target private information associated with the service to be invoked, the method further comprises: subscribing private information; and receiving reminding information triggered by change when the mapping relation between any service corresponding to the private information and any instance is detected and/or the service field corresponding to any service is changed.
In the above manner, the user subscribes the private information, and when the mapping relationship between the plurality of services and the deployed server and the service fields corresponding to the plurality of services change, the change information is updated to the private information, so that no error occurs when the service consumer calls the private information, and the calling efficiency is improved.
The service registration method provided by the embodiment of the invention obtains a plurality of service groups and a plurality of private information corresponding to the service groups by splitting and grouping a plurality of services, wherein the service groups comprise a plurality of services, and the private information comprises mapping relations between the plurality of services and example information corresponding to the plurality of services in each service group and service fields corresponding to the plurality of services; performing service registration on the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises services correspondingly provided by the service group and example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example; the private information corresponding to the service group is registered to the registration center, so that the problem that the registration center is stressed too much when the services and the instances which need to be registered reach a certain number in the related technology are respectively registered to the registration center is solved, and the effect of relieving the pressure of the registration center is achieved.
Fig. 4 is an interaction schematic diagram of a service provider and a service consumer with a registry, respectively, where the service provider provides a service for a user, performs service registration with the registry to obtain a piece of corresponding registration information, and registers private information corresponding to a service group in the registry. The user determines and subscribes the target private information associated with the service to be called, and the registration pressure of the registration center is reduced through the embodiment.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
The embodiment of the present invention further provides a service registration apparatus, and it should be noted that the service registration apparatus of the embodiment of the present invention may be used to execute the service registration method provided by the embodiment of the present invention. A service registration apparatus according to an embodiment of the present invention is described below.
Fig. 5 is a schematic diagram of a service registration apparatus according to an embodiment of the present invention. As shown in fig. 5, the apparatus includes: the splitting unit 501 splits and groups a plurality of services to obtain a plurality of service groups and a plurality of private information corresponding to the plurality of service groups, where a service group includes a plurality of services, and the private information includes mapping relationships between the plurality of services in each service group and instance information corresponding to the plurality of services and service fields corresponding to the plurality of services; a registration unit 502, configured to perform service registration on a service group with a registration center to obtain a piece of corresponding registration information, where the registration information at least includes a service correspondingly provided by the service group, instance information corresponding to the service group, and the instance information at least includes a port number, a version number, and a communication protocol corresponding to each instance; the registration unit 503 registers the private information corresponding to the service group in the registry.
In an alternative example, the splitting unit 501 includes at least one of: the first determining subunit determines the instance information corresponding to each service and determines a plurality of services with consistent instance information as a service group; and the second determining subunit determines the application package corresponding to the service, and determines a plurality of services belonging to the same application package as a service group.
In an optional example, the apparatus further comprises: the cache unit caches the private information corresponding to the service group to a preset position after registering the private information corresponding to the service group to the registration center; the first obtaining unit is used for obtaining change information corresponding to change when the mapping relation between any service and any instance in the service group is detected and/or the service field corresponding to any service is changed; and the updating unit updates the private information of the preset position according to the change information.
The embodiment of the present invention further provides a device for invoking a service according to registration information, and it should be noted that the device for invoking a service according to registration information of the embodiment of the present invention can be used for executing the method for invoking a service according to registration information provided by the embodiment of the present invention. A device for invoking a service according to registration information according to an embodiment of the present invention is described below.
Fig. 6 is a diagram illustrating an apparatus for invoking a service according to registration information according to an embodiment of the present invention. As shown in fig. 6, the apparatus includes: the first determining unit 601 is configured to determine target private information associated with a service to be called, where the private information includes mapping relationships between multiple services in each service group and instance information corresponding to the multiple services, and service fields corresponding to the multiple services; a second determining unit 602, configured to determine a target service group corresponding to the target private information, where the target service group includes a service to be invoked; the second obtaining unit 603 obtains an instance corresponding to the service to be invoked according to the target service group, and invokes the service to be invoked deployed on the instance.
In an alternative example, the apparatus comprises: and the third acquisition unit is used for acquiring the private information from the preset position in which the private information is cached before determining the target private information associated with the service to be called.
In an optional example, the apparatus further comprises: the subscription unit subscribes the private information before determining the target private information associated with the service to be called; and the receiving unit is used for receiving the reminding information triggered by the change when the mapping relation between any service corresponding to the private information and any instance is detected and/or the service field corresponding to any service is changed.
The service registration device provided by the embodiment of the invention obtains a plurality of service groups and a plurality of private information corresponding to the service groups by splitting and grouping a plurality of services, wherein the service groups comprise a plurality of services, and the private information comprises mapping relations between the plurality of services and example information corresponding to the plurality of services in each service group and service fields corresponding to the plurality of services; performing service registration on the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises services correspondingly provided by the service group and example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example; the private information corresponding to the service group is registered to the registration center, so that the problem that the registration center is stressed too much when the services and the instances which need to be registered reach a certain number in the related technology are respectively registered to the registration center is solved, and the effect of relieving the pressure of the registration center is achieved.
The service registration apparatus includes a processor and a memory, the splitting unit 501 and the like are stored in the memory as a program unit, and the processor executes the program unit stored in the memory to implement a corresponding function.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the technical problem that services and instances are respectively registered in a registry in the related art is solved by adjusting kernel parameters, and the registry is stressed too much when the services and the instances needing to be registered reach a certain number.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a computer-readable storage medium on which a program is stored, which, when executed by a processor, implements the service registration method.
The embodiment of the invention provides a processor, which is used for running a program, wherein the service registration method is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps: the method comprises the steps that a plurality of services are split and grouped to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, wherein the service groups comprise the services, and the private information comprises mapping relations between the services in each service group and example information corresponding to the services and service fields corresponding to the services; performing service registration on the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises services correspondingly provided by the service group and example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example; and registering the private information corresponding to the service group to the registration center.
In an alternative example, the de-grouping of the plurality of services to obtain the plurality of service groups comprises at least one of: determining example information corresponding to each service, and determining a plurality of services with consistent example information as a service group; and determining an application package corresponding to the service, and determining a plurality of services belonging to the same application package as a service group.
In an optional example, after registering the private information corresponding to the service group to the registry, the method further comprises: caching private information corresponding to the service group to a preset position; when the mapping relation between any service and any instance in the service group and/or the service field corresponding to any service is detected to be changed, obtaining the change information corresponding to the change; and updating the private information of the preset position according to the change information.
Determining target private information associated with the service to be called, wherein the private information comprises mapping relations between a plurality of services in each service group and instance information corresponding to the plurality of services and service fields corresponding to the plurality of services; determining a target service group corresponding to the target private information, wherein the target service group comprises a service to be called; and acquiring an instance corresponding to the service to be called according to the target service group, and calling the service to be called deployed on the instance.
In an alternative example, prior to determining the target private information associated with the service to be invoked, the method includes: and obtaining the private information from the preset position in which the private information is cached.
In an optional example, before determining the target private information associated with the service to be invoked, the method further comprises: subscribing private information; and receiving reminding information triggered by change when the mapping relation between any service corresponding to the private information and any instance is detected and/or the service field corresponding to any service is changed.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The invention also provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: the method comprises the steps that a plurality of services are split and grouped to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, wherein the service groups comprise the services, and the private information comprises mapping relations between the services in each service group and example information corresponding to the services and service fields corresponding to the services; performing service registration on the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises services correspondingly provided by the service group and example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example; and registering the private information corresponding to the service group to the registration center.
In an alternative example, the de-grouping of the plurality of services to obtain the plurality of service groups comprises at least one of: determining example information corresponding to each service, and determining a plurality of services with consistent example information as a service group; and determining an application package corresponding to the service, and determining a plurality of services belonging to the same application package as a service group.
In an optional example, after registering the private information corresponding to the service group to the registry, the method further comprises: caching private information corresponding to the service group to a preset position; when the mapping relation between any service and any instance in the service group and/or the service field corresponding to any service is detected to be changed, obtaining the change information corresponding to the change; and updating the private information of the preset position according to the change information.
Determining target private information associated with the service to be called, wherein the private information comprises mapping relations between a plurality of services in each service group and instance information corresponding to the plurality of services and service fields corresponding to the plurality of services; determining a target service group corresponding to the target private information, wherein the target service group comprises a service to be called; and acquiring an instance corresponding to the service to be called according to the target service group, and calling the service to be called deployed on the instance.
In an alternative example, prior to determining the target private information associated with the service to be invoked, the method includes: and obtaining the private information from the preset position in which the private information is cached.
In an optional example, before determining the target private information associated with the service to be invoked, the method further comprises: subscribing private information; and receiving reminding information triggered by change when the mapping relation between any service corresponding to the private information and any instance is detected and/or the service field corresponding to any service is changed.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present invention, and are not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims (10)
1. A method of service registration, comprising:
splitting and grouping a plurality of services to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, wherein the service groups comprise a plurality of services, and the private information comprises mapping relations between the plurality of services and instance information corresponding to the plurality of services in each service group and service fields corresponding to the plurality of services;
performing service registration on the service group to a registration center to obtain corresponding registration information, wherein the registration information at least comprises services correspondingly provided by the service group and example information corresponding to the service group, and the example information at least comprises a port number, a version number and a communication protocol corresponding to each example;
registering the private information corresponding to the service group to the registration center.
2. The method of claim 1, wherein the split-grouping of the plurality of services to obtain the plurality of service groups comprises at least one of:
determining instance information corresponding to each service, and determining a plurality of services with the same instance information as one service group;
and determining an application package corresponding to the service, and determining a plurality of services belonging to the same application package as one service group.
3. The method of claim 1, wherein after registering the private information corresponding to the service group with the registry, the method further comprises:
caching the private information corresponding to the service group to a preset position;
when detecting the mapping relation between any one of the services in the service group and any one of the instances and/or the change of the service field corresponding to any one of the services, acquiring the change information corresponding to the change;
and updating the private information of the preset position according to the change information.
4. A method for invoking a service based on registration information, comprising:
determining target private information associated with a service to be called, wherein the private information comprises mapping relations between a plurality of services in each service group and instance information corresponding to the plurality of services and service fields corresponding to the plurality of services;
determining a target service group corresponding to the target private information, wherein the target service group comprises the service to be called;
and acquiring an instance corresponding to the service to be called according to the target service group, and calling the service to be called deployed on the instance.
5. The method of claim 4, wherein prior to determining the target private information associated with the service to be invoked, the method comprises:
and obtaining the private information from the preset position in which the private information is cached.
6. The method of claim 4, wherein prior to determining the target private information associated with the service to be invoked, the method comprises:
subscribing to the private information;
and receiving reminding information triggered by the change when the mapping relation between any service corresponding to the private information and any instance is detected and/or the service field corresponding to any service is changed.
7. A service registration apparatus, comprising:
the system comprises a splitting unit, a storage unit and a processing unit, wherein the splitting unit is used for splitting and grouping a plurality of services to obtain a plurality of service groups and a plurality of private information corresponding to the service groups, the service groups comprise a plurality of services, and the private information comprises mapping relations between a plurality of services and example information corresponding to the services in each service group and service fields corresponding to the services;
a registration unit, configured to perform service registration on the service group with a registration center to obtain a piece of corresponding registration information, where the registration information at least includes a service correspondingly provided by the service group, instance information corresponding to the service group, and the instance information at least includes a port number, a version number, and a communication protocol corresponding to each instance;
a registration unit that registers the private information corresponding to the service group to the registry.
8. The apparatus of claim 7, wherein the splitting unit comprises at least one of:
the first determining subunit determines instance information corresponding to each service, and determines a plurality of services with the same instance information as one service group;
and a second determining subunit, configured to determine an application package corresponding to the service, and determine, as one service group, a plurality of services belonging to the same application package.
9. A computer-readable storage medium, comprising a stored program, wherein the program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform a service registration method according to any one of claims 1 to 3.
10. A processor configured to execute a program, wherein the program executes the service registration method according to any one of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111509321.0A CN114217883A (en) | 2021-12-10 | 2021-12-10 | Service registration method and method for calling service according to registration information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111509321.0A CN114217883A (en) | 2021-12-10 | 2021-12-10 | Service registration method and method for calling service according to registration information |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114217883A true CN114217883A (en) | 2022-03-22 |
Family
ID=80700962
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111509321.0A Pending CN114217883A (en) | 2021-12-10 | 2021-12-10 | Service registration method and method for calling service according to registration information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114217883A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114827295A (en) * | 2022-04-26 | 2022-07-29 | 北京奇艺世纪科技有限公司 | Service registration method, registration center, system and readable storage medium |
-
2021
- 2021-12-10 CN CN202111509321.0A patent/CN114217883A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114827295A (en) * | 2022-04-26 | 2022-07-29 | 北京奇艺世纪科技有限公司 | Service registration method, registration center, system and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111163129B (en) | Resource processing method and device based on cross-link network | |
CN110086944B (en) | Communication method and device based on virtual number | |
CN109669709B (en) | Data migration method and data migration system for block chain upgrading | |
CN110472438B (en) | Transaction data processing and transaction inquiring method, device and equipment based on blockchain | |
EP2778968B1 (en) | Mobile telecommunication device remote access to cloud-based or virtualized database systems | |
CN106921712B (en) | Service processing method and device | |
US20160149854A1 (en) | Framework for Application to Application Interworking in the M2M World | |
CN114172966A (en) | Service calling method and device and service processing method and device under unitized architecture | |
CN114217883A (en) | Service registration method and method for calling service according to registration information | |
CN115545639B (en) | Financial business processing method, device, electronic equipment and storage medium | |
CN115811481B (en) | Interactive service testing method and device, computer equipment and storage medium | |
CN110417919A (en) | A kind of flow abduction method and device | |
CN112491943A (en) | Data request method, device, storage medium and electronic equipment | |
CN115934292A (en) | Calling method, device and equipment of microservice application | |
CN116647552A (en) | Service processing method and system in heterogeneous micro-service cluster, terminal and storage medium | |
CN115018499A (en) | Block chain-based digital certificate issuing method, device and system | |
CN109788015A (en) | Application service invocation system, method and device | |
CN110753082B (en) | Service calling method and terminal equipment | |
CN113469814A (en) | Method and device for determining transaction duration data | |
CN108920277B (en) | Service execution system, method and device and service isolation system | |
CN106681771B (en) | System reinstallation method and device | |
CN113129025A (en) | Data resource registration and transaction management method and device based on identification | |
CN113986955B (en) | Service chain determining method and device, electronic equipment and medium | |
CN114328028A (en) | Method and device for positioning active physical unit according to transaction request | |
CN115374023B (en) | Unit addressing method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |