A recent prediction from the DevOps community regarding microservice adoption in 2023 indicates that more organizations would adopt microservices architecture over the legacy monolithic architecture. This shift challenges organizations in managing the interactions between individual microservices, especially when they are substantial. This is where an orchestration approach comes in. In this blog post, we will explore the benefits of event-driven architecture with orchestration patterns and how it differs from choreography.
Microservices allow you to divide your entire fleet of applications into minor services that are independently deployed. An event-driven architecture is an approach where individual decoupled services are integrated to implement business logic. An event-driven architecture leverages various events to trigger and communicate between the services. An event is basically a change/update in the state, such as placing or shipping an order.
An event driven architecture has three main components: event producer, router, and consumer. The event producer is the one who creates events for an activity. For example, a customer places an order through a website/application. The event router filters and pushes the event to the appropriate consumers.
To better understand the concept, let’s consider a hypothetical e-commerce application.
The process of placing an order in an e-commerce application consists of several activities.
Each service is considered an individual microservices that work together to complete the application. These services may need to communicate with one another for the smooth functioning of the application.
In a microservice environment, the interaction between these services can be handled in 2 different ways. The first approach is orchestration, where a central coordination element determines what each service should do and in what order they should execute. The second approach is choreography, a decentralized approach where each service is responsible for consuming events, performing actions, and publishing events individually. Unlike in orchestration, the choreography is not centered around the logic of a centralized coordination element.
Consider the case of e-commerce applications based on the choreography approach.
The user surfs through the application and adds an item to the cart. This publishes an event to the message broker, which is consumed by the individual microservices. After consuming the event, the microservice performs the required activity & passes the event for the next service to consume. The process continues until the business goal is achieved.
You can see that there is no centralized coordination between the services. Any service can consume the event, perform the corresponding action and pass the event for the next service to consume. In this pattern, the order of execution is embedded inside the services themselves. This approach often leads to a complex architecture with O(N^2) in the connection complexity across services.
Now, suppose the same application is implemented via the orchestration. In that case, all the services are linked to a centralized orchestrator that orchestrates these services in a pre-defined order, thus completing the application.
Orkes Conductor, built over battle-tested Netflix Conductor, is an orchestration platform that can build distributed applications in your preferred languages. Before delving into the benefits of event-driven orchestration, let’s look into the drawbacks of choreography.
Orchestration addresses the drawbacks of choreography by adding a centralized orchestrator that is responsible for communicating across services. In this model, services do not talk to each other and communicate the work only to the orchestrator, who is responsible for coordinating flows across services.
Orkes Conductor is an enterprise version of the popular Netflix Conductor, built by the creators of Netflix Conductor, that offers unparalleled scale and the ability to build complex stateful distributed applications. Orkes Conductor is a fully distributed platform removing any single point of failure from the architecture, allowing developers to easily build distributed stateful applications that can survive failures and scale to extreme volumes.
If you are on the hunt for a platform to modernize your event driven architecture, it’s high time to check out Orkes Conductor. Adopting this powerful tool in your business can undoubtedly provide a competitive edge and drive success in today’s ever-evolving technology landscape.