Saga Registry
Registry for managing multiple named, reusable saga templates.
A Saga instance is safe to Saga.execute more than once (its per-run tracking state is reset at the start of every execution), so storing one by name and re-running it is the main use case for this registry -- e.g. an "order-checkout" saga built once at startup and executed per order.
Example usage:
val registry = SagaRegistry.create()
val checkout = registry.getOrCreate<OrderResult>("order-checkout") {
step("Reserve inventory", action = { inventoryService.reserve(items) })
step("Charge payment", action = { paymentService.charge(amount) })
}
val result = checkout.execute()Content copied to clipboard
Types
Link copied to clipboard
object Companion
Factory for SagaRegistry.