Micro-service system decoupling method based on event driving and related equipment

By building event bus services in the microservice system, registering and monitoring event types, and realizing event collection and processing, the problem of high coupling dependence of microservice system subsystem is solved, the system scalability and stability is improved, and development and Test process.

CN119065872AInactive Publication Date: 2024-12-03SHENZHEN DADAO CLOUD TECH CO LTD

Patent Information

Application Number
CN202411540709.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2024-12-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The coupling dependence between sub-soft systems of existing microservice software systems is high, resulting in poor system scalability and poor stability, and large development and testing workloads when changing.

Method used

Adopt the event-driven microservice system decoupling method, by building event bus services, registering and monitoring event types, setting up event collection plug-ins, collecting and processing events, and realizing feedback on event types to be monitored in event queues of event bus services. Reduce system coupling.

Benefits of technology

It reduces the complexity of system decoupling, improves the scalability and stability of the system, and significantly improves the development and testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065872A_ABST
    Figure CN119065872A_ABST
Patent Text Reader

Abstract

The invention discloses a micro-service system decoupling method based on event driving and related equipment. The method comprises the following steps: establishing an event bus service; obtaining a to-be-monitored event type in the first software subsystem according to the user operation behavior; registering the type of the event to be monitored into an event bus service; adding a monitor of a to-be-monitored event type in the event bus service; setting an event collection plug-in in the second software subsystem; collecting a trigger event in the second software subsystem through an event collection plug-in and writing the trigger event into an event queue of the event bus service; when the monitor monitors the event type to be monitored in the event queue, the target trigger event corresponding to the event type to be monitored is fed back to the first software subsystem for processing through the event bus service. When the micro-service system is decoupled, the second software subsystem only needs to concern event triggering, the first software subsystem only needs to monitor events, and the event bus service is responsible for event transfer, so that the system decoupling complexity is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud technology, and in particular to an event-driven microservice system decoupling method and related equipment. Background Art

[0002] A microservice architecture software system is a cloud-native architecture software system. A single microservice architecture software system may contain many coupled and separately deployable sub-software systems. The sub-software systems of a microservice architecture software system are coupled and depend on each other, which will cause the system's call chain to be too long, with poor scalability and stability. In addition, if the microservice architecture software system needs to be changed, the system needs to be modified to a large extent, which greatly increases the workload of development and testing. Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0003] The main purpose of the present invention is to solve the technical problem that the sub-software systems of the existing microservice software system have high coupling dependence, resulting in poor system scalability and poor stability.

[0004] A first aspect of the present invention provides a method for decoupling a microservice system based on event-driven, comprising: Building an event bus service, the functions of which include registration of event types, configuration of event monitors, and collection and processing of events; In the first software subsystem, the type of event to be monitored is obtained according to the operation behavior of the user; Registering the event type to be monitored in the event bus service; Adding a monitor for the event type to be monitored in the event bus service; Setting an event collection plug-in for the event bus service in the second software subsystem; Collecting trigger events in the second software subsystem through the event collection plug-in, and writing the collected trigger events into the event queue of the event bus service; When the monitor detects that the event queue contains the event type to be monitored, the target trigger event corresponding to the event type to be monitored is fed back to the first software subsystem for processing through the event bus service.

[0005] In an optional implementation of the first aspect of the present invention, obtaining the event type to be monitored according to the user's operation behavior in the first software subsystem includes: In the first software subsystem, according to the operation behavior of the user, a system function corresponding to the operation behavior is obtained; Based on the system function, a character string identifier corresponding to the system function is obtained; Based on the character string identifier in the event type classification library, the event type to be monitored corresponding to the operation behavior is obtained.

[0006] In an optional implementation of the first aspect of the present invention, registering the event type to be monitored with the event bus service includes: Creating an event bus instance, using the event bus instance as a central point for event delivery; Assigning a unique identifier to the event type to be monitored; Obtaining a registration method for an event from the event bus instance; Register the unique identifier in the event bus instance as a parameter of the registration method; The event type to be monitored is published in the event bus instance.

