# \#saga

**URL:** https://community.temporal.io/tag/saga/24.md

[Latest](https://community.temporal.io/latest.md) · [Categories](https://community.temporal.io/categories.md) · [Tags](https://community.temporal.io/tags.md)

---

## [Why do we add compensation action before action we want to compensate?](https://community.temporal.io/t/why-do-we-add-compensation-action-before-action-we-want-to-compensate/19226)

<div class="topic-metadata">

**Author:** [@shaykemelov](https://community.temporal.io/u/shaykemelov)\
**Replies:** 5\
**Last updated:** [February 16, 2026, 10:15pm UTC](https://community.temporal.io/t/why-do-we-add-compensation-action-before-action-we-want-to-compensate/19226 "2026-02-16T22:15:35Z")

</div>

try { saga.addCompensation(activities::revertInventory, order); String inventoryResult = activities.updateInventory(order); logger.info(inventoryResult); saga.addCompensation(activities::refundCustomer, creditCa…

---

## [Blog post: Compensating Actions, Part of a Complete Breakfast with Sagas](https://community.temporal.io/t/blog-post-compensating-actions-part-of-a-complete-breakfast-with-sagas/8114)

<div class="topic-metadata">

**Author:** [@fortuna](https://community.temporal.io/u/fortuna)\
**Replies:** 2\
**Last updated:** [June 14, 2023, 4:48pm UTC](https://community.temporal.io/t/blog-post-compensating-actions-part-of-a-complete-breakfast-with-sagas/8114 "2023-06-14T16:48:27Z")

</div>

I wrote an article explaining the Compensating Actions Design Pattern, which is an important part of the Saga design pattern (and how to implement it in Temporal), why/when you’d want to use it, and how to implement it i…

---

## [Exception on compensation](https://community.temporal.io/t/exception-on-compensation/2403)

<div class="topic-metadata">

**Author:** [@niegus](https://community.temporal.io/u/niegus)\
**Replies:** 1\
**Last updated:** [June 16, 2021, 3:14pm UTC](https://community.temporal.io/t/exception-on-compensation/2403 "2021-06-16T15:14:18Z")

</div>

In my project, we are starting to add some error handling to our workflows and we came up using the Saga mechanism and adding compensations whenever it was needed. private var sagaOpts = new Saga.Options.Builder().setPa…

---

## [Is there a way to perform saga.compensate upon workflow terminate?](https://community.temporal.io/t/is-there-a-way-to-perform-saga-compensate-upon-workflow-terminate/124)

<div class="topic-metadata">

**Author:** [@madhu](https://community.temporal.io/u/madhu)\
**Replies:** 1\
**Last updated:** [July 9, 2020, 3:48pm UTC](https://community.temporal.io/t/is-there-a-way-to-perform-saga-compensate-upon-workflow-terminate/124 "2020-07-09T15:48:22Z")

</div>

Hi i use saga for my in my workflow a lot. when a workflow is running too long, there are cases where we want to terminate it, in case of terminate, i want the compensate all previous saga to be called. can this be ach…
