StackSaga execution coordinator. (SEC)

Overview

Due to the reason of Stacksaga is one of Saga orchestration frameworks, a central orchestration engine is required to handle the workflow based on the programmatic navigation like invoking primary-executions, the compensation-executions and as well as retrying the transaction in case of network failures. The engine that manages all that responsibilities is called as StackSaga execution coordinator in Stacksaga.

SEC performs the following duties.

Duties of SEC

  1. Execute the primary and compensation executions of the LRT.

  2. Navigate the transaction work flow based on the programmatic navigation.

  3. Identifying the errors of the atomic executions.

  4. Retrying the transactions

  5. Scheduling the executions

  6. Managing dual consistency problem

  7. State management

  8. Event publishing

  9. Aggregator states serialization and Deserialization

To fulfill the above duties, SEC interacts with your code via the Aggregators and the Executors that provide in your system.

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 StackSaga 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.