The Rise of Event-Driven Architecture
Application programming interfaces (APIs) are driving digital transformation and dominating IT environments in almost every enterprise. Fueling this surge in popularity are the growing demands of end-users who now expect digital experiences to be interactive, responsive, and immediate. Organizations are turning to APIs to create engaging and efficient experiences and optimize all business areas, from operations to customer service. In fact, one of Gartner’s technology trends for 2021 is the total experience, which it defines as combining multi-experience, customer experience, and employee experience to transform business outcomes.
But how are developers building solutions that meet these complex demands? They’re designing APIs using event-driven architecture (EDA) in tandem with service-oriented architectures. With EDA, clients can subscribe to and receive events asynchronously, and in real-time if both are online, relieving the client of having to ask for updates or status changes. By shifting the burden of architectural complexity from client to producer, enterprises can create the fluid experiences modern users now expect.
What Is Event-Driven Architecture?
EDA uses events to trigger communication between decoupled applications, microservices and connected devices, and enable information to flow in real-time. To really understand what it’s all about, it’s useful to look back at the history of distributed software systems architecture and how it’s evolved over the last few decades.
The first software programs of the 1940s used a subroutine, to execute a task based on a set of instructions. Famously, programmers on the ENIAC team developed subroutines to calculate missile trajectories during World War II.
In the current era of total experience technology, event-driven design can help businesses meet the demanding expectations of modern end-users, and gain a competitive edge.
Computing architecture design then evolved to center around an orchestrator system that could remotely execute multiple subroutines. From this structure emerged the request-response paradigm: an orchestrator node sends a subroutine with a request to a different computer, which then processes the request and returns a response to the original orchestrator.
After Tim Berners-Lee invented the World Wide Web in 1989, HTTP became the preferred method of deploying distributed systems, with URLs exposing and accessing subroutines, which naturally led to APIs. As business priorities focused more on the real-time experience, APIs became the key driving force behind enterprise innovation today.
APIs Driven User Experiences
APIs create experiences by modeling real-world operations. Let’s take an example of an online clothing retailer. A developer might define an API to perform each action of the ordering process. For instance, APIs could accept orders, manage inventory, run reports, and update delivery status — all in real-time. The system would need a web or app-based interface to mimic a human operator making requests for actions or information. So instead of making a phone call, users interact with the interface to trigger the APIs to place an order or check delivery status.
Staying with the retailer example, you could extend the service further to develop a SaaS application that models the entire order management process. For instance, you might define a set of REST APIs to create orders and track the workflow from initial order to delivery. APIs could also manage operations and logistics in fulfilling the order and handle business transactions.
This system generates virtual objects that model the real-world objects involved in processing an order, including the order itself, payment transaction, and delivery note. With REST APIs modeling transactional objects, API design becomes more logical and nuanced, since you can query the objects directly using their specific endpoints instead of overloading a common, single endpoint with all queries. For example, you can query the status of an order by querying the order endpoint, and the API returns the current state of the order.
REST APIs also rely on the request-response pattern via HTTP, requiring the client to submit requests for state changes or updates as often as required. This system works well when everything goes smoothly. However, should something go wrong, such as a payment failure or a delivery delay, the system breaks down and impacts customer service. Such incidents then become business-critical “events”. From a customer service perspective, it’s better to let the customer know as soon as possible of any problems rather than leave them to figure it out by themselves. That’s why modern, people-centric SaaS applications must provide higher-quality and more real-time interactions than those based on the traditional REST approach.
Event-Driven API Future
In the REST framework, an API isn’t aware of the state of objects. The client queries the API to find out the state, and the role of the API is to respond to the client with the information.
However, with an event-driven API, a client can subscribe to the API, effectively instructing it to monitor the state of objects and report back with real-time updates. Therefore, behavior shifts from stateless handling of repeatable, independent requests to stateful awareness of the virtual objects modeled on real-world operations.
Event-driven APIs are a great way to meet the demands of modern end-users who expect customized and instantaneous access to information. Applying these APIs is easy to do in one-off, bespoke environments. However, things get more complicated when you need to offer this level of service at scale, and not every enterprise is ready to handle that level of complexity. To avoid amassing significant technical debt, organizations and developers should offload this complexity to a third party with the capabilities to synchronize digital experiences in real-time and at scale.
With the right real-time infrastructure supporting them, organizations can apply event-driven APIs in a range of use cases. They work well next to traditional architectures and provide the functionality required to meet the demands of modern digital interactions, such as:
- Better real-time experiences: Event-driven APIs absorb many of the responsibilities previously assigned to end-users, creating more interactive experiences.
- Lower change management overhead: APIs decouple consumers (applications using the API) and producers (servers) in that consumers only need to know the data format of events and not which server is sending the data. Likewise, producers have no interest in the identity of the consumer, resulting in lower overheads.
- Scalability: API producers don’t need to manage competing consumers — in fact, the number of subscribers is irrelevant to a producer. All that matters is that the broker passes on information to subscribers, whoever and however numerous they might be.
- Extensibility and resiliency: Loosely coupled components are easy to extend in place and come with low regression risks. Developers can also add functionality without impacting other consumers. Similarly, it’s easy to bake fault tolerance into the design as you can compartmentalize component failure.
- Consistency in concurrency: Event-driven APIs make it easier to achieve concurrency within distributed systems through immutability of events and message ordering and exactly-once delivery.
- Optimized use of network resources: Traditional service-oriented approaches tend to rely on push-based methods that tend to be a drain on the server, such as continuous polling. By nature, event-driven APIs make more efficient use of network and computational resources.
- Tech maturity: Event-driven approaches have been around for nearly 50 years, but it has taken modern online service delivery systems a long time to catch up. We’re living in exciting times when both technologies can combine to meet today’s consumer demands.
EDA as a Competitive Advantage
Since its conception in the 1970s, EDA has been waiting patiently for its moment. With the emergence of event-driven APIs, EDA is taking center stage to solve modern business problems and deliver real-time user experiences. While EDA might not be the answer for every business challenge, but when applied to the right use cases it can transform a company’s operations and customer service. It’s becoming increasingly clear that for an enterprise to stay competitive in the modern marketplace, it needs to know where and how to use EDA.