Skip to main content

Welcome to Sagaweaw

Sagaweaw is a Java library for distributed transaction orchestration with automatic compensation, intelligent retry, and real-time observability.


The Problem We Solve

Think of a restaurant: when you place an order, it's not just a single database insert. It's a complex flow:

  1. Validate the order
  2. Reserve the ingredients
  3. Prepare in the kitchen
  4. Charge the customer
  5. Deliver

If the kitchen fails at step 3, what happens? The payment needs to be reversed, the ingredients need to go back to stock. Sagaweaw orchestrates this automatically.


Key Features

FeatureDescription
Centralized OrchestrationFull control over the flow with a central coordinator
Automatic CompensationReverse-order rollback when something fails
Intelligent RetryConfigurable policies: exponential, fixed, infinite
Observability APIQuery sagas, metrics, and dead letters via REST
Multi-DatabasePostgreSQL, MySQL, or H2 — no extra configuration
Fluent APIElegant, type-safe DSL
Automatic MDCsagaId, sagaName, stepName, attempt in all logs
Micrometer / PrometheusDuration metrics and counters published automatically
Built-in DashboardReal-time debug lens — timelines, dead letters, retry queue

30-Second Quickstart

1. Add the dependency

<dependency>
<groupId>dev.sagaweaw</groupId>
<artifactId>sagaweaw-spring-boot-starter</artifactId>
<version>1.0.14</version>
</dependency>

2. Create your first Saga

@Saga("pix-payment")
public class PixPaymentSaga implements SagaDefinition<PixContext> {

@Override
public SagaFlow<PixContext> define(SagaBuilder<PixContext> saga) {
return saga
.step("validate-dict")
.invoke(this::validateDict)
.compensate(this::invalidateDict)

.step("block-balance")
.invoke(this::blockBalance)
.compensate(this::unblockBalance)

.step("transmit-to-bacen") // PIVOT
.invoke(this::transmitToBacen)
.retry(exponential(3, Duration.ofSeconds(1)))

.build();
}
}

3. Fire it!

@Service
public class PaymentService {

@Autowired
private SagaManager sagaManager;

public void processPayment(PixRequest request) {
PixContext context = new PixContext(request);
sagaManager.start(PixPaymentSaga.class, context);
}
}

Status Indicators

Sagaweaw uses subtle visual indicators to communicate state:

StatusColorDescription
COMPLETEDGreen (#4CAF50)Step completed successfully
EXECUTINGYellow (#F5A623)Step in progress (pulsing)
COMPENSATEDYellow (#F5A623)Step compensated
FAILEDRed (#E53935)Step failed

Next Steps


Community


Apache 2.0 License — Open source and free for commercial use.

Used by teams building on Spring Boot

Sagaweaw is early-stage. If your team uses it in production, open an issue or start a discussion — we'd love to feature you here.