[0007] In an optional implementation of the first aspect of the present invention, adding a monitor for the event type to be monitored in the event bus service includes: Create a monitor class and define a monitoring method for the event in the monitor class; Configuring the monitoring method to specify monitoring of events corresponding to the event type to be monitored; The monitor class is registered in the event bus instance, and a unique ID and a subscription class are assigned to the monitor class.

[0008] In an optional implementation of the first aspect of the present invention, the building of the event bus service includes: Analyze the business scale of the first software subsystem and the second software subsystem; Matching a target event bus technology from a preset event bus technology library based on the business scale of the first software subsystem and the second software subsystem; Based on the configuration specification in the target event bus technology, configure the event model of the event bus service and implement the logic of event publishing and subscription; Deploy the event bus service to the operating environment and ensure that the event bus service operates normally through testing.

[0009] In an optional implementation of the first aspect of the present invention, the collecting the trigger events in the second software subsystem by the event collection plug-in and writing the collected trigger events into the event queue of the event bus service includes: In response to the installation of the event collection plug-in, creating an event monitoring process in the background of the second software subsystem; Monitoring trigger events generated by user operations in the second software subsystem through the event monitoring process; When the event monitoring process detects the generation of the trigger event, the trigger event is uploaded and written into the event queue of the event bus service.

[0010] In an optional implementation of the first aspect of the present invention, when the monitor detects that the event queue has the event type to be monitored, feeding back the target trigger event corresponding to the event type to be monitored to the first software subsystem for processing through the event bus service includes: When each trigger event is written into the event queue, the event type corresponding to the trigger event is obtained through the monitor, and it is determined whether the event type corresponding to the trigger event is the event type to be monitored; If the event type corresponding to the trigger event is the event type to be monitored, the event bus service feeds back the target trigger event corresponding to the event type to be monitored to the first software subsystem for processing.

[0011] A second aspect of the present invention provides an event-driven microservice system decoupling device, the microservice system decoupling device comprising: An event bus service building module is used to build an event bus service, the functions of which include registration of event types, configuration of event monitors, and collection and processing of events; The module for obtaining the type of event to be monitored is used to obtain the type of event to be monitored according to the operation behavior of the user in the first software subsystem; A module for registering event types to be monitored, used for registering the event types to be monitored into the event bus service; A monitor adding module, used for adding a monitor for the event type to be monitored in the event bus service; A plug-in setting module, used for setting an event collection plug-in of the event bus service in the second software subsystem; An event collection module, used to collect events in the second software subsystem through the event collection plug-in, and write the collected events into the event queue of the event bus service; The event feedback processing module is used to feed back the target event corresponding to the event type to be monitored to the first software subsystem for processing through the event bus service when the monitor detects that the event queue contains the event type to be monitored.

[0012] A third aspect of the present invention provides an event-driven microservice system decoupling device, the event-driven microservice system decoupling device comprising: a memory and at least one processor, the memory storing instructions, the memory and the at least one processor being interconnected via a line; The at least one processor calls the instruction in the memory to enable the event-driven microservice system decoupling device to perform the event-driven microservice system decoupling method as described in any one of the first aspects above.

[0013] A fourth aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the event-driven microservice system decoupling method as described in any one of the first aspects above is implemented.

[0014] Beneficial effects: The present invention discloses a method for decoupling a microservice system based on event-driven and related equipment. The method includes setting up an event bus service; obtaining the event type to be monitored according to the user operation behavior in the first software subsystem; registering the event type to be monitored in the event bus service; adding a monitor of the event type to be monitored in the event bus service; setting an event collection plug-in in the second software subsystem; collecting the trigger events in the second software subsystem through the event collection plug-in and writing them into the event queue of the event bus service; when the monitor detects that there is an event type to be monitored in the event queue, the target trigger event corresponding to the event type to be monitored is fed back to the first software subsystem through the event bus service for processing. When the microservice system of the present invention is decoupled, the second software subsystem only needs to care about event triggering, the first software subsystem only needs to monitor events, and the event bus service is responsible for event transfer, which reduces the complexity of system decoupling. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 The present invention is a flowchart of an exemplary method for decoupling a microservice system based on event-driven processing in an embodiment of the present invention.

