Disclosure of Invention
The application provides a method and a device for configuring a synchronous interface in a multi-environment, which aim to solve the problem that the efficiency of the configuration of the synchronous interface is low in the prior art.
According to the embodiment of the application, a method for configuring a synchronous interface in multiple environments is provided, and the method comprises the following steps:
determining an environment Y to be synchronized after a new interface is input into any environment X, wherein the environment Y is any environment except the environment X in the multiple environments;
configuring the environment to be synchronized of the environment X as the address of the environment Y, and configuring the interface configuration pull environment of the environment Y as the address of the environment X, thereby establishing the relation between the environment X and the environment Y;
the environment X sends a synchronization request of the interface to an environment Y to be synchronized;
after receiving the synchronous request, the environment Y initiates a pull request of interface configuration to an interface configuration pull environment X;
after receiving the pull request, the environment X returns the interface configuration of the new input interface to the environment Y;
and after receiving the returned interface configuration, the environment Y records the interface configuration so as to be used by a gateway of the environment Y.
Optionally, after receiving the pull request, the environment X returns the interface configuration of the new entry interface to the environment Y, which specifically includes:
after receiving the pull request, the environment X acquires the interface configuration of the new entry interface from a core configuration system corresponding to the environment X, and returns the interface configuration to the environment Y, wherein the core configuration system is used for recording the interface configuration;
after receiving the returned interface configuration, the environment Y records the interface configuration, and specifically includes:
and after receiving the returned interface configuration, the environment Y records the interface configuration into a core configuration system corresponding to the environment Y.
Optionally, the request is an HTTP request.
According to the embodiment of the application, a method for configuring a synchronous interface in multiple environments is provided, and the method comprises the following steps:
determining an environment Y to be synchronized after a new interface is input into an environment X, wherein the environment Y is any environment except the environment X in the multiple environments;
configuring an environment to be synchronized as an address of the environment Y;
sending a synchronization request of the interface to an environment Y to be synchronized;
and after receiving a pulling request of the interface configuration initiated by the environment Y, returning the interface configuration of the new input interface to the environment Y.
Optionally, after receiving a pull request of the interface configuration initiated by the environment Y, returning the interface configuration of the new entry interface to the environment Y, specifically including:
and after receiving a pull request initiated by the environment Y, acquiring the interface configuration of the new input interface from a core configuration system corresponding to the environment X, and returning the interface configuration to the environment Y, wherein the core configuration system is used for recording the interface configuration.
Optionally, the request is an HTTP request.
According to the embodiment of the application, a method for configuring a synchronous interface in multiple environments is provided, and the method comprises the following steps:
after determining an environment Y to be synchronized, configuring an interface configuration pull environment of the environment Y as an address of an environment X of a new input interface;
after receiving a synchronization request aiming at the new input interface sent by the environment X, initiating a pulling request of interface configuration to the interface configuration pulling environment X;
and after receiving the interface configuration returned by the environment X, recording the interface configuration for the gateway of the environment Y to use.
Optionally, the recording the interface configuration specifically includes:
recording the interface configuration into a core configuration system corresponding to the environment Y; wherein, the core configuration system is used for recording interface configuration.
Optionally, the request is an HTTP request.
According to the embodiment of the application, a device for configuring a synchronous interface in multiple environments is provided, and the device comprises:
the device comprises a to-be-synchronized environment determining unit, a synchronization unit and a synchronization unit, wherein the to-be-synchronized environment determining unit determines an environment Y to be synchronized after a new interface is input into an environment X, and the environment Y is any environment except the environment X in the multiple environments;
the environment to be synchronized is configured as the address of the environment Y by the environment to be synchronized configuration unit;
the synchronous request sending unit is used for sending a synchronous request of the interface to the environment Y to be synchronized;
and the interface configuration returning unit returns the interface configuration of the new input interface to the environment Y after receiving the pull request of the interface configuration initiated by the environment Y.
Optionally, the interface configuration returning unit specifically includes:
and the interface configuration returning subunit is configured to, after receiving the pull request initiated by the environment Y, obtain the interface configuration of the new entry interface from the core configuration system corresponding to the environment X, and return the interface configuration to the environment Y, where the core configuration system is configured to record the interface configuration.
Optionally, the request is an HTTP request.
According to the embodiment of the application, a device for configuring a synchronous interface in multiple environments is provided, and the device comprises:
the pull environment configuration unit is used for configuring an interface configuration pull environment of an environment Y into an address of an environment X of a new input interface after the environment Y to be synchronized is determined;
a pull request initiating unit, configured to initiate a pull request of interface configuration to the interface configuration pull environment X after receiving a synchronization request for the new entry interface sent by the environment X;
and the interface configuration recording unit is used for recording the interface configuration after receiving the interface configuration returned by the environment X so as to be used by the gateway of the environment Y.
Optionally, the interface configuration recording unit specifically includes:
the interface configuration recording subunit records the interface configuration to a core configuration system corresponding to the environment Y after receiving the interface configuration returned by the environment X, so as to be used by a gateway of the environment Y; wherein, the core configuration system is used for recording interface configuration.
Optionally, the request is an HTTP request.
In the embodiment of the application, the to-be-synchronized environment of the environment X is configured to be the address of the environment Y, and the interface configuration of the environment Y is pulled to configure the environment to be the address of the environment X, so that the relation between the environment X and the environment Y is established, the isolation between different environments can be bypassed, the interface configuration can be automatically synchronized to other environments Y after any one environment X is newly configured with one interface under multiple environments, and the efficiency of the configuration of the synchronous interface is greatly improved; the problems that a manual mode is easy to make mistakes and the labor cost is high are solved; moreover, consistency of interface configuration in different environments is facilitated to be maintained.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
To solve the above problem, please refer to fig. 1, which is a flowchart of a method for configuring a synchronous interface in multiple environments according to an embodiment of the present application, the method includes the following steps:
step 110: after an interface is newly recorded in any environment X, determining an environment Y to be synchronized, wherein the environment Y is any environment except the environment X in the multiple environments.
In this embodiment, the interface is a software-oriented interface, and is generally a specific calling specification that some application or program provides all or part of its service to the outside, and may include various calling forms, such as HTTP call, js call, sdk call, and the like.
The number of determined environments Y to be synchronized may be 1 or more.
For example, all other environments except the environment X in the multi-environment may be determined as the environment Y to be synchronized.
Alternatively, it may be determined 1 or more environments Y to be synchronized according to a user instruction.
Step 120: and configuring the environment to be synchronized of the environment X as the address of the environment Y, and configuring the interface configuration pull environment of the environment Y as the address of the environment X, thereby establishing the relation between the environment X and the environment Y.
In this embodiment, the address of the environment Y may be an HTTP address or an HTTP address of the environment Y;
similarly, the address of the environment X may be an HTTP address or an HTTP address of the environment X.
By configuring the environment to be synchronized of the environment X as the address of the environment Y, the environment X can be enabled to initiate to the environment Y
Step 130: and the environment X sends a synchronization request of the interface to the environment Y to be synchronized.
In this embodiment, since the to-be-synchronized environment of the environment X is configured as the address of the environment Y in step 120, the environment X may send the synchronization request of the interface to the to-be-synchronized environment Y.
The synchronous request is used for prompting the environment Y, a new interface is input in the i environment X, and the interface configuration of the interface can be pulled from the environment X, so that the purpose of synchronous interface configuration is fulfilled.
Generally, the synchronization request may be, for example, an HTTP request, or the like.
Step 140: and after receiving the synchronous request, the environment Y initiates a pull request of the interface configuration to an interface configuration pull environment X.
In this embodiment, since the interface configuration pull environment of the environment Y is configured as the address of the environment X in step 120, the environment Y may initiate a pull request of the interface configuration to the interface configuration pull environment X after receiving the interface synchronization request sent by the environment X.
And the pulling request is used for pulling the interface configuration of the new input interface to the environment X, so that the aim of synchronizing the interface configuration is fulfilled.
Generally, the pull request may be, for example, an HTTP request, or the like.
Step 150: and after receiving the pulling request, the environment X returns the interface configuration of the new entry interface to the environment Y.
Step 160: and after receiving the returned interface configuration, the environment Y records the interface configuration so as to be used by a gateway of the environment Y.
In this embodiment, the interface configuration includes a basic configuration, a distribution configuration, and the like.
The basic configuration can comprise basic information such as interface name, parameters, type and the like;
the distribution configuration may include the address, manner in which the interface service route is provided.
In general, the gateway may route to a corresponding interface service system, which is a system providing interface services, according to the distribution configuration.
According to the embodiment of the application, the to-be-synchronized environment of the environment X is configured to be the address of the environment Y, and the interface configuration of the environment Y is pulled to configure the environment to be the address of the environment X, so that the relation between the environment X and the environment Y is established, the isolation between different environments can be bypassed, the interface configuration can be automatically synchronized to other environments Y after any one environment X is newly configured with one interface under multiple environments, and the efficiency of synchronous interface configuration is greatly improved; the problems that a manual mode is easy to make mistakes and the labor cost is high are solved; moreover, consistency of interface configuration in different environments is facilitated to be maintained.
In practical application, each environment may correspond to a core configuration system for recording interface configuration.
Therefore, the step 150 may specifically include:
and after receiving the pull request, the environment X acquires the interface configuration of the new input interface from a core configuration system corresponding to the environment X and returns the interface configuration to the environment Y.
Correspondingly, the step 160 may specifically include:
and after receiving the returned interface configuration, the environment Y records the interface configuration into a core configuration system corresponding to the environment Y.
An embodiment of the method based on environment X of the present application is described below with reference to fig. 2, and the embodiment may correspond to fig. 1:
step 210: determining an environment Y to be synchronized after a new interface is input into an environment X, wherein the environment Y is any environment except the environment X in a multi-environment;
step 220: configuring an environment to be synchronized as an address of the environment Y;
step 230: sending a synchronization request of the interface to an environment Y to be synchronized;
step 240: and after receiving a pulling request of the interface configuration initiated by the environment Y, returning the interface configuration of the new input interface to the environment Y.
As in the foregoing embodiment, in this embodiment, the address of the environment Y may be an HTTP address or an HTTP address of the environment Y.
The number of the determined environments Y to be synchronized is 1 or more.
The synchronization request may be, for example, an HTTP request, or the like.
In a specific embodiment, the step 240 may specifically include:
and after receiving a pull request initiated by the environment Y, acquiring the interface configuration of the new input interface from a core configuration system corresponding to the environment X, and returning the interface configuration to the environment Y, wherein the core configuration system is used for recording the interface configuration.
An embodiment of the method based on environment Y of the present application is described below with reference to fig. 3, and the embodiment may correspond to fig. 1:
step 310: after determining an environment Y to be synchronized, configuring an interface configuration pull environment of the environment Y as an address of an environment X of a new input interface;
step 320: after receiving a synchronization request aiming at the new input interface sent by the environment X, initiating a pulling request of interface configuration to the interface configuration pulling environment X;
step 330: and after receiving the interface configuration returned by the environment X, recording the interface configuration for the gateway of the environment Y to use.
As in the foregoing embodiment, in this embodiment, the address of the environment X may be an HTTP address or an HTTP address of the environment X.
The pull request may be, for example, an HTTP request, or the like.
In a specific embodiment, the recording the interface configuration may specifically include:
recording the interface configuration into a core configuration system corresponding to the environment Y; wherein, the core configuration system is used for recording interface configuration.
Corresponding to the foregoing method embodiments for configuring a multi-environment synchronous interface, the present application further provides embodiments of an apparatus for configuring a multi-environment synchronous interface.
Embodiments of the apparatus for synchronizing interface configurations in an environment of the present application may be applied to environment X. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor of the device where the software implementation is located as a logical means. From a hardware aspect, as shown in fig. 4, a hardware structure diagram of a device configured by a synchronization interface in a multi-environment according to the present application is shown, except for the processor, the network interface, the memory, and the nonvolatile memory shown in fig. 4, the device in the embodiment may also include other hardware according to an actual function configured by the synchronization interface in the multi-environment, which is not described again.
Referring to fig. 5, a block diagram of an apparatus for configuring a multi-environment synchronous interface according to an embodiment of the present application is provided, where the apparatus includes: a to-be-synchronized environment determining unit 410, a to-be-synchronized environment configuring unit 420, a synchronization request transmitting unit 430, and an interface configuration returning unit 440.
The to-be-synchronized environment determining unit 410 determines an environment Y to be synchronized after a new interface is entered into an environment X, where the environment Y is any environment except the environment X in the multiple environments;
a to-be-synchronized environment configuration unit 420, configured to configure the to-be-synchronized environment as the address of the environment Y;
a synchronization request sending unit 430, configured to send a synchronization request of the interface to the environment to be synchronized Y;
the interface configuration returning unit 440 returns the interface configuration of the new entry interface to the environment Y after receiving the pull request of the interface configuration initiated by the environment Y.
In an alternative embodiment:
the interface configuration returning unit specifically includes:
and the interface configuration returning subunit is configured to, after receiving the pull request initiated by the environment Y, obtain the interface configuration of the new entry interface from the core configuration system corresponding to the environment X, and return the interface configuration to the environment Y, where the core configuration system is configured to record the interface configuration.
In an alternative embodiment:
the request is an HTTP request.
Corresponding to the foregoing method embodiments for configuring a multi-environment synchronous interface, the present application further provides embodiments of an apparatus for configuring a multi-environment synchronous interface.
Embodiments of the apparatus for synchronizing interface configurations in an environment of the present application may be applied to environment Y. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor of the device where the software implementation is located as a logical means. From a hardware aspect, as shown in fig. 6, a hardware structure diagram of a device configured by a synchronization interface in a multi-environment according to the present application is shown, except for the processor, the network interface, the memory, and the nonvolatile memory shown in fig. 6, the device in the embodiment may also include other hardware according to an actual function configured by the synchronization interface in the multi-environment, which is not described again.
Referring to fig. 7, a block diagram of an apparatus for configuring a multi-environment synchronous interface according to an embodiment of the present application is shown, where the apparatus includes: a pull environment configuration unit 510, a pull request initiation unit 520, and an interface configuration recording unit 530.
A pull environment configuration unit 510, configured to configure, after determining an environment Y to be synchronized, an interface configuration pull environment of the environment Y as an address of an environment X of a newly entered interface;
a pull request initiating unit 520, configured to initiate a pull request of interface configuration to the interface configuration pull environment X after receiving the synchronization request for the new entry interface sent by the environment X;
and an interface configuration recording unit 530, configured to record the interface configuration returned by the environment X for use by the gateway of the environment Y after receiving the interface configuration.
In an alternative embodiment:
the interface configuration recording unit specifically includes:
the interface configuration recording subunit records the interface configuration to a core configuration system corresponding to the environment Y after receiving the interface configuration returned by the environment X, so as to be used by a gateway of the environment Y; wherein the core configuration system is used for recording interface configuration
In an alternative embodiment:
the request is an HTTP request.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the 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 modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.