Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The saga pattern coordinates a business operation across services by committing a sequence of local transactions instead of asking every service to join one global transaction. If a later step cannot complete, the system runs business-specific compensating actions for steps that already committed. That avoids relying on two-phase commit (2PC), but it does not provide automatic rollback or hide intermediate states: each service’s work is committed separately, and the application must manage retries, failures, and recovery.

What is the saga pattern?

A saga is a sequence of transactions performed by separate services to complete one business operation. Each service commits its own local transaction—for example, writing to its own database—and then helps move the workflow forward. A later failure can lead the system to run compensating transactions for earlier work.

Chris Richardson, creator of Microservices.io and author of Microservices Patterns, summarizes the approach as: “Implement each business transaction that spans multiple services as a saga.” Richardson’s saga pattern guide describes the pattern and its trade-offs.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The defining difference from one atomic database transaction is that a saga does not commit or roll back all participants as a single indivisible unit. Some local changes may already be visible while the rest of the workflow is pending. A compensation is a new business operation intended to address an earlier committed action; it is not a database’s automatic undo of that action. Whether it can restore the original business situation depends on what the action did.

Popular on Amazon
Silkland 40Gbps USB C 90 Degree Right Angle Adapter 2 Pack, 240W USB4 | Male to Female Extender, 8K@60Hz, Thunderbolt 4/3, Steam Deck, ROG Ally, MacBook, Switch 2, iPhone 18/17/16/15, Quest 3 VR
  • 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
  • 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
  • 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
  • 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
  • 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.

How does a saga handle a failed transaction?

It records which local steps succeeded and then chooses either to retry or to compensate for completed work. The right response depends on whether the failure is permanent or temporary, and on the domain’s recovery rules.

Example: placing an order

Consider an illustrative order workflow with an order service, an inventory service, and a payment service. It might proceed as follows:

  1. The order service creates an order in a pending state.
  2. The inventory service reserves the items and commits that reservation.
  3. The payment service attempts to authorize or collect payment.
  4. If the required steps succeed, the order service approves the order.

If payment is rejected because the payment details are invalid, the workflow can ask inventory to release its reservation and ask the order service to cancel the pending order. These are compensating business operations. Their exact effects depend on the services’ rules: releasing a reservation is not the same as undoing a completed shipment, and issuing a refund is not identical to never having charged a customer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Retry or compensate?

Not every error means the workflow should be unwound immediately. If a service is temporarily unavailable or a request times out, the operation may have succeeded even though the caller did not receive its response. A retry can be appropriate, provided the operation is safe to repeat or the service can recognize duplicate requests. If the failure is permanent—for example, a payment is declined—the workflow may instead compensate for earlier committed steps.

Also popular on Amazon
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

That choice must be explicit. Define which errors can be retried, how long to retry, and what should happen when the retry limit is reached. A timeout is not proof that the remote service did nothing; checking the step’s recorded outcome can prevent an unnecessary duplicate action or compensation.

How is a saga different from two-phase commit?

Two-phase commit asks participating systems to prepare to commit and then directs them to commit or roll back. A saga instead commits one service’s local work at a time, coordinating later steps and, if needed, compensations. The trade-off is a global commit protocol versus application-managed recovery and visible intermediate states.

With 2PC, a coordinator first asks participants to prepare and report whether they can commit; it then tells them to commit or roll back. This can be a poor fit when databases or message brokers are independently owned, do not support the protocol, or should not be coupled through a shared transaction. That does not make 2PC mathematically impossible or universally inferior. Its suitability depends on the participating technologies and operational requirements. AWS Prescriptive Guidance on saga orchestration discusses the saga approach in distributed systems.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A saga avoids requiring one global commit across the services, but it accepts that each completed local transaction may be observable before the overall business operation is finished. That is often manageable for a pending order, but may be unacceptable where the requirement is immediate cross-service isolation. A saga also requires a meaningful recovery action for each step that might need to be undone; some external effects do not have an exact inverse.

Also popular on Amazon
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

What is the difference between choreography and orchestration?

Choreography lets participating services react to events, while orchestration puts a coordinator in charge of directing the workflow. Both coordinate local transactions; they differ in where the next-step decisions live.

Approach How it works Strengths Costs and risks Often a better fit when
Choreography A service commits local work and publishes an event; another service handles that event and may publish the next one. No central coordinator is required to direct every transition. Participants can react to events independently. As event dependencies grow, it can become harder to see the whole workflow, identify who owns a decision, and manage each participant’s timeouts and retries. The workflow has relatively few participants and its event-driven transitions remain easy to understand.
Orchestration A coordinator sends commands, receives outcomes, and chooses the next step or compensation. The workflow’s decisions and progress can be visible in one place, making branching and recovery easier to manage centrally. The coordinator must be durable and available, and introduces its own implementation and operational complexity. The workflow has complex branching, recovery rules, or a need for an explicit owner of the end-to-end process.

These are tendencies, not hard participant-count thresholds. Compare the approaches using the number of participants, branching, ownership of decision logic, recovery needs, observability, and operational dependence on a coordinator. For more detail, see AWS Prescriptive Guidance on saga choreography. AWS Step Functions is one documented orchestration option, not a requirement for using sagas.

How do you prevent a committed change from losing its event?