[0016] Figure 2 The present invention is a schematic diagram of the module composition of an exemplary event-driven microservice system decoupling device in an embodiment of the present invention.

[0017] Figure 3 The present invention is a schematic diagram of the device composition of an exemplary event-driven microservice system decoupling device in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The embodiments disclosed in the present invention are described in more detail below with reference to the accompanying drawings. Although certain embodiments disclosed in the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments disclosed in the present invention are only for exemplary purposes and are not intended to limit the scope of protection disclosed in the present invention.

[0019] In the description of the embodiments disclosed in the present invention, if there are terms, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. can refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0020] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 The first aspect of the present invention provides a method for decoupling a microservice system based on event-driven, comprising: S100. Building an event bus service, wherein the functions of the event bus service include registration of event types, configuration of event monitors, and collection and processing of events; specifically, the event bus service is an implementation of the publish-subscribe model, which is a centralized event processing mechanism that allows different subsystems to communicate with each other without relying on each other, thereby achieving a decoupling purpose. The present invention utilizes this feature of the event bus service.

[0021] At the hardware configuration level, in an optional implementation of step S100 of the present invention, the establishment of the event bus service includes: Analyze the business scale of the first software subsystem and the second software subsystem; in this step, the business interaction volume between the first software subsystem and the second software subsystem is obtained, so as to facilitate the subsequent configuration of related hardware based on the size of the business interaction volume.

[0022] Based on the business scale of the first software subsystem and the second software subsystem, the target event bus technology is matched from the preset event bus technology library; in this step, the principle of matching the event bus technology is that the business carrying capacity of the event bus technology can meet the business demand of the first software subsystem and the second software subsystem, and the target event bus technology exemplarily includes RabbitMQ, Kafka and other technologies, which provide functions such as message queues and message distribution, so that the event bus can run efficiently.

[0023] Based on the configuration specifications in the target event bus technology, configure the event model of the event bus service and implement the logic of event publishing and subscription; in this step, the event model defines the event types in the system and the data they carry. Usually, these events are domain events in domain-driven design, which represent important business activities in the domain; implementing the logic of event publishing and subscription is to implement the event publishing and subscription logic in microservices. The publisher is responsible for publishing events to the event bus, while the subscriber subscribes to specific events and processes them.

[0024] Deploy the event bus service to the operating environment and ensure that the event bus service operates normally through testing. This step is to test the event bus service in the operating environment to ensure that events can be published, transmitted and processed correctly.

[0025] At the software configuration level, the steps to build an event bus service include: defining the event processing interface: Create an event handling interface that all event monitors need to implement. For example, in C#, you can define a generic interface IEventHandler <t>, where T is the type of the event parameter.

[0026] Create an event bus class: Implement an event bus class to manage the registration and deregistration of event monitors and the triggering of events. This class usually contains a dictionary to store the list of monitors corresponding to different event types.

[0027] Define specific event classes: Define specific event classes, which usually inherit from EventArgs and are used to encapsulate event-related data.

[0028] Implement event monitors: Implement specific event monitors, which need to implement the event processing interface defined previously.

[0029] Use message queues: In a distributed system, you can use message queues such as RabbitMQ or Kafka to implement an event bus, which helps in communication between different service instances.

[0030] Testing and verification: Before deploying the event bus service, perform sufficient testing and verification to ensure that it works properly in different scenarios.

[0031] S200. Obtaining the event type to be monitored in the first software subsystem according to the user's operation behavior. In this step, the user's operation behavior may be that the user clicks a button on the user interface of the first software subsystem, and the function of the button is to obtain data corresponding to a content on the interface. In order to facilitate obtaining the corresponding data from the second software subsystem, the present invention needs to convert the operation behavior into the corresponding event type to be monitored.

[0032] In an optional implementation of step S200 of the present invention, obtaining the event type to be monitored in the first software subsystem based on the user's operation behavior includes: obtaining, in the first software subsystem, a system function corresponding to the operation behavior based on the user's operation behavior; in this step, for example, the corresponding system function can be found based on the click coordinates of the user on the interface.

