Service routing method and device, electronic equipment and storage medium

By receiving service call requests from front-end applications and querying the target service instance according to the version number attribute, the problem of shutting down services during the update test of the back-end environment service instance is solved, and efficient processing of continuous service is achieved.

CN119743532APending Publication Date: 2025-04-01CHINA CONSTRUCTION BANK +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411666030.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

When performing service instance update tests in the back-end environment, the service needs to be shut down, resulting in poor service efficiency.

Method used

By receiving service call requests from front-end applications, including service ID and version number attributes, querying the list of service instances corresponding to the service ID, obtaining the target service instance with the version number attribute, and sending the service call request to the target service instance for processing.

Benefits of technology

Without shutting down services, service processing can be implemented to ensure service efficiency, especially when service instance updates and tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743532A_ABST
    Figure CN119743532A_ABST
Patent Text Reader

Abstract

The invention relates to a service routing method and device, electronic equipment and a storage medium, and belongs to the technical field of computers.The method comprises the steps that a service calling request of a front-end application is received; the service calling request comprises a service identifier and a version number attribute; querying a service instance list corresponding to the service identifier according to the version number attribute, and obtaining a target service instance with the version number attribute in the service instance list; sending the service calling request to a target service instance, and indicating the target service instance to perform service processing; obtaining a service processing result of the target service instance, and returning the service processing result to the front-end application; wherein the setting of the version number attribute can realize the coexistence of development and testing or the coexistence of use and testing in the same environment, and avoids the influence of the testing process on the development process or the use process, so that the service does not need to be shut down when the test is needed, and the service efficiency is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a service routing method, device, electronic device and storage medium. Background Art

[0002] At present, for the services in the front-end application, in order to achieve high availability, cluster deployment is adopted in the back-end environment. That is, multiple identical services exist at the same time to implement the same function. When the routing service located between the front-end application and the back-end environment receives the service call request of the front-end application, it randomly selects a service instance from the multiple service instances of the service to be called in the back-end environment for service routing processing to realize the service call.

[0003] In the above solution, when the service instance update test is performed in the backend environment, the service needs to be shut down within a certain period of time, which affects the service efficiency. Summary of the invention

[0004] The present disclosure provides a service routing method, device, electronic device and storage medium to at least solve the problem of poor service efficiency caused by shutting down services when the backend environment performs environment version iteration or service update in the related art. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, a service routing method is provided, the method comprising: receiving a service call request from a front-end application; the service call request comprising a service identifier and a version number attribute; querying a service instance list corresponding to the service identifier according to the version number attribute, and obtaining a target service instance in the service instance list having the version number attribute set therein; sending the service call request to the target service instance, instructing the target service instance to perform service processing; obtaining a service processing result of the target service instance, and returning the service processing result to the front-end application.

[0006] According to a second aspect of an embodiment of the present disclosure, a service routing device is provided, the device comprising: a first receiving module, used to receive a service call request from a front-end application; the service call request comprises a service identifier and a version number attribute; a first acquisition module, used to query a service instance list corresponding to the service identifier according to the version number attribute, and obtain a target service instance with the version number attribute set in the service instance list; a sending module, used to send the service call request to the target service instance, instructing the target service instance to perform service processing; a second acquisition module, used to obtain a service processing result of the target service instance, and return the service processing result to the front-end application.

[0007] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the service routing method as described above.

[0008] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the service routing method as described above.

[0009] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of an electronic device, the electronic device is enabled to execute a service routing method as described above.

[0010] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0011] By receiving a service call request from a front-end application; the service call request includes a service identifier and a version number attribute; querying a service instance list corresponding to the service identifier according to the version number attribute, obtaining a target service instance with a version number attribute set in the service instance list; sending the service call request to the target service instance, instructing the target service instance to perform service processing; obtaining the service processing result of the target service instance, and returning the service processing result to the front-end application; wherein, in the case of a service instance update test in a back-end environment, different version number attributes can be set for service instances that need to be tested and service instances that do not need to be tested, so that the service call request can be routed to the service instance that does not need to be tested, and the service does not need to be shut down, and service processing can be achieved without stopping the service, thereby ensuring service efficiency.

[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0014] Figure 1 is a flow chart of a service routing method according to the first embodiment of the present disclosure;

