What is Event Driven (EDA)

15365803:

What is event driven

Event-Driven Architecture (Event-Driven Architecture, EDA) is an event-based software architecture pattern, which implements message passing between various components in the system in an asynchronous and loosely coupled manner, thereby supporting high scalability, high availability, High performance and flexibility.

In an event-driven architecture, all information is expressed and processed in the form of events. An event is an abstract, meaningful data set that can be received, decoded, and responded to by other services. Events can be generated by clients, servers, or third-party applications, and sent to any other service as needed to trigger subsequent actions. In EDA, components cooperate by publishing (Publish) and subscribing (Subscribe) events. Events can be user operations, system state changes, sensor data, etc.

Gartner lists event-driven architecture (EDA) as one of the top ten strategic technology trends, and emphasizes that event-driven architecture (EDA) is the main driver of development in the technology and software fields. EDA is at the heart of real-time agile digital business, capturing real-world business events in digital form in real time by "listening" to event sources such as Internet of Things (IoT) devices, mobile applications, ecosystems, and social and business networks.

In the past, the API-centric application design architecture significantly improved business agility, but as digital business scenarios become more and more complex, enterprises have increased demands for real-time intelligence, agile response, and contextual adaptation. Relying solely on an API-centric request-driven model is not enough. With the access of more and more digital systems, applications become more difficult to expand, and the connected API network is more difficult to manage. The data barriers between different systems are getting higher and higher, and the coupling degree of the systems is getting higher and higher. Relying on the asynchronous and loosely coupled characteristics of the event-driven architecture, it decouples various business systems, reduces the dependence between systems, and maximizes the digital agility of enterprises.

insert image description here

event-driven architecture

scene example

When your company needs to recruit a new employee, the basic process includes: posting job advertisements - interviews - hiring - personnel preparation - entry procedures - work arrangements. This is a basic recruiting process where each step is based on a specific event. For example, the recruitment process is carried out based on the trigger of the event that the company needs new employees; the interview is carried out based on the trigger of the event of receiving the applicant's application;

The above is a common event-driven use case. This use case is an enterprise standard recruitment process or system. Enterprise managers only need to build a complete set of recruitment process and draft standards, as well as the personnel required for each node. When managers need to recruit new employees, they only need to issue instructions, and the recruitment system will automatically operate according to the process until the recruitment results are returned. Taking the above scenario as an example, the event-driven architecture mainly includes four key components:

Event : Anything that happens in the system can be regarded as an event. In the employee onboarding process, such as posting a job advertisement, receiving a candidate application, sending out an offer, completing a training, etc. can all be considered events.

Event generator : An event generator is an object that triggers an event. In the employee onboarding process, for example, the person who publishes the job advertisement, the recruiter who receives the application from the candidate, the HR specialist who sends the offer letter, etc. can all be regarded as event sources.

Event handler : An event handler is the processing logic for a specific event. In the employee onboarding process, for example, the recruiter is responsible for the interview and hiring process, the HR specialist is responsible for personnel preparation and onboarding procedures, and the department manager is responsible for arranging jobs for new employees, etc. can be regarded as event handlers.

Event storage : Event storage is used to store events and save events for later auditing and backtracking. . In the employee onboarding process, the event queue could be a company's hiring management system or personnel management system.

In an event-driven architecture, an event source fires an event, which is placed in an event queue to be processed. The event handler obtains the event from the event queue and executes the corresponding logic, finally completing the processing of the event. In the above-mentioned employee onboarding process, when the company needs new employees, the recruiter publishes job advertisements and receives applications from applicants, these events will be put into the event queue, and the recruiter will get these events from the event queue and perform interviews and recruitment process.

insert image description here

event-driven value

Reduce dependencies between systems

In traditional systems, different components need to be coupled at the code level, such as through function calls or shared variables. This tight coupling will lead to high dependencies between components. When a component needs to be modified, it is often necessary to modify the code of other components at the same time, which will lead to system instability and difficulty in maintenance.

In contrast, in an event-driven architecture, components communicate through events rather than calling code directly or sharing variables. When a component completes some task, it fires an event, which is then sent to other components in the system. Other components can choose whether to listen to this event according to their own needs, and if they listen, they can respond to the event and perform corresponding operations. This mechanism enables components in the system to be developed and maintained relatively independently, reducing the coupling between codes.

This loosely coupled approach makes the system more maintainable and scalable. When a certain component needs to be modified, only the component needs to be modified, and the code of other components does not need to be modified at the same time. This not only simplifies the development process, but also makes the system more robust and flexible, as different components can be deployed and upgraded independently. At the same time, the loose coupling feature of this event-driven architecture also makes the system easier to expand and integrate, because new components can be easily added to the system without affecting the operation of other components.

Improve availability and reliability

Traditional systems usually adopt a tightly coupled approach, that is, the components are closely dependent, and the failure of one component can easily affect the normal operation of other components, resulting in system failure and unavailability. In an event-driven architecture, when a component fails, other components can choose whether to listen to the event, and the unaffected components can continue to perform their tasks without being affected. Therefore, this loose coupling can improve the availability and reliability of the system.

In addition, the event-driven architecture can also improve the availability and reliability of the system through asynchronous event processing. The characteristic of asynchronous event processing is that the processing of the event is non-blocking, that is, the component can continue to execute its own tasks without waiting for the processing result of the event. This processing method can reduce the delay of the system and can handle a large number of concurrent requests, thereby improving the performance and reliability of the system.

The event-driven architecture can also improve the reliability and fault tolerance of the system by implementing the event traceability mechanism. The event sourcing mechanism refers to recording the historical state of the event, and it can be traced back to the state of any event. This mechanism can help enterprises quickly restore the system and reduce data loss due to failure. By recording and replaying events, enterprises can more easily discover and solve system problems, thereby improving system reliability and fault tolerance.

agile development

Event-driven architecture can help developers develop and deploy applications faster. Since each component is independent, each component can be developed and tested in parallel, reducing application development time. On the deployment side, businesses can choose to deploy only the components they need rather than the entire application, which will further speed up deployment.

high scalability

Businesses can extend the functionality of the system by adding new events to the system, changing the structure of existing events, or adding new components. In this way, businesses can implement small incremental changes while still maintaining overall system stability and reliability.

In addition, event-driven architecture can also promote loose coupling between components by using appropriate event types. For example, an enterprise can define generic event types to handle communication and collaboration across multiple components. This loose coupling makes it easier for businesses to change parts of the system without affecting the entire system.

In terms of flexible architecture evolution, the event-driven architecture also supports multiple deployment options. Enterprises can choose to use event-driven architecture on-premises, in the cloud, or in a hybrid deployment to suit their business needs and available resources.

Real-time data processing and analysis

In an event-driven architecture, events are the core of the system, and components communicate and collaborate by triggering and processing events. Therefore, an event-driven architecture is well suited for handling real-time data and for easily transferring data from one component to another. Enterprises can build real-time data processing systems to make decisions and respond to business data faster. For example, businesses can use event-driven architecture to monitor website traffic, analyze user behavior, detect anomalies, and more. In this case, components can quickly respond to these real-time data by triggering and processing events, and perform necessary operations.

In addition, the event-driven architecture can also be used to build complex data stream processing systems, such as processing big data and realizing real-time analysis. These systems need to process large amounts of data and need to process the data quickly and accurately. An event-driven architecture can achieve these goals by using a distributed event processing system while maintaining the scalability and reliability of the system. These advantages can help companies better understand their business, optimize business processes, and improve corporate competitiveness.

Guess you like

Origin blog.csdn.net/qq798280904/article/details/130636419