[0033] Based on the system function, the string identifier corresponding to the system function is obtained; generally speaking, in system development, engineers will write codes for each function, and each function has a corresponding string identifier. These identifiers can be used in configuration files, databases, code comments, etc. This step obtains the code identifier corresponding to the system function.

[0034] Based on the string identifier in the event type classification library, the event type to be monitored corresponding to the operation behavior is obtained. In the event type classification library, a mapping relationship is established for each event type to associate the string identifier with the event type. This mapping relationship can be a database table, a JSON file or any other form of data structure. In the present invention, the corresponding event type can be quickly found in the classification library based on the string identifier. This search mechanism can be a simple search function or a more complex search engine.

[0035] S300, registering the event type to be monitored in the event bus service; in the present invention, after obtaining the event type to be monitored through step S200, in order to enable the event bus service to transmit events related to the event type to be monitored, it is necessary to register the event type to be monitored in the event bus service.

[0036] In an optional implementation of step S300 of the present invention, registering the event type to be monitored with the event bus service includes: Create an event bus instance and use the event bus instance as the central point for event transmission. In the event bus instance, define the event bus event processing interface, event bus class, specific event class, and how to implement event monitor and use event bus.

[0037] A unique identifier is assigned to the event type to be monitored; in the present invention, the unique identifier can be obtained based on the system identity of the first software subsystem, and each type of event type to be monitored corresponds to a unique identifier, which can ensure the correctness of the event bus service in the process of transmitting events and the uniqueness of the path.

[0038] The event registration method is obtained from the event bus instance; in this step, the event bus instance predefines event classes corresponding to various event types, and in this step, the corresponding event class and the corresponding event processing interface in the registration method are used for registration.

[0039] The unique identifier is used as a parameter of the registration method to register in the event bus instance; in this step, after the registration is completed, the unique identifier will be bound to the corresponding event class and the corresponding event processing interface.

[0040] The event type to be monitored is published in the event bus instance. After the event type to be monitored is registered in the event bus instance, the event type to be monitored needs to be published so that the second software subsystem can subsequently subscribe to the event type to be monitored through a monitor.

[0041] S400. Adding a monitor for the event type to be monitored in the event bus service; in the present invention, in order to ensure the accuracy of monitoring, the monitor is configured to monitor only the event type to be monitored, and the monitor identifies the event type based on the unique identifier of the event type to be monitored.

[0042] In an optional implementation of step S400 of the present invention, adding a monitor for the event type to be monitored in the event bus service includes: creating a monitor class, and defining a monitoring method for the event in the monitor class, in which specific monitoring rules can be clearly defined, and the monitoring method can be feature recognition or character matching; configuring the monitoring method to specify monitoring of events corresponding to the event type to be monitored, and in order to ensure the focus of the monitor in the present invention, the monitor is only configured to monitor one event type; registering the monitor class in the event bus instance, and assigning a unique ID and a subscription class to the monitor class, the role of the unique ID is to enable event subscribers to quickly find the monitor object that needs to be subscribed, and the role of the subscription class is to divide the monitor into different monitoring categories, so that the monitor can perform different categories of monitoring tasks.

[0043] S500. An event collection plug-in of the event bus service is set in the second software subsystem. In the present invention, the event collection function of the event bus service is made into a plug-in, which is convenient for configuration in the second software subsystem. The event collection plug-in can monitor the event triggering in the second software subsystem in real time. All triggering events of the event collection plug-in will be collected and uploaded to the event queue of the event bus service for monitoring and identification by the monitor.

[0044] S600, collecting trigger events in the second software subsystem through the event collection plug-in, and writing the collected trigger events into the event queue of the event bus service; in an optional implementation of step S600 of the present invention, collecting trigger events in the second software subsystem through the event collection plug-in, and writing the collected trigger events into the event queue of the event bus service includes: in response to the installation of the event collection plug-in, creating an event monitoring process in the background of the second software subsystem; monitoring trigger events generated by user operations in the second software subsystem through the event monitoring process; when the event monitoring process detects the generation of the trigger event, uploading the trigger event and writing it into the event queue of the event bus service.