[0015] Figure 2 is a flowchart of another service routing method according to the second embodiment of the present disclosure;

[0016] Figure 3is a schematic diagram of the structure of a service routing device according to a fourth embodiment of the present disclosure;

[0017] Figure 4 is a block diagram of an electronic device that performs a service routing method. DETAILED DESCRIPTION

[0018] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0020] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0021] It should be noted that in the embodiments of the present disclosure, certain software, components, models and other existing solutions in the industry may be mentioned, which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0022] Figure 1 is a flow chart of a service routing method according to the first embodiment of the present disclosure. Figure 1 As shown, the following steps are included.

[0023] In step 101, a service call request of a front-end application is received; the service call request includes service identification and version number attributes.

[0024] It should be noted that the execution subject of the service routing method of the present disclosure is a service routing device. The service routing method of the embodiment of the present disclosure can be executed by the service routing device of the embodiment of the present disclosure, and the service routing device of the embodiment of the present disclosure can be configured in any electronic device, or in any software on any electronic device, to execute the service routing method of the embodiment of the present disclosure.

[0025] The service routing device may be, for example, a gateway, or may be a gateway service in an electronic device, etc. In the following embodiments, the service routing device is described as a gateway service as an example.

[0026] Among them, the front-end application may involve multiple services, and the functions of the front-end application are realized through multiple services. The multiple services involved in the front-end application can be deployed in the back-end environment. The front-end application can interact with the back-end environment through the gateway service.

[0027] In the disclosed embodiment, the front-end application can detect the operation of the object on the front-end application; determine whether to call a service and which service to call based on the operation, and then send a service call request to the gateway service. The service identifier can be, for example, a service name, service number, service code, etc. that can uniquely represent the service, and can be set according to actual needs.

[0028] In the embodiment of the present disclosure, the version number attribute is used to distinguish service instances in different states. The backend environment corresponding to the frontend application is a development environment or a usage environment.

[0029] In one example, the backend environment may be a development environment, and the version number attribute of the service instance developed in the development environment is different from the version number attribute of the service instance tested in the development environment. The service instance developed in the development environment refers to the service instance in the development state. The service instance tested in the development environment refers to the service instance in the testing state.

[0030] For example, the version number attribute of a service instance developed in a development environment may be the first attribute; and the version number attribute of a service instance tested in the development environment may be the second attribute.

[0031] In another example, when the backend environment is a usage environment, the version number attribute of the service instance used in the usage environment is different from the version number attribute of the service instance tested in the usage environment. The service instance used in the usage environment refers to the service instance in the usage state. The service instance tested in the usage environment refers to the service instance in the testing state.

[0032] For example, the version number attribute of the service instance used in the usage environment may be the third attribute; and the version number attribute of the service instance tested in the usage environment may be the fourth attribute.

[0033] Different version number attributes are set for service instances in different states. Therefore, when sending a service call request, the version number attribute of the service instance to be called can be carried in the service call request, so as to achieve coexistence of development and testing, or coexistence of use and testing in the same environment, and avoid the impact of the test process on the development process or the use process.

[0034] In step 102, a service instance list corresponding to the service identifier is queried according to the version number attribute, and a target service instance with the version number attribute set in the service instance list is obtained.

[0035] In an embodiment of the present disclosure, after step 101 and before step 102, the gateway service may call the first global filter set based on the service call request; the first global filter adds the version number attribute in the service call request to the request header of the service call request. It should be noted that if the service call request does not include a version number attribute, the first global filter may add a version number attribute with an empty value to the request header, or stop adding the version number attribute to the request header. Correspondingly, the process of the gateway service executing step 102 may, for example, be to query the service instance list corresponding to the service identifier according to the version number attribute in the request header, and obtain the target service instance in the service instance list with the version number attribute set.

[0036] It should be noted that if the request header does not contain a version number attribute, or the value of the version number attribute in the request header is empty, the gateway service can randomly select a service instance from the service instance list corresponding to the service identifier as the target service instance.

[0037] Among them, the first global filter is called to add the version number attribute in the service call request to the request header, so that the gateway service can directly extract the version number attribute from the request header, avoiding parsing the service call request to obtain the version number attribute, thereby speeding up the processing speed of the gateway service, thereby improving the service routing efficiency of the gateway service and further improving the service efficiency.