When a service both changes its database and publishes a message, doing those as independent operations creates a dual-write risk. A transactional outbox addresses that risk by recording the outgoing message in the same local database transaction as the business change, then relaying the message separately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Without an outbox or another deliberate solution, a service could commit its business change and fail before publishing the event, leaving the next service unaware. The reverse order is also risky: it could publish an event and then fail to commit the change that event describes. The outbox makes the business record and the intent to publish part of one local commit. A relay later reads and publishes the stored message. Richardson’s transactional outbox pattern explains this approach; event sourcing is another documented option.

Also popular on Amazon
BENFEI USB C Hub 5-in-1 with 4K HDMI(Certified), 100W Power Delivery, 3 USB-A, Silicone Cable, Aluminum Case Compatible with MacBook Pro/Air, iPad Pro, iMac, iPhone 15 Pro/Pro Max, XPS, Thinkpad
  • Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
  • Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
  • 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
  • 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
  • Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.

An outbox does not mean a message is delivered exactly once. A relay may publish a message, crash before recording that it did so, and publish it again after restarting. Consumers therefore need retry-safe handling, such as recording processed message identifiers where appropriate. The pattern protects the consistency of the local change and the outgoing-message record; it does not remove the need to handle duplicates.

What reliability safeguards should a saga have?

A reliable saga needs durable progress, safe message handling, explicit recovery rules, and enough observability to tell which step is stuck. The following safeguards are implementation guidance for meeting the documented risks; they are not guarantees provided automatically by the pattern.

Track progress and correlation

  • Give each workflow a stable identifier, such as an order or saga ID, and carry it through commands, events, logs, and status responses.
  • Record the outcome of each step so recovery can distinguish completed work from work that is pending or whose result is unknown.
  • Define any required per-entity event ordering. Independent events may arrive late, out of order, or more than once unless the system accounts for those possibilities.

Make retries safe

  • Give each message a stable identifier so a consumer can detect a repeat where necessary.
  • Design each participant’s operation to be idempotent where possible: processing the same request again should not create an unintended second effect.
  • Make retry limits, timeouts, and the action after exhausted retries explicit. A retry policy should account for the possibility that a timed-out request actually succeeded.

Design compensation and isolation deliberately

  • For every step that can commit before a later failure, specify the intended compensating action and who owns it.
  • Define how a failed compensation is surfaced, retried, and escalated; a workflow is not recovered merely because it attempted compensation.
  • Decide whether intermediate states can safely be observed. Concurrent workflows may encounter stale state or interfere with each other, so domain-appropriate controls such as semantic locking may be needed.

There is no universal compensating action for external side effects. A reservation may be released; an already shipped item or a completed financial transfer may require a different business response. Model the actual domain operation rather than assuming that every action has a perfect inverse.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What should a caller see while the saga is running?

The API should distinguish acceptance of the workflow from its final business outcome. A caller might wait for completion, receive a workflow identifier and poll for status, or receive a later notification. The initial response should not imply that all services have completed their work unless the workflow has actually reached that state.

Also popular on Amazon
𝟒𝐏𝐚𝐜𝐤 𝐔𝐩𝐠𝐫𝐚𝐝𝐞𝐝 USB to USB C Adapter,Type-C Female to A Male Charger Converter for iPhone 18 Charger,iWatch Ultra SE 9 10,iPhone 17 Pro Max 16 15 14,Samsung S25,AirPods,iPad,Car,Xbox
  • 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
  • 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
  • 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
  • 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
  • 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.

For the order example, a useful contract could define PENDING as an accepted order whose required steps are not yet complete, a success state as an approved order after those steps succeed, and a failure state as an order that could not complete and has been handled according to the defined recovery policy. If compensation itself is still in progress, the system should represent that condition rather than reporting a clean failure prematurely. Document what each status means, when it can change, and how a caller can learn about the final result.

When should you use a saga?

Use a saga when one business workflow genuinely spans separately owned stores or services, and the domain can tolerate intermediate states with explicit recovery actions. Reconsider it when the requirement is immediate cross-service isolation or when no meaningful compensation exists. Those constraints follow from how local commits and compensations work; they are not a universal rule that every multi-service workflow needs a saga.

Before choosing, answer these questions:

  • Can the business tolerate a period in which one service has committed while another has not?
  • For every committed step, is there a defined recovery action—or a clear policy for handling effects that cannot be reversed?
  • Can the services safely handle duplicate messages, timeouts, and retries?
  • Does the workflow remain understandable with event-led choreography, or would a durable coordinator provide useful control and visibility?
  • Can operators discover a stuck workflow and determine which action or compensation needs attention?

Microsoft’s guidance also describes sagas as programmatically coordinated local transactions followed, when needed, by compensating work. For deeper reading, Richardson’s Microservices Patterns covers saga-related distributed-data patterns. Richardson announced a second edition in an early-access program in 2025; that announcement describes its status at the time, not its current print format or retailer availability. The saga pattern page links to the book and related material.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Is a saga the same thing as eventual consistency?

No. A saga is a way to coordinate a multi-service business operation through local transactions and recovery actions. Eventual consistency describes a consistency outcome in which separate views may converge over time; a saga may produce that kind of intermediate state, but the terms are not interchangeable.

What happens if a compensating transaction fails?

The workflow needs a durable record of that failure and an operational path to retry or escalate it. Depending on the business action, recovery may require an operator or a separate customer-facing resolution rather than an automatic inverse operation.

Can a saga be used with an HTTP API?

Yes. An API can accept a request and return a workflow identifier while work continues, or wait for completion when that fits the operation. The API contract should make clear whether its response means the workflow was accepted or fully completed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply. Prices as of December 6, 2026 10:01 am GMT.