Saga execution coordinator. (SEC)

Due to the reason of Stacksaga is one of Saga orchestration framework, a central orchestration engine is required to handle the workflow based on the programatical navigation. Other than that Saga Execution Coordinator perform the following duties.

  1. Navigate the transaction work flow.

  2. Retrying the transactions

  3. Scheduling the executions

  4. Managing dual consistency problem

  5. State management

  6. Event publishing

  7. Aggregator states serialization and Deserialization

Let’s see the fundamental involvement of SEC in the framework with an example. Let’s get the same example that E-Commerce application. Then you know we have to create an aggregator for storing necessary data. And also we have to create the executors for each atomic transaction. Creating aggregator and executors is not enough to start the execution. To run the execution, we have to notify SEC with the starting executor and the starting aggregator. Then the SEC will execute each executor one by one based on the navigation that each executor does. As an example, if we provide the starting executor as order-init executor, it’s started from that executor, and when it’s executed, that particular executor will navigate to the next executor based on the logic. (Providing the execution flow is fully dynamic in Stacksaga. It shouldn’t be a pre-defined one)

StackSaga Saga Execution Coordinator (SEC)

Here you can see how the SEC does work for managing work flow and publishing events in high-level.

  1. You can access the orchestration engine and start the process by providing the initial aggregator data and initial executor.

  2. Then coordinator coordinates and manages the work flow based on the navigation that you command in the executors. Each executor will be invoked by SEC, and then your methods will be called for communicating with target services.

  3. If there’s a primary execution error, Handle the failure recovery by executing Compensating Requests.

If you want to see how SEC works for each transaction mode in detail, please refer StackSaga Transaction Types. It will give you a better understanding of StackSaga framework as well.