[0038] In the embodiment of the present disclosure, the registration center may store a service instance list corresponding to the service identifier of each service in the front-end application, wherein the service instance list may store the instance identifier and version number attribute of at least one service instance of the corresponding service. The service instance identifier may be, for example, a service instance name, a service instance code, or other identifier that can uniquely represent the service instance, and may be set according to actual needs.

[0039] Specifically, the gateway service can interact with the registration center to obtain the service instance list corresponding to the service identifier stored in the registration center; then query the service instance list according to the version number attribute to obtain the service instance with the version number attribute set. In the case that the number of service instances with the version number attribute set is single, the service instance is directly determined as the target service instance; in the case that the number of service instances with the version number attribute set is multiple, a service instance is randomly selected from the multiple service instances with the version number attribute set as the target service instance.

[0040] In step 103, the service call request is sent to the target service instance, instructing the target service instance to perform service processing.

[0041] In an embodiment of the present disclosure, the target service instance processes the service call request including: determining whether there is a sub-service to be called in combination with the service call request; if there is a sub-service to be called, determining the sub-service identifier of the sub-service; querying the sub-service instance list corresponding to the sub-service identifier according to the version number attribute, and obtaining the target sub-service instance with the version number attribute set in the sub-service instance list; sending the sub-service call request to the target sub-service instance to obtain the service processing result; the sub-service call request carries the version number attribute and the sub-service identifier of the sub-service.

[0042] It should be noted that the target sub-service instance's processing of the sub-service call request is similar to the target service instance's processing of the service call request. You can refer to the target service instance's processing of the service call request and no detailed description will be given here.

[0043] In the case where there is no sub-service to be called, the target service can directly perform service processing in combination with the service call request to obtain the service processing result.

[0044] Among them, an interceptor GrayFeignRequestInterceptor can be set in the target service instance to implement a RequestInterceptor interface, which can receive the sub-service call request of the target service instance, and then combine the version number attribute in the sub-service call request to route the sub-service call request to the target sub-service instance.

[0045] Among them, when there is a sub-service to be called, the version number attribute is passed through to the sub-service, so that the same version number attribute is set for the test service instances of different services, and another version number attribute is set for the non-test service instances of different services. This makes the solution of the present disclosure applicable to scenarios where services call each other, so that even when services call each other, there is no need to shut down the service, thereby further improving the service routing efficiency and further improving the service efficiency.

[0046] In step 104, the service processing result of the target service instance is obtained, and the service processing result is returned to the front-end application.

[0047] In the embodiment of the present disclosure, when the gateway service obtains the service processing result of the target service instance, the service processing result can be routed to the front-end application.

[0048] In summary, by receiving a service call request from a front-end application; the service call request includes a service identifier and a version number attribute; querying a service instance list corresponding to the service identifier according to the version number attribute, obtaining a target service instance with a version number attribute set in the service instance list; sending the service call request to the target service instance, instructing the target service instance to perform service processing; obtaining the service processing result of the target service instance, and returning the service processing result to the front-end application; wherein, the setting of the version number attribute can realize the coexistence of development and testing, or the coexistence of use and testing in the same environment, avoiding the impact of the testing process on the development process or the use process, so that when testing is needed, there is no need to shut down the service, thereby ensuring service efficiency.

[0049] In order for the gateway service to implement the service routing function based on the version number attribute, improve the service routing efficiency of the gateway service, and thus improve the service efficiency of the gateway service, the service routing strategy in the gateway service needs to be updated to a service routing strategy based on the version number attribute. In addition, the grayscale routing in the gateway service can be configured as needed. Figure 2 As shown, Figure 2 FIG. 1 is a flow chart of another service routing method according to the second embodiment of the present disclosure, and the specific implementation process is as follows:

[0050] In step 201, a service routing policy based on a version number attribute is received.

[0051] It should be noted that the execution subject of the service routing method of the present disclosure is a service routing device. The service routing method of the embodiment of the present disclosure can be executed by the service routing device of the embodiment of the present disclosure, and the service routing device of the embodiment of the present disclosure can be configured in any electronic device, or in any software on any electronic device, to execute the service routing method of the embodiment of the present disclosure.

