What's the relationship between the two?
Both are for atomic operations. Both results need to be either success, or failure with rollback to original state.
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityWhat's the relationship between the two?
Both are for atomic operations. Both results need to be either success, or failure with rollback to original state.
Both the saga and unit of work patterns intend to ensure consistency of related operations, but at different levels:
The saga pattern aims at ensuring consistency across independent services and without using a two phase commit.
The unit of work pattern aims at ensuring consistency (usually within a system) by making sure that the object states and the database states remain aligned according to a transactional logic (i.e database commit or two phase commit).