September 20, 2021
What Is Event-Driven Architecture?
Event-Driven Architecture (EDA) Explained
Ideal for real-time product creation and highly-resilient—thanks to loose coupling of services and wide distribution of processes—Event-Driven Architecture (EDA) is becoming more and more popular among today’s software developers.
But what is EDA? It’s not a new language. It is, however, a new programming approach. Perhaps a few everyday examples of what it is and is not will best serve to illustrate.
Event-Driven Architecture Example
You’re in the lobby of a building but need to be on the 20th floor. You press the button that calls the elevator, which then travels down to meet you, opens its doors, welcomes you in, and takes you to the floor of your choice—where it opens up and lets you out.
Pressing the button produced the event. The event listener, the elevator operational system, processed the request by sending it to the event consumer, the elevator car itself—which then processed the trip from the ground floor to the 20th. Nothing at all happened until the event of pushing the button happened.
Note that the button never knew anything about what the elevator did or whether it was successful or not. Nor did it care!
Traditional Request Driven Architecture Example
You’re driving with your young family to a far-off destination. Not long into the trip, one of your children asks, “Are we there yet?” You answer…“No.”
A few minutes later, that same child asks again, “Are we there yet?” And again you answer, “No.”
The next time the child asks, you simply don’t answer. In fact, you don’t answer the next several dozen times the child asks.
Finally, you reach your destination and turn around waiting for the question to be repeated one last time. The child quietly mumbles, “Are we there yet?” And this time, you answer, “Yes!”
As opposed to the event of pushing the button triggering the action, your child was polling you periodically to see if the desired result was available yet. You continued processing until your destination was reached, at which point your response to the poll was positive.
Characteristics of an Event-Driven Architecture
The first advantage of an Event-Driven Architecture (EDA) becomes immediately clear. The polling, in this previous case, was annoying. In IT systems, the polling is simply expensive and burdensome—consuming bandwidth and cycles—and usually with no result. In fact, EDA service provider Zapier estimates that 98.5% of polling processes are valueless.
One of the most popular modes of EDA is pub/sub in which a service is published to make it available. Event producers subscribe to this service and trigger events as needed. Response to order happens in real-time, providing a significant competitive advantage.
Other EDA advantages:
- The event producer, event notification, event router, event listeners, event consumers, and event processors are all loosely coupled and widely distributed; the failure of one does not cause others to fail.
- The event router acts as an elastic buffer, storing events during workload surges or failure-driven delays. Each request is then processed as soon as its listener and consumers are back online, demonstrating the fault-tolerance of this programming approach.
- Because the event router is centralized, it stores information on every event. So it is fairly easy to trace back and identify where a process may have gone wrong. This facilitates auditing, policy definition and enforcement, and coordination between event producer and consumer services.
- No custom code is ever required to poll, filter, or route requests. Development is accelerated thanks to the event router.
EDA also enables tremendous horizontal scaling. A single event may trigger many responses, resulting in a wide variety of results while the creation of real-time products is significantly enhanced. In addition, most processes are asynchronous, allowing for potential latencies elsewhere.
When Should You Use Event-Driven Architectures?
EDA has found applications in a wide variety of use cases—including real-time analytics, fraud detection, sentiment analysis, business process monitoring, real-time personalization of user experience, healthcare monitoring, Medicaid Management Information System operations, IoT applications, trading floors, online shipping, and more.
Placing an order on an eCommerce web product is an event that triggers many activities occurring in parallel. Products are picked. Shipping containers are prepared. Bills of lading and other documentation are printed. The order confirmation is sent. Then, products are shipped, receipt is confirmed, and invoicing occurs—followed by receipt of payment. After the event of an order placement, the rest may easily be completely automated.
Where Are Event-Driven Architectures (EDA) Used?
The past few years have seen several EDA services introduced primarily to the consumer audience. One example is the IFTTT.com service, an acronym that stands for <If THIS, Then THAT>. Users authenticate a wide variety of internet-based services, and the <THIS> becomes an event on one service that triggers the <THAT> to occur on the target service.
On voice command, simple applications—including operating lights, door locks, and more—can shut down all household lights and appliances when a specific time of night is reached. Newer services alert emergency services when sounds like glass breaking, fire alarms going off, and other potential emergencies occur.
Moving more toward the business market is Zapier, which functions similarly but offers a wider variety of available business-oriented triggers and responders.
Event-Driven Architecture and Microservices
Event-Driven Architecture (EDA) aligns well with the increasingly popular use of microservice architectures. Events never travel, they just occur. Everything else needs to be portable. The more each service can stand alone, the more resilient and fault-tolerant the system is. The economies of this programming approach create the likelihood of greater adoption in the field.
Event-Driven Architecture is just one of the methods our product development teams use to drive your success. Contact 3Pillar Global today to learn how we can do it for you.