[0045] S700. When the monitor detects that the event queue contains the event type to be monitored, the target trigger event corresponding to the event type to be monitored is fed back to the first software subsystem for processing through the event bus service. In an optional implementation of step S700 of the present invention, when the monitor detects that the event queue contains the event type to be monitored, the target trigger event corresponding to the event type to be monitored is fed back to the first software subsystem for processing through the event bus service, including: when each trigger event is written into the event queue, the event type corresponding to the trigger event is obtained through the monitor, and it is determined whether the event type corresponding to the trigger event is the event type to be monitored; if the event type corresponding to the trigger event is the event type to be monitored, the event bus service feeds back the target trigger event corresponding to the event type to be monitored to the first software subsystem for processing.

[0046] The technical solution of the present invention can be summarized as follows: 1. Build an event bus system, the main functions of which include registration of event types, configuration of event monitors, collection and processing of events. 2. Analyze the functions of the software system, and first identify the event type based on the user's operation behavior. 3. Register the event type identified in 2 to the event bus service. 4. Add an event monitor to the event bus server. 5. The newly added monitor in the event bus server configuration 4 monitors the corresponding event type. 6. Integrate the event collection plug-in of the event bus system in the target software system. 7. Develop an event trigger function in the target software system to trigger related events. 8. The user operates the target software system to trigger an event, which is written to the event queue of the event bus system through the event collection plug-in. 9. The event bus system obtains events from the event queue, finds the corresponding monitor according to the monitor configuration, and performs event processing, thereby realizing the decoupling of upstream and downstream services in the entire system.

[0047] The event-driven microservice system decoupling method of the present invention has the following characteristics: 1) identifying event types through user behavior; 2) registering event types of event bus services and configuring event monitors; 3) plug-in-based event collection functions; 4) interactive decoupling of upstream and downstream systems, where the upstream system only needs to care about the triggering of events, and the downstream system only needs to monitor related events and transfer them through the event bus service. Through the technical solution of the present invention, the complexity of the microservice system and the coupling between services can be reduced, the robustness of the system can be enhanced, and the development efficiency and testing efficiency can be significantly improved.

[0048] See also Figure 2 According to a second aspect of the present invention, a microservice system decoupling device based on event-driven is provided, and the microservice system decoupling device comprises: An event bus service building module 10 is used to build an event bus service, the functions of which include registration of event types, configuration of event monitors, and collection and processing of events; The event type acquisition module 20 to be monitored is used to obtain the event type to be monitored according to the user's operation behavior in the first software subsystem; A to-be-monitored event type registration module 30, used to register the to-be-monitored event type in the event bus service; A monitor adding module 40, used for adding a monitor for the event type to be monitored in the event bus service; A plug-in setting module 50, used for setting an event collection plug-in of the event bus service in the second software subsystem; An event collection module 60, configured to collect events in the second software subsystem through the event collection plug-in, and write the collected events into an event queue of the event bus service; The event feedback processing module 70 is used to feed back the target event corresponding to the event type to be monitored to the first software subsystem for processing through the event bus service when the monitor detects that the event queue contains the event type to be monitored.

[0049] In an optional implementation of the second aspect of the present invention, the module for acquiring the event type to be monitored includes: A system function acquisition unit, configured to acquire, in the first software subsystem, a system function corresponding to an operation behavior according to an operation behavior of a user; A character string acquisition unit, configured to search and obtain a character string identifier corresponding to the system function based on the system function; The event type acquisition unit is used to acquire the event type to be monitored corresponding to the operation behavior in the event type classification library based on the character string identifier.

[0050] In an optional implementation of the second aspect of the present invention, the event type registration module to be monitored includes: An instance creation unit, used to create an event bus instance, using the event bus instance as a central point for event transmission; An identification allocation unit, used for allocating a unique identifier for the event type to be monitored; Obtaining a registration method for an event from the event bus instance; A method acquisition unit, configured to register the unique identifier in the event bus instance as a parameter of the registration method; An event publishing unit is used to publish the event type to be monitored in the event bus instance.