[0052] The service routing device may be, for example, a gateway, or may be a gateway service in an electronic device, etc. In the following embodiments, the service routing device is described as a gateway service as an example.

[0053] In step 202, the stored service routing policy is updated according to the service routing policy.

[0054] In an embodiment of the present disclosure, a second global filter may be provided in the gateway service; a ReactiveLoadBalancerClientFilter class may be provided in the second global filter, and by calling this class, a service routing policy based on a version number attribute may be passed to the gateway service, and the service routing policy stored in the gateway service may be rewritten in combination with the service routing policy, thereby implementing an update process for the service routing policy stored in the gateway service.

[0055] In step 203, an attribute adding request is received; the attribute adding request carries a first attribute, indicating that the first attribute is added to the startup configuration file of the gateway service; the first attribute is used to configure whether to enable grayscale routing.

[0056] In an embodiment of the present disclosure, the gateway service may provide a configuration interface, through which an attribute adding request may be received; when the gateway service receives the attribute adding request, the gateway service may add the first attribute in the attribute adding request to the startup configuration file.

[0057] The first attribute may be, for example, a grayEnable attribute. When the first attribute is a first value, it indicates that gray routing is enabled; when the first attribute is a second value, it indicates that gray routing is not enabled. Gray routing is service routing processing based on the version number attribute.

[0058] In step 204, a service call request of the front-end application is received; the service call request includes service identification and version number attributes.

[0059] In the embodiment of the present disclosure, it should be noted that steps 201 to 203 may be performed before step 204. However, steps 201 to 203 do not need to be performed before every step 204. Steps 201 to 203 may be performed only once, or may be performed multiple times as required.

[0060] In the embodiment of the present disclosure, it should be noted that before step 204, the following steps may also be included: the service provider may deploy multiple services in the backend environment, register the multiple services in the registration center, and register the service instances under the services in the registration center.

[0061] When registering a service, the service provider can send a service registration request carrying a startup configuration file of the service to the registration center. The startup configuration file can include a version number attribute item, indicating that the registration center needs to register the version number attribute when registering a service instance under the service in the future.

[0062] When registering a service instance, the service provider may send a service instance registration request carrying the service instance registration information to the registration center. The service instance registration information may include a version number attribute of the service instance, indicating the version number attribute of the service instance stored by the registration center. In combination with the service identifier of the service and the version number attributes of each service instance under the service, the service instance list corresponding to the service identifier of the service may be determined.

[0063] It should be noted that, when there is an update to the version number attribute of the service instance, the service provider may interact with the registration center to update the version number attribute of the service instance in the service instance list.

[0064] Among them, the setting of the version number attribute item in the startup configuration file and the setting of the version number attribute in the registration information of the service instance enable the service instance list to include the version number attribute of the service instance, which is then used for service routing processing, thereby improving the accuracy of service routing and further improving the service routing efficiency.

[0065] In step 205, a service instance list corresponding to the service identifier is queried according to the version number attribute, and a target service instance with the version number attribute set in the service instance list is obtained.

[0066] In an embodiment of the present disclosure, when the gateway service is configured with the first attribute, before step 205, the gateway service may also perform the following process: determine whether the gateway service that receives the service call request enables grayscale routing; if the gateway service does not enable grayscale routing, randomly select a service instance from the service instance list corresponding to the service identifier; and determine the selected service instance as the target service instance.

[0067] In addition, when the gateway service enables grayscale routing, the gateway service may continue to execute step 205 and subsequent steps.

[0068] Among them, the setting of the first attribute in the gateway service for indicating whether to enable grayscale routing allows the backend environment to flexibly adjust the value of the first attribute according to actual needs. For example, when all service instances in the backend environment are in a non-testing state, grayscale routing can be set to be disabled, so that the gateway service can randomly select a service instance from the service instance list; when some service instances in the candidate environment are in a testing state, grayscale routing can be set to be enabled, so that the gateway service can select a service instance from the service instance list based on the version number attribute. This further improves the flexibility of service routing and further improves service efficiency.

[0069] In step 206, the service call request is sent to the target service instance, instructing the target service instance to perform service processing.

