by BehindJava

What is a Orchestration Pattern in Microservices

Home » microservices » What is a Orchestration Pattern in Microservices

In this tutorial, we are going to learn about the Orchestration Pattern in detail.

Orchestration Pattern

  • There is a centralized microservice called orchestrator that delivers the messages to other microservices to roll-back the transaction due to any failure.
  • Orchestrator knows to execute the business workflow, and it is also aware that if any microservices in the system goes wrong, which microservice should handle the failed transaction.

In this example, order service will create an order and raises an event such as order created, then saga orchestrator or orchestrator will receive that event. orch

  • It sends a message to the inventory service and inventory service deducts 5 items and if something goes wrong, inventory services raises an event which is something like inventory update failed.
  • This time it is not the order service that receives this event, but the orchestrator microservice receives the event and orchestrator knows which microservices has to handle the failed transaction.
  • If order created is success, inventory service updates the inventory and payment service fails, it sends an event to the orchestrator that payment is failed and orchestrator notifies the other microservices to roll back the entire transaction due to failure.
  • In general, orchestrated microservices orchestrates and marshals all the communication between those microservices that are related to committing or rolling back a transaction.