[0051] In an optional implementation of the second aspect of the present invention, the monitor adding module includes: A monitor creation unit, used to create a monitor class and define a monitoring method of an event in the monitor class; A monitoring configuration unit, configured to configure the monitoring method to specify monitoring of events corresponding to the event type to be monitored; The monitoring registration unit is used to register the monitor class in the event bus instance and allocate a unique ID and a subscription class to the monitor class.

[0052] In an optional implementation of the second aspect of the present invention, the event bus service building module includes: A business analysis unit, used to analyze the business scale of the first software subsystem and the second software subsystem; A technology matching unit, configured to match a target event bus technology from a preset event bus technology library based on the business scale of the first software subsystem and the second software subsystem; A service configuration unit, configured to configure the event model of the event bus service and implement the logic of event publishing and subscription based on the configuration specification in the target event bus technology; The deployment test unit is used to deploy the event bus service into the operating environment and ensure the normal operation of the event bus service through testing.

[0053] In an optional implementation of the second aspect of the present invention, the event collection module includes: A process creation unit, configured to create an event monitoring process in the background of the second software subsystem in response to the installation of the event collection plug-in; An event monitoring unit, configured to monitor, through the event monitoring process, a triggering event generated by a user operation in the second software subsystem; The event uploading unit is used to upload and write the triggering event into the event queue of the event bus service when the event monitoring process monitors the generation of the triggering event.

[0054] In an optional implementation of the second aspect of the present invention, the event feedback processing module includes: An event monitoring and judging unit, configured to obtain, through the monitor, an event type corresponding to the triggering event each time a triggering event is written into the event queue, and to judge whether the event type corresponding to the triggering event is the event type to be monitored; The event feedback unit is used for, if the event type corresponding to the trigger event is the event type to be monitored, the event bus service feeds back the target trigger event corresponding to the event type to be monitored to the first software subsystem for processing.

[0055] Figure 3 It is a structural schematic diagram of an event-driven microservice system decoupling device provided by an embodiment of the present invention. The event-driven microservice system decoupling device may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 80 (for example, one or more processors) and memory 90, one or more storage media 110 for storing application programs 100 or data (for example, one or more mass storage devices). Among them, the memory and the storage medium can be short-term storage or persistent storage. The program stored in the storage medium may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the event-driven microservice system decoupling device. Furthermore, the processor can be configured to communicate with the storage medium and execute a series of instruction operations in the storage medium on the event-driven microservice system decoupling device.

[0056] The event-driven microservice system decoupling device of the present invention may also include one or more power supplies 120, one or more wired or wireless network interfaces 130, one or more input and output interfaces 140, and / or one or more operating systems 150, such as Windows Serve, Mac OS X, Unix, Linux, Free BSD, etc. It can be understood by those skilled in the art that Figure 3 The illustrated structure of the decoupling device for a microservice system based on event-driven does not constitute a limitation on the decoupling device for a microservice system based on event-driven, and may include more or fewer components than illustrated, or a combination of certain components, or a different arrangement of components.

[0057] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the event-driven microservice system decoupling method.

[0058] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0059] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.

[0060] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.< / t>

Claims

1. A method for decoupling a microservice system based on event-driven, characterized in that: include: Building an event bus service, the functions of which include registration of event types, configuration of event monitors, and collection and processing of events; In the first software subsystem, the type of event to be monitored is obtained according to the operation behavior of the user; Registering the event type to be monitored in the event bus service; Adding a monitor for the event type to be monitored in the event bus service; Setting an event collection plug-in for the event bus service in the second software subsystem; Collecting trigger events in the second software subsystem through the event collection plug-in, and writing the collected trigger events into the event queue of the event bus service; When the monitor detects that the event queue contains the event type to be monitored, the target trigger event corresponding to the event type to be monitored is fed back to the first software subsystem for processing through the event bus service.