[0070] In step 207, the service processing result of the target service instance is obtained, and the service processing result is returned to the front-end application.

[0071] It should be noted that the description of step 204 to step 207 can be referred to Figure 1 The detailed description of steps 101 to 104 in the illustrated embodiment will not be given in detail here.

[0072] In summary, by receiving a service routing policy based on a version number attribute; updating the stored service routing policy according to the service routing policy; receiving an attribute adding request; the attribute adding request carries a first attribute, indicating that the first attribute is added to the startup configuration file of the gateway service; the first attribute is used to configure whether to enable grayscale routing; receiving a service call request from a front-end application; the service call request includes a service identifier and a version number attribute; querying a service instance list corresponding to the service identifier according to the version number attribute, and obtaining a target service instance with a version number attribute set in the service instance list; sending the service call request to the target service instance, instructing the target service instance to perform service processing; obtaining a service processing result of the target service instance, and returning the service processing result to the front-end application; wherein, the update processing of the service routing policy based on the version number attribute in the gateway service enables the gateway service to implement a service routing function based on the version number attribute, thereby further realizing the coexistence of development and testing in the same environment, or the coexistence of use and testing, thereby further improving service efficiency.

[0073] In order to implement the above embodiment, the embodiment of the present disclosure proposes a service routing device.

[0074] Figure 3 is a schematic diagram of the structure of a service routing device according to the third embodiment of the present disclosure, referring to Figure 3The service routing device 300 may include: a first receiving module 301, a first obtaining module 302, a sending module 303 and a second obtaining module 304.

[0075] Among them, the first receiving module 301 is used to receive a service call request from a front-end application; the service call request includes a service identifier and a version number attribute; the first acquisition module 302 is used to query the service instance list corresponding to the service identifier according to the version number attribute, and obtain the target service instance with the version number attribute set in the service instance list; the sending module 303 is used to send the service call request to the target service instance, instructing the target service instance to perform service processing; the second acquisition module 304 is used to obtain the service processing result of the target service instance, and return the service processing result to the front-end application.

[0076] As a possible implementation method of the embodiment of the present disclosure, the device also includes: a calling module, used to call the first global filter to add the version number attribute in the service call request to the request header of the service call request; correspondingly, the first acquisition module 302 is specifically used to query the service instance list corresponding to the service identifier according to the version number attribute in the request header, and obtain the target service instance in the service instance list with the version number attribute set.

[0077] As a possible implementation method of the embodiment of the present disclosure, the device also includes: a first determination module, a selection module, and a second determination module; the first determination module is used to determine whether the gateway service that receives the service call request enables grayscale routing; the selection module is used to randomly select a service instance from the service instance list corresponding to the service identifier when the gateway service does not enable grayscale routing; the second determination module is used to determine the selected service instance as the target service instance.

[0078] As a possible implementation method of an embodiment of the present disclosure, the list of service instances corresponding to the service identifier is determined by a registration center in combination with a startup configuration file of the service corresponding to the service identifier and registration information of the service instance in the service; the startup configuration file includes a version number attribute item; and the registration information of the service instance includes a version number attribute of the service instance.

[0079] As a possible implementation method of the embodiment of the present disclosure, the device also includes: a second receiving module and an update processing module; the second receiving module is used to receive a service routing policy based on a version number attribute; the update processing module is used to update the stored service routing policy according to the service routing policy.

[0080] As a possible implementation method of the embodiment of the present disclosure, the target service instance processes the service call request including: determining whether there is a sub-service to be called in combination with the service call request; if there is a sub-service to be called, determining the sub-service identifier of the sub-service; querying the sub-service instance list corresponding to the sub-service identifier according to the version number attribute, and obtaining the target sub-service instance with the version number attribute set in the sub-service instance list; sending a sub-service call request to the target sub-service instance to obtain a service processing result; the sub-service call request carries the version number attribute and the sub-service identifier of the sub-service.

[0081] As a possible implementation method of an embodiment of the present disclosure, the back-end environment corresponding to the front-end application is a development environment or a usage environment; when the back-end environment is a development environment, the version number attribute of the service instance developed in the development environment is different from the version number attribute of the service instance tested in the development environment; when the back-end environment is a usage environment, the version number attribute of the service instance used in the usage environment is different from the version number attribute of the service instance tested in the usage environment.

