AUTOMATIC RECOVERY AND STATE IDENTIFICATION DURING THE APPLICATION OF THE SAGA PATTERN FOR TRANSACTIONAL EXECUTION OF OPERATIONS IN A MICROSERVICES ENVIRONMENT

Authors

DOI:

https://doi.org/10.31891/2307-5732-2025-357-60

Keywords:

microservice architecture, transaction, Saga, database, compensation, recovery, state control, automation, restoration

Abstract

When using a microservice architecture, the Saga pattern serves as an important method for ensuring data consistency without the need for centralized or distributed transactions in the classical sense. Its essence lies in decomposing a complex business process into a list of sequential local — for each microservice — transactions, each of which is executed autonomously within the context of its own service. 
Unlike transactions within a monolithic architecture, where a single integral process is executed and completed with a commit within the database; in a Saga, each local operation is launched after the completion of the previous one. In case of its failure in the form of any execution errors, it is accompanied by the launch of compensating actions. This allows for gradual consistency to be achieved in the asynchronous environment inherent to inter-service communication. 
With microservice architecture's growing popularity, transaction coordination complexity is also increasing, especially under dynamic component updates and flexible scalability. The Saga pattern enables the achievement of gradual consistency; however, its effectiveness depends on the extent to which the semantic role of each business process step is considered. Saga is thus viewed not only as a technical pattern but as an integral part of domain-driven design logic, where each transaction represents an event with defined consequences for the entire system. 
However, this very asynchrony creates fundamental difficulties in controlling the execution state of the entire Saga as an integral process. At a certain point in time, the system has no explicit understanding of which stage the transaction is at and which actions have been successfully completed. This effect is attributed to the distributed nature — that is, each service operates with its own local data, independent code, and isolated lifecycle. As a consequence, in this case, centralized tracking of the process status becomes non-obvious and ambiguous, provided that no additional special logic has been embedded to anticipate problematic scenarios. 
As a result of the research, methods for automating the management of the Saga and reducing the need for manual intervention during execution failures have been identified and proposed. 

Published

2025-09-24

How to Cite

SUPRUN, P., & PRAVORSKA, N. (2025). AUTOMATIC RECOVERY AND STATE IDENTIFICATION DURING THE APPLICATION OF THE SAGA PATTERN FOR TRANSACTIONAL EXECUTION OF OPERATIONS IN A MICROSERVICES ENVIRONMENT. Herald of Khmelnytskyi National University. Technical Sciences, 357(5.2), 12-18. https://doi.org/10.31891/2307-5732-2025-357-60