2. The event-driven microservice system decoupling method according to claim 1 is characterized in that: The obtaining of the event type to be monitored according to the user's operation behavior in the first software subsystem includes: In the first software subsystem, according to the operation behavior of the user, a system function corresponding to the operation behavior is obtained; Based on the system function, a character string identifier corresponding to the system function is obtained; Based on the character string identifier in the event type classification library, the event type to be monitored corresponding to the operation behavior is obtained.

3. The event-driven microservice system decoupling method according to claim 1, characterized in that: The registering the event type to be monitored to the event bus service includes: Creating an event bus instance, using the event bus instance as a central point for event delivery; Assigning a unique identifier to the event type to be monitored; Obtaining a registration method for an event from the event bus instance; Register the unique identifier in the event bus instance as a parameter of the registration method; The event type to be monitored is published in the event bus instance.

4. The event-driven microservice system decoupling method according to claim 3 is characterized in that: Adding a monitor for the event type to be monitored in the event bus service includes: Create a monitor class and define a monitoring method for the event in the monitor class; Configuring the monitoring method to specify monitoring of events corresponding to the event type to be monitored; The monitor class is registered in the event bus instance, and a unique ID and a subscription class are assigned to the monitor class.

5. The event-driven microservice system decoupling method according to claim 1, characterized in that: The event bus service construction includes: Analyze the business scale of the first software subsystem and the second software subsystem; Matching a target event bus technology from a preset event bus technology library based on the business scale of the first software subsystem and the second software subsystem; Based on the configuration specification in the target event bus technology, configure the event model of the event bus service and implement the logic of event publishing and subscription; Deploy the event bus service to the operating environment and ensure that the event bus service operates normally through testing.

6. The event-driven microservice system decoupling method according to claim 1, characterized in that: The collecting the trigger events in the second software subsystem by the event collection plug-in and writing the collected trigger events into the event queue of the event bus service includes: In response to the installation of the event collection plug-in, creating an event monitoring process in the background of the second software subsystem; Monitoring trigger events generated by user operations in the second software subsystem through the event monitoring process; When the event monitoring process detects the generation of the trigger event, the trigger event is uploaded and written into the event queue of the event bus service.

7. The event-driven microservice system decoupling method according to claim 6 is characterized in that: When the monitor detects that the event queue contains the event type to be monitored, feeding back the target trigger event corresponding to the event type to be monitored to the first software subsystem for processing through the event bus service includes: When each trigger event is written into the event queue, the event type corresponding to the trigger event is obtained through the monitor, and it is determined whether the event type corresponding to the trigger event is the event type to be monitored; If the event type corresponding to the trigger event is the event type to be monitored, the event bus service feeds back the target trigger event corresponding to the event type to be monitored to the first software subsystem for processing.

8. An event-driven microservice system decoupling device, characterized in that: The microservice system decoupling device comprises: An event bus service building module is used to build an event bus service, the functions of which include registration of event types, configuration of event monitors, and collection and processing of events; The module for obtaining the type of event to be monitored is used to obtain the type of event to be monitored according to the operation behavior of the user in the first software subsystem; A module for registering event types to be monitored, used for registering the event types to be monitored into the event bus service; A monitor adding module, used for adding a monitor for the event type to be monitored in the event bus service; A plug-in setting module, used for setting an event collection plug-in of the event bus service in the second software subsystem; An event collection module, used to collect events in the second software subsystem through the event collection plug-in, and write the collected events into the event queue of the event bus service; The event feedback processing module is used to feed back the target event corresponding to the event type to be monitored to the first software subsystem for processing through the event bus service when the monitor detects that the event queue contains the event type to be monitored.

9. An event-driven microservice system decoupling device, characterized in that: The event-driven microservice system decoupling device includes: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected through a line; The at least one processor calls the instruction in the memory so that the event-driven microservice system decoupling device executes the event-driven microservice system decoupling method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the event-driven microservice system decoupling method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Vehicle machine, information processing method thereof, electronic equipment and storage medium

    CN115589576A

  • Task execution method and related equipment

    CN118585297A

  • Identity synchronization across multiple domains

    US7702747B1

Cited By

  • Vehicle-mounted surveying and mapping system and method of double-decoupling architecture and vehicle-mounted computer

    CN121048592A