[0082] In summary, by receiving a service call request from a front-end application; the service call request includes a service identifier and a version number attribute; querying a service instance list corresponding to the service identifier according to the version number attribute, obtaining a target service instance with a version number attribute set in the service instance list; sending the service call request to the target service instance, instructing the target service instance to perform service processing; obtaining the service processing result of the target service instance, and returning the service processing result to the front-end application; wherein, the setting of the version number attribute can realize the coexistence of development and testing, or the coexistence of use and testing in the same environment, avoiding the impact of the testing process on the development process or the use process, so that when testing is needed, there is no need to shut down the service, thereby ensuring service efficiency.

[0083] Figure 4 is a block diagram of an electronic device that performs a service routing method.

[0084] like Figure 4 As shown, the electronic device 1000 includes:

[0085] The memory 1010 and the processor 1020, the bus 1030 connecting different components (including the memory 1010 and the processor 1020), the memory 1010 stores a computer program, and when the processor 1020 executes the program, the service routing method described in the embodiment of the present disclosure is implemented.

[0086] Bus 1030 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0087] The electronic device 1000 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 1000, including volatile and non-volatile media, removable and non-removable media.

[0088] The memory 1010 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 1040 and / or cache memory 1050. The electronic device 1000 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 1060 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 1030 via one or more data medium interfaces. The memory 1010 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.

[0089] A program / utility 1080 having a set (at least one) of program modules 1070 may be stored, for example, in the memory 1010, such program modules 1070 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 1070 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0090] The electronic device 1000 may also communicate with one or more external devices 1090 (e.g., keyboard, pointing device, display 1091, etc.), one or more devices that enable a user to interact with the electronic device 1000, and / or any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 1092. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 1093. Figure 4 As shown, the network adapter 1093 communicates with other modules of the electronic device 1000 via the bus 1030. It should be understood that although Figure 4 Not shown, other hardware and / or software modules may be used in conjunction with electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0091] The processor 1020 executes various functional applications and data processing by running the programs stored in the memory 1010 .

[0092] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the service routing method of the embodiment of the present disclosure, and will not be repeated here.

[0093] In order to implement the above embodiments, the present disclosure also proposes a storage medium.

[0094] When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the service routing method as described above.

[0095] In order to implement the above embodiments, the present disclosure also provides a computer program product, including a computer program, which, when executed by a processor of an electronic device, enables the electronic device to execute the service routing method as described above.

[0096] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0097] It should be understood that the present disclosure is not limited to the exact structures that have been 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 present disclosure is limited only by the appended claims.

Claims

1. A service routing method, characterized in that: The method comprises: Receive a service call request from a front-end application; the service call request includes a service identifier and a version number attribute; Query the service instance list corresponding to the service identifier according to the version number attribute, and obtain the target service instance in the service instance list with the version number attribute set; Sending the service call request to the target service instance, instructing the target service instance to perform service processing; The service processing result of the target service instance is obtained, and the service processing result is returned to the front-end application.

2. The method according to claim 1, characterized in that After receiving the service call request of the front-end application, the method further includes: calling a first global filter to add the version number attribute in the service call request to a request header of the service call request; Correspondingly, the querying of the service instance list corresponding to the service identifier according to the version number attribute to obtain the target service instance in the service instance list with the version number attribute set therein includes: The service instance list corresponding to the service identifier is queried according to the version number attribute in the request header, and the target service instance with the version number attribute set in the service instance list is obtained.

3. The method according to claim 1, characterized in that Before searching the service instance list corresponding to the service identifier according to the version number attribute and obtaining the target service instance in the service instance list with the version number attribute set, the method further includes: Determine whether the gateway service receiving the service call request enables grayscale routing; In the case where the gateway service does not enable grayscale routing, randomly selecting a service instance from the service instance list corresponding to the service identifier; The selected service instance is determined as the target service instance.

4. The method according to claim 1, characterized in that: The service instance list corresponding to the service identifier is determined by the registration center in combination with the startup configuration file of the service corresponding to the service identifier and the registration information of the service instance in the service; The startup configuration file includes a version number attribute item; the registration information of the service instance includes the version number attribute of the service instance.

