CN111475226A - Electronic device, micro-service calling method, and computer-readable storage medium - Google Patents

Electronic device, micro-service calling method, and computer-readable storage medium Download PDF

Info

Publication number
CN111475226A
CN111475226A CN202010248969.6A CN202010248969A CN111475226A CN 111475226 A CN111475226 A CN 111475226A CN 202010248969 A CN202010248969 A CN 202010248969A CN 111475226 A CN111475226 A CN 111475226A
Authority
CN
China
Prior art keywords
micro
version
topology
service
user
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.)
Granted
Application number
CN202010248969.6A
Other languages
Chinese (zh)
Other versions
CN111475226B (en
Inventor
张宝浩
刘海东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Merchants Finance Technology Co Ltd
Original Assignee
China Merchants Finance Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Merchants Finance Technology Co Ltd filed Critical China Merchants Finance Technology Co Ltd
Priority to CN202010248969.6A priority Critical patent/CN111475226B/en
Publication of CN111475226A publication Critical patent/CN111475226A/en
Application granted granted Critical
Publication of CN111475226B publication Critical patent/CN111475226B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44536Selecting among different versions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention relates to an electronic device, a micro-service calling method and a computer-readable storage medium. When receiving a micro-service calling request carrying user information, judging whether version topology identification information corresponding to the user identification information exists in the user information; when the version topology exists, the version topology corresponding to the version topology identification information is searched, and the searched version topology is used as the version topology to be used; then determining the micro service modules to be called of the micro service calling request, and determining the target micro service program version numbers corresponding to the micro service modules to be called according to the version topology to be used; and finally, executing micro-service calling operation according to the target micro-service program version number corresponding to each micro-service module to be called. Compared with the prior art, the method and the device can effectively reduce the influence on the use of the user due to the upgrade fault of the version of the micro service program.

Description

Electronic device, micro-service calling method, and computer-readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an electronic device, a micro service invocation method, and a computer-readable storage medium.
Background
At present, a micro service architecture is composed of a plurality of micro service modules, one micro service module generally performs a certain function, and in order to complete a service, one or more micro service modules are generally required to be called. With continuous iterative update of the technology and diversification of user requirements, a development team often needs to upgrade a micro-service program in a micro-service module, but an upgrade fault occurs inevitably in the process of upgrading the micro-service program, and once the upgrade fault occurs, the problem that the micro-service module cannot be called is caused, so that the use of a user is influenced.
Therefore, how to reduce the influence of the upgrade failure of the version of the micro service program on the use of the user becomes a technical problem to be solved urgently.
Disclosure of Invention
The invention mainly aims to provide an electronic device, a micro-service calling method and a computer readable storage medium, aiming at reducing the influence of version upgrading faults of micro-service programs on the use of users.
In order to achieve the above object, the present invention provides an electronic device communicatively connected to at least one microservice module, wherein the microservice module stores therein one or more versions of microservice programs, the electronic device includes a memory and a processor, the memory stores thereon a microservice calling program, and the microservice calling program, when executed by the processor, implements the following steps:
a receiving step: receiving a micro-service calling request carrying user information, wherein the user information comprises user identification information;
a judging step: judging whether version topology identification information corresponding to the user identification information exists in the user information;
a searching step: when the version topology exists, searching a version topology corresponding to the version topology identification information in a preset version topology library, and taking the searched version topology as a to-be-used version topology, wherein the to-be-used version topology comprises a mapping relation between a micro service module and a micro service program version number;
a determination step: determining the micro service modules to be called of the micro service calling request, and determining the target micro service program version numbers corresponding to the micro service modules to be called according to the version topology to be used;
calling: and executing the micro-service calling operation according to the target micro-service program version number corresponding to each micro-service module to be called.
Preferably, the processor executes the micro service invocation program, and after the judging step, further implements the following steps:
and when the version topology identification information corresponding to the user identification information does not exist in the user information, distributing the corresponding version topology for the user as the version topology to be used according to a predetermined distribution rule, and executing the determining step.
Preferably, the allocation rule includes: determining an attribute value of a user, and determining a version topology corresponding to the user according to the attribute value of the user and a mapping relation between a predetermined attribute value and the version topology.
Preferably, the step of determining the attribute value of the user comprises:
reading an attribute value of a user in the user information, wherein the attribute value is a numerical value randomly selected from a preset numerical value interval in advance;
or identifying attribute information of the user, and determining an attribute value corresponding to the user according to a predetermined mapping relation between the attribute information and the attribute value; the attribute information includes geographical location information.
Preferably, the micro service invocation request includes identification information and an invocation sequence of the micro service module to be invoked, and the invocation step includes:
determining a network address corresponding to each micro service module to be called according to a mapping relation between the predetermined identification information of the micro service module and the network address of the micro service module;
and sequentially calling the micro-service modules to operate the micro-service programs corresponding to the target micro-service program version numbers according to the calling sequence and the network addresses corresponding to the micro-service modules to be called.
In addition, in order to achieve the above object, the present invention further provides a method for invoking micro-services, which is applied to an electronic device, the electronic device is communicatively connected to at least one micro-service module, the micro-service module stores one or more versions of micro-service programs, and the method for invoking micro-services includes:
a receiving step: receiving a micro-service calling request carrying user information, wherein the user information comprises user identification information;
a judging step: judging whether version topology identification information corresponding to the user identification information exists in the user information;
a searching step: when the version topology exists, searching a version topology corresponding to the version topology identification information in a preset version topology library, and taking the searched version topology as a to-be-used version topology, wherein the to-be-used version topology comprises a mapping relation between a micro service module and a micro service program version number;
a determination step: determining the micro service modules to be called of the micro service calling request, and determining the target micro service program version numbers corresponding to the micro service modules to be called according to the version topology to be used;
calling: and executing the micro-service calling operation according to the target micro-service program version number corresponding to each micro-service module to be called.
Preferably, after the judging step, the method further comprises:
when the version topology identification information corresponding to the user identification information does not exist in the user information, distributing the corresponding version topology for the user as the version topology to be used according to a predetermined distribution rule, and executing the determining step;
the allocation rule includes: determining an attribute value of a user, and determining a version topology corresponding to the user according to the attribute value of the user and a mapping relation between a predetermined attribute value and the version topology.
Preferably, the step of determining the attribute value of the user comprises:
reading an attribute value of a user in the user information, wherein the attribute value is a numerical value randomly selected from a preset numerical value interval in advance;
or identifying attribute information of the user, and determining an attribute value corresponding to the user according to a predetermined mapping relation between the attribute information and the attribute value; the attribute information includes geographical location information.
Preferably, the micro service invocation request includes identification information and an invocation sequence of the micro service module to be invoked, and the invocation step includes:
determining a network address corresponding to each micro service module to be called according to a mapping relation between the predetermined identification information of the micro service module and the network address of the micro service module;
and sequentially calling the micro-service modules to operate the micro-service programs corresponding to the target micro-service program version numbers according to the calling sequence and the network addresses corresponding to the micro-service modules to be called.
In addition, to achieve the above object, the present invention further provides a computer-readable storage medium storing a micro service invocation program, which is executable by at least one processor to cause the at least one processor to execute the steps of the micro service invocation method according to any one of the above.
Compared with the prior art, the method and the device have the advantages that the micro-service programs of a plurality of versions are stored in the micro-service module, the version numbers of the target micro-service programs corresponding to the micro-service modules to be called are determined according to the version topology matched with the user in the micro-service calling process, the micro-service calling operation is executed according to the version numbers of the target micro-service programs corresponding to the micro-service modules to be called, the proper micro-service program version can be selected for the user after the micro-service program is upgraded, and the mapping relation between the micro-service module and the version numbers of the micro-service programs is updated to the version topology corresponding to the user, so that the influence of the upgrading faults of the micro-service program version on the use of the user is effectively reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.
FIG. 1 is a schematic diagram of an alternative application environment according to various embodiments of the present invention;
FIG. 2 is a diagram illustrating an operating environment of an embodiment of a microservice calling program of the present invention;
FIG. 3 is a block diagram of an embodiment of a microservice calling process of the present invention;
fig. 4 is a flowchart illustrating a method for invoking micro-services according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
Fig. 1 is a schematic diagram of an alternative application environment according to various embodiments of the present invention.
In this embodiment, the present invention can be applied to an application environment including the electronic device 1, the access gateway 2, the client 3 and at least one microservice module 4.
The access gateway 2 is in communication connection with at least one client 3, and is configured to provide an access channel for the client 3 to access the micro service, and generally has functions of session authentication, gray-scale routing, traffic distribution, micro service exposure, and the like.
The electronic device 1 may be disposed in the access gateway 2 as a functional module, or may be disposed independently of the access gateway 2. When the electronic device 1 is disposed outside the access gateway 2, the electronic device 1 is respectively in communication connection with the access gateway 2 and the at least one micro service module 4, and when the electronic device 1 is disposed inside the access gateway 2, the electronic device 1 is respectively in communication connection with the at least one micro service module 4.
The micro service module 4 stores one or more versions of micro service programs, and is used for implementing a certain specific function when the micro service program is run. Wherein, each micro service program is provided with a unique micro service program version number.
The application environment and the hardware structure and function of the related devices of the various embodiments of the present invention have been described in detail so far. Hereinafter, various embodiments of the present invention will be proposed based on the above-described application environment and related devices.
The invention provides a micro-service calling program.
Please refer to fig. 2, which is a schematic diagram of an operating environment of the micro service invocation program 10 according to an embodiment of the present invention.
In the present embodiment, the microservice calling program 10 is installed and run in the electronic apparatus 1. The electronic device 1 may be a desktop computer, a notebook, a palm computer, a server, or other computing equipment. The electronic device 1 may include, but is not limited to, a memory 11, a processor 12, which communicate with each other via a program bus. Fig. 2 only shows the electronic device 1 with components 11, 12, but it is to be understood that not all shown components are required to be implemented, and that more or fewer components may alternatively be implemented.
The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a hard disk or a memory of the electronic device 1. The memory 11 may also be an external storage device of the electronic apparatus 1 in other embodiments, such as a plug-in hard disk provided on the electronic apparatus 1, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic apparatus 1. The memory 11 is used for storing application software installed in the electronic device 1 and various data, such as program codes of the micro service invocation program 10. The memory 11 may also be used to temporarily store data that has been output or is to be output.
The processor 12 may be a Central Processing Unit (CPU), microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 11 or Processing data, such as executing the micro service calling program 10.
Please refer to fig. 3, which is a block diagram of a microservice calling program 10 according to an embodiment of the present invention. In this embodiment, the micro service caller 10 may be divided into one or more modules, and the one or more modules are stored in the memory 11 and executed by one or more processors (in this embodiment, the processor 12) to complete the present invention. For example, in fig. 3, the micro service caller 10 may be divided into a receiving module 101, a judging module 102, a searching module 103, a determining module 104 and a calling module 105. The module referred to in the present invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable than a program for describing the execution process of the micro service invoking program 10 in the electronic device 1, wherein:
the receiving module 101 is configured to receive a micro-service invocation request carrying user information.
A User may send a microservice invocation request through a User Interface (UI) of the client 3, where the microservice invocation request carries User information, and the User information includes User identification information (e.g., a User ID).
A determining module 102, configured to determine whether version topology identification information corresponding to the user identification information exists in the user information.
In this embodiment, the micro service developer may set at least one version topology for the user in advance according to needs (the version topology includes a mapping relationship between the micro service module 4 and the version number of the micro service program), and store the version topology identification information corresponding to the version topology into the user information. For example, after a micro service program is upgraded, the micro service developer may screen only some users to use the new version of the micro service program as needed, and thus, a version topology is set for the some users again, and the newly set version topology includes the version number of the new version of the micro service program.
In addition, if the user is a user who uses the microservice for the first time and the version topology matched with the client 3 of the user is not determined in advance for the user, the user information of the user does not include the version topology identification information.
The searching module 103 is configured to, when version topology identification information corresponding to the user identification information exists in the user information, search a version topology corresponding to the version topology identification information in a preset version topology library, and use the searched version topology as a to-be-used version topology.
The version topology library can be preset according to requirements and comprises at least one version topology. The version topology includes a mapping relationship between the microservice module 4 and the microservice program version number. For example, the version topology with the version topology identification information of 3 includes the following information: the version number of the micro service program corresponding to "a" is 1.0, the version number of the micro service program corresponding to "B" is 1.0, the version number of the micro service program corresponding to "C" is 2.0, the version number of the micro service program corresponding to "D" is 1.0, wherein "a", "B", "C", and "D" are identification information of the micro service module 4.
In this embodiment, when the version topology identification information corresponding to the user identification information does not exist in the user information, the search module 103 allocates the corresponding version topology to the user as the version topology to be used according to a predetermined allocation rule. In addition, the version topology identification information corresponding to the to-be-used version topology can be stored in the user information.
Wherein the allocation rule comprises:
determining an attribute value of a user, and determining a version topology corresponding to the user according to the attribute value of the user and a mapping relation between a predetermined attribute value and the version topology.
For example, the mapping relationship between the attribute value and the version topology is as follows:
the version topology of the attribute value corresponding to the interval [0,500000] is: the version topology TP1 and the version topology TP4 correspond to the attribute values in the interval (500000,1000000), and the version topology is version topology TP2 and version topology TP 3.
If the attribute value of the user is 300, the version topology corresponding to the user is: version topology TP1, version topology TP 4.
In this embodiment, the step of determining the attribute value of the user includes:
the first scheme is as follows: and reading the attribute value of the user in the user information.
In the first scheme, the micro-service developer may assign an attribute value to the user in advance, and store the attribute value of the user in the user information. For example, at the time of user registration, an integer is randomly selected from the interval [0,1000000] as the attribute value of the user, and the attribute value of the user is stored in the user information.
Scheme II: corresponding attribute values are generated for the user.
In the second scheme, the attribute value of the user is temporarily generated, but is not preset and stored in the user information.
For example, identifying attribute information of a user, and determining an attribute value corresponding to the user according to a predetermined mapping relationship between the attribute information and the attribute value; the attribute information comprises geographical location information; alternatively, an integer is randomly selected from the interval [0,1000000] as the attribute value of the user.
In the present embodiment, the method for determining the user attribute value may be selected according to a specific application scenario, and is not limited to the above-exemplified method.
The determining module 104 is configured to determine the micro service modules 4 to be called by the micro service call request, and determine, according to the version topology to be used, target micro service program version numbers corresponding to the micro service modules 4 to be called.
And determining the micro-service module 4 to be called according to the identification information of the micro-service to be called, and determining the target micro-service program version number corresponding to the micro-service module 4 to be called according to the micro-service program version number corresponding to each micro-service module 4 in the searched version topology. For example, the found version topology includes the following information: the version number of the micro service program corresponding to the 'A' is 1.0, the version number of the micro service program corresponding to the 'B' is 1.0, the version number of the micro service program corresponding to the 'C' is 2.0, the version number of the micro service program corresponding to the 'D' is 1.0, and the micro service module 4 to be called and the calling sequence are as follows: and a, B, C and D, extracting the micro service program version numbers corresponding to the four micro service modules 4 from the version topology as the target micro service program version number. As another example, the user corresponds to 2 version topologies, namely, version topology TP1 and version topology TP 2. The version topology TP1 includes the following information: the version number of the micro service program corresponding to the A is 1.0, the version number of the micro service program corresponding to the B is 1.0, the version number of the micro service program corresponding to the C is 2.0, and the version number of the micro service program corresponding to the D is 1.0; the version topology TP2 includes the following information: the version number of the micro service program corresponding to the D is 3.0, and the version number of the micro service program corresponding to the E is 1.0. Assuming that the micro service module 4 to be called is "a", the micro service program version number 1.0 corresponding to "a" is extracted from the version topology TP1 as the target micro service program version number. The "a", "B", "C", "D", and "E" are identification information of the microservice module 4.
And the calling module 105 is configured to execute a micro-service calling operation according to the target micro-service program version number corresponding to each micro-service module 4 to be called.
In this embodiment, the micro service invocation request includes identification information and an invocation sequence of the micro service module 4 to be invoked. The calling module 105 determines a network address corresponding to each micro service module 4 to be called according to a mapping relationship between the predetermined identification information of the micro service module 4 and the network address of the micro service module 4. Then, the calling module 105 sequentially calls the micro service modules 4 to run the micro service programs corresponding to the target micro service program version numbers according to the calling sequence and the network addresses corresponding to the micro service modules 4 to be called.
For example, the calling sequence of the micro service modules 4 to be called is "a", "B", "C", and "D", and after the calling module 105 finds out the network address of each micro service module 4 to be called, the calling module calls "a", "B", "C", and "D", where "a", "B", "C", and "D" are identification information of the micro service modules 4.
The following describes a specific calling method by taking a call "a" as an example: if the calling module 105 needs to call "a", a task execution request (the task execution request carries a target micro service program version number corresponding to "a") is sent to "a", and after receiving the task execution request, the "a" runs the micro service program corresponding to the target micro service program version number to execute the task and feeds back an execution result.
Compared with the prior art, in the embodiment, a plurality of versions of the micro service programs are stored in the micro service module 4, in the micro service calling process, the target micro service program version number corresponding to each micro service module 4 to be called is determined according to the version topology matched with the user, and then the micro service calling operation is executed according to the target micro service program version number corresponding to each micro service module 4 to be called, so that after the micro service program is upgraded, a proper micro service program version can be selected for the user, and the mapping relation between the micro service module 4 and the micro service program version number is updated to the version topology corresponding to the user, thereby effectively reducing the influence of the upgrade fault of the micro service program version on the use of the user.
In addition, the invention provides a micro-service calling method.
As shown in fig. 4, fig. 4 is a flowchart illustrating a micro-service invoking method according to an embodiment of the present invention.
In this embodiment, the method includes:
and step S10, receiving the micro-service calling request carrying the user information.
A User may send a microservice invocation request through a User Interface (UI) of the client 3, where the microservice invocation request carries User information, and the User information includes User identification information (e.g., a User ID).
Step S20, determining whether the user information includes version topology identification information corresponding to the user identification information.
In this embodiment, the micro service developer may set at least one version topology for the user in advance according to needs (the version topology includes a mapping relationship between the micro service module 4 and the version number of the micro service program), and store the version topology identification information corresponding to the version topology into the user information. For example, after a micro service program is upgraded, the micro service developer may screen only some users to use the new version of the micro service program as needed, and thus, a version topology is set for the some users again, and the newly set version topology includes the version number of the new version of the micro service program.
In addition, if the user is a user who uses the microservice for the first time and the version topology matched with the client 3 of the user is not determined in advance for the user, the user information of the user does not include the version topology identification information.
And step S30, when the version topology exists, searching the version topology corresponding to the version topology identification information in a preset version topology library, and taking the searched version topology as the version topology to be used.
The version topology library can be preset according to requirements and comprises at least one version topology. The version topology includes a mapping relationship between the microservice module 4 and the microservice program version number. For example, the version topology with the version topology identification information of 3 includes the following information: the version number of the micro service program corresponding to "a" is 1.0, the version number of the micro service program corresponding to "B" is 1.0, the version number of the micro service program corresponding to "C" is 2.0, the version number of the micro service program corresponding to "D" is 1.0, wherein "a", "B", "C", and "D" are identification information of the micro service module 4.
In this embodiment, when the version topology identification information corresponding to the user identification information does not exist in the user information, the corresponding version topology is allocated to the user as the version topology to be used according to the predetermined allocation rule. In addition, the version topology identification information corresponding to the to-be-used version topology can be stored in the user information.
Wherein the allocation rule comprises:
determining an attribute value of a user, and determining a version topology corresponding to the user according to the attribute value of the user and a mapping relation between a predetermined attribute value and the version topology.
For example, the mapping relationship between the attribute value and the version topology is as follows:
the version topology of the attribute value corresponding to the interval [0,500000] is: the version topology TP1 and the version topology TP4 correspond to the attribute values in the interval (500000,1000000), and the version topology is version topology TP2 and version topology TP 3.
If the attribute value of the user is 300, the version topology corresponding to the user is: version topology TP1, version topology TP 4.
In this embodiment, the step of determining the attribute value of the user includes:
the first scheme is as follows: and reading the attribute value of the user in the user information.
In the first scheme, the micro-service developer may assign an attribute value to the user in advance, and store the attribute value of the user in the user information. For example, at the time of user registration, an integer is randomly selected from the interval [0,1000000] as the attribute value of the user, and the attribute value of the user is stored in the user information.
Scheme II: corresponding attribute values are generated for the user.
In the second scheme, the attribute value of the user is temporarily generated, but is not preset and stored in the user information.
For example, identifying attribute information of a user, and determining an attribute value corresponding to the user according to a predetermined mapping relationship between the attribute information and the attribute value; the attribute information comprises geographical location information; alternatively, an integer is randomly selected from the interval [0,1000000] as the attribute value of the user.
In the present embodiment, the method for determining the user attribute value may be selected according to a specific application scenario, and is not limited to the above-exemplified method.
Step S40, determining the micro service modules 4 to be called by the micro service call request, and determining the target micro service program version numbers corresponding to the micro service modules 4 to be called according to the version topology to be used.
And determining the micro-service module 4 to be called according to the identification information of the micro-service to be called, and determining the target micro-service program version number corresponding to the micro-service module 4 to be called according to the micro-service program version number corresponding to each micro-service module 4 in the searched version topology. For example, the found version topology includes the following information: the version number of the micro service program corresponding to the 'A' is 1.0, the version number of the micro service program corresponding to the 'B' is 1.0, the version number of the micro service program corresponding to the 'C' is 2.0, the version number of the micro service program corresponding to the 'D' is 1.0, and the micro service module 4 to be called and the calling sequence are as follows: and a, B, C and D, extracting the micro service program version numbers corresponding to the four micro service modules 4 from the version topology as the target micro service program version number. As another example, the user corresponds to 2 version topologies, namely, version topology TP1 and version topology TP 2. The version topology TP1 includes the following information: the version number of the micro service program corresponding to the A is 1.0, the version number of the micro service program corresponding to the B is 1.0, the version number of the micro service program corresponding to the C is 2.0, and the version number of the micro service program corresponding to the D is 1.0; the version topology TP2 includes the following information: the version number of the micro service program corresponding to the D is 3.0, and the version number of the micro service program corresponding to the E is 1.0. Assuming that the micro service module 4 to be called is "a", the micro service program version number 1.0 corresponding to "a" is extracted from the version topology TP1 as the target micro service program version number. The "a", "B", "C", "D", and "E" are identification information of the microservice module 4.
Step S50, executing the micro service calling operation according to the target micro service program version number corresponding to each micro service module 4 to be called.
In this embodiment, the micro service invocation request includes identification information and an invocation sequence of the micro service module 4 to be invoked. And determining the network address corresponding to each micro service module 4 to be called according to the mapping relation between the predetermined identification information of the micro service module 4 and the network address of the micro service module 4. And then, sequentially calling the micro-service modules 4 to run the micro-service programs corresponding to the target micro-service program version numbers according to the calling sequence and the network addresses corresponding to the micro-service modules 4 to be called.
For example, the calling order of the micro service modules 4 to be called is "a", "B", "C", and "D", and after the network address of each micro service module 4 to be called is found, the "a", "B", "C", and "D" are called in turn, where "a", "B", "C", and "D" are identification information of the micro service module 4.
The following describes a specific calling method by taking a call "a" as an example: if the task needs to be called, a task execution request (the task execution request carries a target micro-service program version number corresponding to the target micro-service program version number) is sent to the task A, and after the task execution request is received by the task A, the micro-service program corresponding to the target micro-service program version number is operated to execute the task, and an execution result is fed back.
Compared with the prior art, in the embodiment, a plurality of versions of the micro service programs are stored in the micro service module 4, in the micro service calling process, the target micro service program version number corresponding to each micro service module 4 to be called is determined according to the version topology matched with the user, and then the micro service calling operation is executed according to the target micro service program version number corresponding to each micro service module 4 to be called, so that after the micro service program is upgraded, a proper micro service program version can be selected for the user, and the mapping relation between the micro service module 4 and the micro service program version number is updated to the version topology corresponding to the user, thereby effectively reducing the influence of the upgrade fault of the micro service program version on the use of the user.
Further, the present invention also provides a computer-readable storage medium storing a micro-service calling program, which is executable by at least one processor to cause the at least one processor to execute the micro-service calling method in any of the above embodiments.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An electronic device communicatively coupled to at least one microservice module, wherein the microservice module has one or more versions of a microservice program stored therein, the electronic device comprising a memory and a processor, the memory having stored thereon a microservice calling program that, when executed by the processor, performs the steps of:
a receiving step: receiving a micro-service calling request carrying user information, wherein the user information comprises user identification information;
a judging step: judging whether version topology identification information corresponding to the user identification information exists in the user information;
a searching step: when the version topology exists, searching a version topology corresponding to the version topology identification information in a preset version topology library, and taking the searched version topology as a to-be-used version topology, wherein the to-be-used version topology comprises a mapping relation between a micro service module and a micro service program version number;
a determination step: determining the micro service modules to be called of the micro service calling request, and determining the target micro service program version numbers corresponding to the micro service modules to be called according to the version topology to be used;
calling: and executing the micro-service calling operation according to the target micro-service program version number corresponding to each micro-service module to be called.
2. The electronic device of claim 1, wherein the processor executes the micro service call procedure, and after the determining step, further performs the steps of:
and when the version topology identification information corresponding to the user identification information does not exist in the user information, distributing the corresponding version topology for the user as the version topology to be used according to a predetermined distribution rule, and executing the determining step.
3. The electronic device of claim 2, wherein the allocation rule comprises: determining an attribute value of a user, and determining a version topology corresponding to the user according to the attribute value of the user and a mapping relation between a predetermined attribute value and the version topology.
4. The electronic device of claim 3, wherein the step of determining the attribute value of the user comprises:
reading an attribute value of a user in the user information, wherein the attribute value is a numerical value randomly selected from a preset numerical value interval in advance;
or identifying attribute information of the user, and determining an attribute value corresponding to the user according to a predetermined mapping relation between the attribute information and the attribute value; the attribute information includes geographical location information.
5. The electronic device according to any one of claims 1 to 4, wherein the microservice calling request includes identification information of the microservice module to be called and a calling sequence, and the calling step includes:
determining a network address corresponding to each micro service module to be called according to a mapping relation between the predetermined identification information of the micro service module and the network address of the micro service module;
and sequentially calling the micro-service modules to operate the micro-service programs corresponding to the target micro-service program version numbers according to the calling sequence and the network addresses corresponding to the micro-service modules to be called.
6. A micro-service calling method is applicable to an electronic device, and is characterized in that the electronic device is in communication connection with at least one micro-service module, one or more versions of micro-service programs are stored in the micro-service module, and the micro-service calling method comprises the following steps:
a receiving step: receiving a micro-service calling request carrying user information, wherein the user information comprises user identification information;
a judging step: judging whether version topology identification information corresponding to the user identification information exists in the user information;
a searching step: when the version topology exists, searching a version topology corresponding to the version topology identification information in a preset version topology library, and taking the searched version topology as a to-be-used version topology, wherein the to-be-used version topology comprises a mapping relation between a micro service module and a micro service program version number;
a determination step: determining the micro service modules to be called of the micro service calling request, and determining the target micro service program version numbers corresponding to the micro service modules to be called according to the version topology to be used;
calling: and executing the micro-service calling operation according to the target micro-service program version number corresponding to each micro-service module to be called.
7. The micro-service invocation method according to claim 6, wherein after said step of determining, the method further comprises:
when the version topology identification information corresponding to the user identification information does not exist in the user information, distributing the corresponding version topology for the user as the version topology to be used according to a predetermined distribution rule, and executing the determining step;
the allocation rule includes: determining an attribute value of a user, and determining a version topology corresponding to the user according to the attribute value of the user and a mapping relation between a predetermined attribute value and the version topology.
8. The micro-service invocation method according to claim 7, wherein said step of determining the attribute value of the user comprises:
reading an attribute value of a user in the user information, wherein the attribute value is a numerical value randomly selected from a preset numerical value interval in advance;
or identifying attribute information of the user, and determining an attribute value corresponding to the user according to a predetermined mapping relation between the attribute information and the attribute value; the attribute information includes geographical location information.
9. The micro-service invocation method according to any one of claims 6 to 8, wherein the micro-service invocation request includes identification information of the micro-service module to be invoked and an invocation sequence, and the invocation step includes:
determining a network address corresponding to each micro service module to be called according to a mapping relation between the predetermined identification information of the micro service module and the network address of the micro service module;
and sequentially calling the micro-service modules to operate the micro-service programs corresponding to the target micro-service program version numbers according to the calling sequence and the network addresses corresponding to the micro-service modules to be called.
10. A computer-readable storage medium, having stored thereon a microservice call procedure executable by at least one processor for causing the at least one processor to perform the steps of the microservice call method according to any of claims 6-9.
CN202010248969.6A 2020-03-31 2020-03-31 Electronic device, micro-service calling method, and computer-readable storage medium Active CN111475226B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010248969.6A CN111475226B (en) 2020-03-31 2020-03-31 Electronic device, micro-service calling method, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010248969.6A CN111475226B (en) 2020-03-31 2020-03-31 Electronic device, micro-service calling method, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN111475226A true CN111475226A (en) 2020-07-31
CN111475226B CN111475226B (en) 2022-04-29

Family

ID=71750421

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010248969.6A Active CN111475226B (en) 2020-03-31 2020-03-31 Electronic device, micro-service calling method, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN111475226B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130097680A1 (en) * 2011-10-17 2013-04-18 Microsoft Corporation High-density multi-tenant distributed cache as a service
US20180039494A1 (en) * 2016-08-05 2018-02-08 Oracle International Corporation Zero down time upgrade for a multi-tenant identity and data security management cloud service
US20180088925A1 (en) * 2016-09-27 2018-03-29 Ca, Inc. Microservices version state visualization
CN108279987A (en) * 2018-01-19 2018-07-13 口碑(上海)信息技术有限公司 The method for edition management and device of application program
CN110798502A (en) * 2019-09-18 2020-02-14 平安科技(深圳)有限公司 Grayscale publishing method and device based on micro-service framework and computer equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130097680A1 (en) * 2011-10-17 2013-04-18 Microsoft Corporation High-density multi-tenant distributed cache as a service
US20180039494A1 (en) * 2016-08-05 2018-02-08 Oracle International Corporation Zero down time upgrade for a multi-tenant identity and data security management cloud service
US20180088925A1 (en) * 2016-09-27 2018-03-29 Ca, Inc. Microservices version state visualization
CN108279987A (en) * 2018-01-19 2018-07-13 口碑(上海)信息技术有限公司 The method for edition management and device of application program
CN110798502A (en) * 2019-09-18 2020-02-14 平安科技(深圳)有限公司 Grayscale publishing method and device based on micro-service framework and computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
高宇 等: ""基于Kubernetes的微服务业务拓扑发现及业务评价"", 《成都信息工程大学学报》 *

Also Published As

Publication number Publication date
CN111475226B (en) 2022-04-29

Similar Documents

Publication Publication Date Title
CN110297689B (en) Intelligent contract execution method, device, equipment and medium
CN107979508B (en) Micro-service test method and device
CN108388599B (en) Electronic device, data migration and calling method and storage medium
CN112769706B (en) Componentized routing method and system
CN112529711B (en) Transaction processing method and device based on block chain virtual machine multiplexing
JPH09171473A (en) Method for management of error and data-processing system
CN111475226B (en) Electronic device, micro-service calling method, and computer-readable storage medium
CN111158777A (en) Component calling method and device and computer readable storage medium
WO2023016485A1 (en) Method for acquiring function call information, and apparatus, electronic device and medium
CN108628620B (en) POS application development implementation method and device, computer equipment and storage medium
CN115665231A (en) Service creation method, device and computer-readable storage medium
CN112130900B (en) User information management method, system, equipment and medium for BMC
CN113760325A (en) Container environment updating method and device
CN111488286A (en) Method and device for independently developing Android module
US10303531B2 (en) Console application through web service
CN111290806B (en) Calling method and device of application program interface, computer equipment and storage medium
CN114640652B (en) Information processing method and device
US8983938B1 (en) Selecting a command file
CN110879747B (en) Resource management method and device
CN115373638A (en) Data processing method, device and equipment for front end and back end and storage medium
CN112631760A (en) Thread creating method, system and device and computer storage medium
CN117472407A (en) Platform upgrading method, device, equipment and medium based on k8s cluster construction
CN114661313A (en) Software package issuing method, software package generating method, device, equipment and storage medium
CN112365259A (en) Integral synchronization method and integral synchronization system for system integration middlebox
CN116266113A (en) Request processing method, device, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant