Message-driven microservice dynamic orchestration method and related equipment
Through a message-driven approach, the influencing factors of microservices are obtained from business messages to generate process orchestration data. This solves the problems of high coupling and difficult adjustment of static orchestration in traditional microservice orchestration methods, realizes dynamic orchestration of microservices, improves system efficiency and reduces maintenance difficulty.
Patent Information
- Application Number
- CN202210352789.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-03-31
AI Technical Summary
Among existing microservice orchestration methods, the traditional centralized process control center has a high degree of coupling and is difficult to maintain, and the collaboration-oriented static orchestration method has difficulty adjusting the microservice call link.
A message-driven approach is used to obtain the impact factor of microservices from business messages, generate process orchestration data and store it in the cache center. The microservice dynamically determines the next service and obtains the process orchestration data through the cache center for connection.
Dynamic orchestration of microservices is achieved, and there is no need to change or restart services when adjusting call links, which improves system efficiency and reduces maintenance difficulty.
Smart Images

Figure CN114942841B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of microservice architecture technology, and in particular to a message-driven microservice dynamic orchestration method and related equipment. Background Art
[0002] Microservices enable better management and reuse by breaking services into small, relatively independent functional units. In complex business scenarios, the call relationships between microservices may present different call chains depending on the business type, making microservice orchestration crucial. A traditional approach involves building a centralized process control center that receives requests and, according to business logic rules, sequentially calls each microservice to complete the business activity. This approach results in high coupling, complex call logic, and difficulty in maintenance. Another collaborative orchestration approach typically uses message queues for asynchronous interaction between microservices, with each microservice interacting with other microservices by subscribing to and publishing messages. This approach employs static service orchestration, with the call relationships between microservices determined at system startup, making it difficult to adjust the microservice call chain. Summary of the Invention
[0003] In view of this, the purpose of this application is to propose a message-driven microservice dynamic orchestration method and related equipment.
[0004] Based on the above purpose, the present application provides a message-driven microservice dynamic orchestration method, which is applied to a microservice dynamic orchestration system, the system including multiple microservices, and the method including: obtaining the influence factor of the microservice from the business message; generating the process orchestration data of the microservice according to the message subject preset by the microservice and the influence factor, and storing the process orchestration data in a cache center; allowing each of the microservices in all the microservices to read the process orchestration data from the cache center and determine the next microservice connected to it according to the process orchestration data.
[0005] Optionally, the message topic is determined according to the function of the microservice.
[0006] Optionally, the influencing factors include the system source, business type, printing type, and document type of the microservice.
[0007] Optionally, the process orchestration data includes the message topic of the microservice and a target message topic, and the target message topic is generated according to the impact factor and the message topic.
[0008] Optionally, the step of causing each of the microservices to read the process orchestration data from the cache center and determine the next microservice to be connected thereto based on the process orchestration data includes causing each of the microservices to obtain the process orchestration data from the cache center based on the message topic, and determine the next microservice to be connected thereto based on the target message topic.
[0009] Optionally, the method further includes: generating an orchestration view of the microservice in a database according to the process orchestration data, so as to visualize the process orchestration data.
[0010] Based on the same inventive concept, the present application also provides a message-driven microservice dynamic orchestration device, which is applied to a microservice dynamic orchestration system, the system including multiple microservices, and the device including: an acquisition module, configured to obtain the impact factor of the microservice from a business message; a data generation module, configured to generate process orchestration data of the microservice according to the message subject preset by the microservice and the impact factor, and store the process orchestration data in a cache center; an orchestration module, configured to enable each of the microservices in all the microservices to read the process orchestration data from the cache center and determine the next microservice to be connected to it based on the process orchestration data.
[0011] Optionally, the apparatus further includes: a view generating module configured to generate an orchestration view of the microservice in a database according to the process orchestration data, so as to visualize the process orchestration data.
[0012] Based on the same inventive concept, the present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and runnable on the processor, characterized in that when the processor executes the program, any one of the message-driven dynamic orchestration methods for microservices is implemented.
[0013] Based on the same inventive concept, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, characterized in that the computer instructions are used to enable a computer to execute any one of the message-driven microservice dynamic orchestration methods.
[0014] From the above description, it can be seen that the message-driven dynamic orchestration method of microservices provided by the present application is applied to a dynamic orchestration system of microservices, wherein the system includes multiple microservices, and the method includes: obtaining the influence factor of the microservice from the business message; generating the process orchestration data of the microservice according to the message subject preset by the microservice and the influence factor, and storing the process orchestration data in a cache center; allowing each of the microservices in all the microservices to read the process orchestration data from the cache center and determine the next microservice connected to it according to the process orchestration data. The method provided by the present application realizes the dynamic orchestration of microservices, and there is no need to change or restart the microservice when adjusting the microservice call link, thereby ensuring the working efficiency of the system, reducing the difficulty of system maintenance, and solving the problem that the microservice call link is difficult to adjust. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in this application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are merely embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0016] Figure 1 This is a flow chart of a method for dynamic orchestration of microservices based on message-driven operation according to an embodiment of the present application;
[0017] Figure 2 This is a schematic diagram of the microservice business processing flow of an embodiment of the present application;
[0018] Figure 3 This is a schematic diagram of the microservice orchestration results of an embodiment of the present application;
[0019] Figure 4 This is a structural diagram of a message-driven microservice dynamic orchestration device according to an embodiment of the present application;
[0020] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to make the objectives, technical solutions and advantages of this application more clear, this application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0022] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the usual meanings understood by people with ordinary skills in the field to which this application belongs. The "first", "second" and similar words used in the embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0023] An embodiment of the present application provides a message-driven microservice dynamic orchestration method, which is applied to a microservice dynamic orchestration system, wherein the system includes multiple microservices, such as Figure 1 As shown, the method includes:
[0024] Step S101: Obtain the impact factor of the microservice from the business message. Figure 2 As shown, a microservice begins processing by consuming data from a message topic. After processing is complete, it terminates the microservice by writing the message to another message topic, or simply terminates the entire service. By obtaining the factors that influence microservice scheduling, we can dynamically determine which message topic the microservice should write the next message to, thereby achieving dynamic microservice orchestration.
[0025] Step S102: Generate process orchestration data for the microservice based on the message topic preset by the microservice and the impact factor, and store the process orchestration data in a cache center. Centralizing all process orchestration data in the cache center allows microservices to dynamically obtain the required process orchestration data from the cache center, thereby enabling dynamic orchestration of microservices.
[0026] Step S103: Instruct each of the microservices to read the process orchestration data from the cache center and determine the next microservice to connect to based on the process orchestration data. The connection relationship and call relationship between each microservice are not predetermined, but are dynamically determined based on the function and influence factor of each microservice. When adjusting the microservice call link, there is no need to change or restart the microservice. Only the adjustment information needs to be written into the business message. The influence factor obtained from the business message and the process orchestration data generated based on the influence factor also carry the adjustment information. After the microservice obtains the process orchestration data, it will naturally write the message into the adjusted message topic, realizing dynamic orchestration of microservices and solving the problem of difficult adjustment of microservice call links.
[0027] The embodiment of the present application provides a message-driven dynamic orchestration method for microservices, which is applied to a dynamic orchestration system for microservices. The system includes multiple microservices, and the method includes: obtaining the impact factor of the microservice from a business message; generating process orchestration data for the microservice according to the message subject preset by the microservice and the impact factor, and storing the process orchestration data in a cache center; allowing each of the microservices in all the microservices to read the process orchestration data from the cache center and determine the next microservice to be connected to it according to the process orchestration data. The method provided in the embodiment of the present application realizes the dynamic orchestration of microservices. When adjusting the microservice call link, there is no need to change or restart the microservice, which ensures the work efficiency of the system, reduces the difficulty of system maintenance, and solves the problem that the microservice call link is difficult to adjust.
[0028] In a specific embodiment, the microservice dynamic orchestration system also includes a startup registration center and a configuration center, wherein the registration center is responsible for the registration and discovery of microservices; the configuration center is the configuration management center of the microservices, responsible for the maintenance of public configurations and the cache preloading function of configuration data. Microservices can obtain data from the configuration center during startup or operation; the configuration center is also responsible for loading process orchestration data into the cache center for use by each microservice.
[0029] In some embodiments, the message topic is determined based on the functionality of the microservice. In specific implementations, a message topic is created for each microservice in the message middleware based on its functionality, and each microservice is assigned a specific ID. The message middleware is a medium for storing messages and can define message topics. Using the microservices in the insurance contract generation scenario as an example, Table 1 lists the consumption topics and IDs determined for each microservice based on its functionality.
[0030] Table 1: Number, function and consumption theme of each microservice
[0031]
[0032] In some embodiments, the influencing factors include the system source, business type, printing type, and document type of the microservice.
[0033] In some embodiments, the process orchestration data includes the message topic and a target message topic of the microservice, where the target message topic is generated based on the influencing factor and the message topic. By obtaining the influencing factor that affects microservice scheduling, it is possible to dynamically determine to which message topic the microservice will write the next message, thereby achieving dynamic orchestration of microservices.
[0034] In the specific implementation, taking the microservice in the insurance contract generation scenario as an example, there are a total of 4 influencing factors, as shown in Table 2 and Figure 3 As shown in , for each task, the values of its various impact factors can be extracted from the original business message. Combined with the number of the microservice, it can be obtained which target message topic the microservice should send the message to after processing the business. Figure 3 It can be seen that the same microservice has different target message topics for different influencing factors, which means that there are two microservice call links that include this microservice, and the microservice writes messages to two different target message topics at the same time.
[0035] Table 2: Factors affecting the scheduling of each microservice
[0036]
[0037] In some embodiments, the step S103 includes: instructing each of the microservices in all the microservices to obtain the process orchestration data from the cache center according to the message topic, and determining the next microservice to be connected thereto according to the target message topic.
[0038] In some embodiments, the method further comprises:
[0039] Step S104: Generate an orchestration view of the microservice in a database based on the process orchestration data to visualize the process orchestration data. In specific implementations, the management terminal extracts and displays the orchestration view from the database. Related technologies lack a global view of microservice orchestration scheduling. This embodiment of the present application generates an orchestration view based on the process orchestration data, enabling technicians to understand the global orchestration of microservices.
[0040] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied in a distributed scenario and performed by multiple devices working together. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the method.
[0041] It should be noted that the above description is limited to some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0042] Based on the same inventive concept, corresponding to any of the above embodiments and methods, the present application also provides a message-driven microservice dynamic orchestration device, which is applied to a microservice dynamic orchestration system, wherein the system includes multiple microservices, such as Figure 4 As shown, the device includes:
[0043] An acquisition module 10 is configured to acquire the impact factor of the microservice from the business message;
[0044] The data generation module 20 is configured to generate process orchestration data of the microservice according to the message subject preset by the microservice and the influencing factor, and store the process orchestration data in a cache center;
[0045] The orchestration module 30 is configured to enable each of the microservices in all the microservices to read the process orchestration data from the cache center and determine the next microservice to be connected thereto according to the process orchestration data.
[0046] The device provided in the embodiment of the present application includes an acquisition module configured to obtain the impact factor of the microservice from the business message; a data generation module configured to generate the process orchestration data of the microservice according to the message subject preset by the microservice and the impact factor, and store the process orchestration data in a cache center; an orchestration module configured to enable each of the microservices in all the microservices to read the process orchestration data from the cache center and determine the next microservice connected to it according to the process orchestration data. The device provided in the present application realizes the dynamic orchestration of microservices. When adjusting the microservice call link, there is no need to change or restart the microservice, which ensures the work efficiency of the system, reduces the difficulty of system maintenance, and solves the problem that the microservice call link is difficult to adjust.
[0047] In some embodiments, the apparatus further includes: a view generating module configured to generate an orchestration view of the microservice in a database according to the process orchestration data, so as to visualize the process orchestration data.
[0048] In some embodiments, the orchestration module is further configured to: enable each of the microservices in all the microservices to obtain the process orchestration data from the cache center according to the message topic, and determine the next microservice to connect to it according to the target message topic.
[0049] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing this application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0050] The apparatus of the above embodiment is used to implement the corresponding message-driven dynamic orchestration method of microservices in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described in detail here.
[0051] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, the message-driven dynamic orchestration method of microservices described in any of the above embodiments is implemented.
[0052] Figure 5 A more specific hardware structure diagram of an electronic device provided in this embodiment is shown. The device may include: a processor 510, a memory 520, an input / output interface 530, a communication interface 540, and a bus 550. The processor 510, the memory 520, the input / output interface 530, and the communication interface 540 are connected to each other within the device via the bus 550.
[0053] The processor 510 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0054] The memory 520 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 520 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 520 and is called and executed by the processor 510.
[0055] The input / output interface 530 is used to connect input / output modules to implement information input and output. The input / output modules can be configured as components in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.
[0056] The communication interface 540 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WiFi, Bluetooth, etc.).
[0057] The bus 550 comprises a pathway for transmitting information between the various components of the device (eg, the processor 510 , the memory 520 , the input / output interface 530 , and the communication interface 540 ).
[0058] It should be noted that although the above device only shows the processor 510, the memory 520, the input / output interface 530, the communication interface 540, and the bus 550, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.
[0059] The electronic device of the above embodiment is used to implement the corresponding message-driven microservice dynamic orchestration method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0060] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the message-driven microservice dynamic orchestration method as described in any of the above embodiments.
[0061] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0062] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the message-driven microservice dynamic orchestration method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0063] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. Within the scope of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0064] In addition, for simplicity of description and discussion, and in order not to make the embodiment of the application difficult to understand, the known power supply / ground connection with integrated circuit (IC) chip and other components may or may not be shown in the accompanying drawings provided. In addition, the device can be shown in the form of a block diagram to avoid making the embodiment of the application difficult to understand, and this also takes into account the following fact, that is, the details of the embodiment of these block diagram devices are highly dependent on the platform to be implemented in the embodiment of the application (that is, these details should be fully within the scope of understanding of those skilled in the art). When specific details (for example, circuit) are set forth to describe exemplary embodiments of the application, it will be apparent to those skilled in the art that the embodiment of the application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0065] Although the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may utilize the embodiments discussed.
[0066] The embodiments of the present application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of this application.
Claims
1. A message-driven microservice dynamic orchestration method, the method is applied to a microservice dynamic orchestration system, the system includes multiple microservices, and is characterized in that: The method comprises: Obtaining the impact factor of the microservice from the business message; Generate process orchestration data for the microservice according to the message topic preset by the microservice and the influencing factor, and store the process orchestration data in a cache center; Instructing each of the microservices to read the process orchestration data from the cache center and determine the next microservice to be connected thereto according to the process orchestration data; The influencing factors include the system source, business type, printing type, and document type of the microservice.
2. The message-driven microservice dynamic orchestration method according to claim 1 is characterized in that: The message topic is determined according to the function of the microservice.
3. The message-driven microservice dynamic orchestration method according to claim 1 is characterized in that: The process orchestration data includes the message topic and a target message topic of the microservice, where the target message topic is generated according to the impact factor and the message topic.
4. The message-driven microservice dynamic orchestration method according to claim 3 is characterized in that: The step of causing each of the microservices to read the process orchestration data from the cache center and determining the next microservice to be connected thereto according to the process orchestration data includes: Each of the microservices in all the microservices is instructed to obtain the process orchestration data from the cache center according to the message topic, and determine the next microservice to be connected thereto according to the target message topic.
5. The message-driven microservice dynamic orchestration method according to claim 1 is characterized in that: Also includes: An orchestration view of the microservice is generated in a database according to the process orchestration data to visualize the process orchestration data.
6. A message-driven microservice dynamic orchestration device, the device is applied to a microservice dynamic orchestration system, the system includes multiple microservices, characterized in that: The device comprises: An acquisition module is configured to obtain the impact factor of the microservice from the business message; A data generation module is configured to generate process orchestration data of the microservice according to a message topic preset by the microservice and the influencing factor, and store the process orchestration data in a cache center; an orchestration module configured to enable each of the microservices in all the microservices to read the process orchestration data from the cache center and determine the next microservice to be connected thereto according to the process orchestration data; The influencing factors include the system source, business type, printing type, and document type of the microservice.
7. The message-driven microservice dynamic orchestration device according to claim 6, characterized in that: Also includes: The view generation module is configured to generate an orchestration view of the microservice in a database according to the process orchestration data, so as to visualize the process orchestration data.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Service arrangement and business process processing method and device applied to SaaS
CN110310034A
Cited By
An asynchronous business arrangement method and system under a micro-service architecture
CN122526759A
A method and system for asynchronous business orchestration under a microservice architecture
CN122526759B