5. The method according to claim 1, characterized in that The method further comprises: Receive a service routing strategy based on the version number attribute; The stored service routing policy is updated according to the service routing policy.

6. The method according to claim 1, characterized in that The target service instance processes the service call request in the following manner: In combination with the service call request, determining whether there is a sub-service to be called; If there is a sub-service to be called, determining a sub-service identifier of the sub-service; Query the sub-service instance list corresponding to the sub-service identifier according to the version number attribute, and obtain the target sub-service instance in the sub-service instance list with the version number attribute set; A subservice invocation request is sent to the target subservice instance to obtain a service processing result; the subservice invocation request carries the version number attribute and the subservice identifier of the subservice.

7. The method according to any one of claims 1 to 6, characterized in that The backend environment corresponding to the frontend application is a development environment or a usage environment; In the case where the backend environment is a development environment, a version number attribute of a service instance developed in the development environment is different from a version number attribute of a service instance tested in the development environment; In the case where the backend environment is a usage environment, a version number attribute of a service instance used in the usage environment is different from a version number attribute of a service instance tested in the usage environment.

8. A service routing device, characterized in that: The device comprises: A first receiving module is used to receive a service call request from a front-end application; the service call request includes a service identifier and a version number attribute; A first acquisition module, configured to query a service instance list corresponding to the service identifier according to the version number attribute, and acquire a target service instance in the service instance list having the version number attribute set therein; A sending module, used to send the service call request to the target service instance, and instruct the target service instance to perform service processing; The second acquisition module is used to obtain the service processing result of the target service instance and return the service processing result to the front-end application.

9. The device according to claim 8, characterized in that The apparatus further comprises: a calling module, configured to call a first global filter to add the version number attribute in the service calling request to a request header of the service calling request; Correspondingly, the first acquisition module is specifically used to query the service instance list corresponding to the service identifier according to the version number attribute in the request header, and obtain the target service instance with the version number attribute set in the service instance list.

10. The device according to claim 8, characterized in that The device further comprises: a first determination module, a selection module, and a second determination module; The first determination module is used to determine whether the gateway service receiving the service call request enables grayscale routing; The selection module is used to randomly select a service instance from the service instance list corresponding to the service identifier when the gateway service does not enable grayscale routing; The second determining module is used to determine the selected service instance as the target service instance.

11. The device according to claim 8, characterized in that The service instance list corresponding to the service identifier is determined by the registration center in combination with the startup configuration file of the service corresponding to the service identifier and the registration information of the service instance in the service; The startup configuration file includes a version number attribute item; the registration information of the service instance includes the version number attribute of the service instance.

12. The device according to claim 8, characterized in that The device further comprises: a second receiving module and an update processing module; The second receiving module is used to receive a service routing strategy based on a version number attribute; The update processing module is used to update the stored service routing policy according to the service routing policy.

13. The device according to claim 8, characterized in that The target service instance processes the service call request in the following manner: In combination with the service call request, determining whether there is a sub-service to be called; If there is a sub-service to be called, determining a sub-service identifier of the sub-service; Query the sub-service instance list corresponding to the sub-service identifier according to the version number attribute, and obtain the target sub-service instance in the sub-service instance list with the version number attribute set; A subservice invocation request is sent to the target subservice instance to obtain a service processing result; the subservice invocation request carries the version number attribute and the subservice identifier of the subservice.

14. The device according to any one of claims 8 to 13, characterized in that The backend environment corresponding to the frontend application is a development environment or a usage environment; In the case where the backend environment is a development environment, a version number attribute of a service instance developed in the development environment is different from a version number attribute of a service instance tested in the development environment; In the case where the backend environment is a usage environment, a version number attribute of a service instance used in the usage environment is different from a version number attribute of a service instance tested in the usage environment.

15. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the service routing method according to any one of claims 1 to 7.

16. A storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the service routing method according to any one of claims 1 to 7.

17. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor of an electronic device, enables the electronic device to execute the service routing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Attack defense method and device for data query system and storage medium

    CN113971242A

  • Development joint debugging isolation method and device, computer equipment and storage medium

    CN116594678A

  • Mobile terminal application gray release method and system and medium

    CN118827363A

  • Gray release method and device, computer equipment and storage medium

    CN118885189A