map Saga
Traverses the Iterable and composes all Saga returned by the applies transform function.
data class Order(val id: UUID, val amount: Long)
suspend fun updateOrder(inc: Long): Order = Order(UUID.randomUUID(), 100L + inc)
suspend fun reverseOrder(uuid: UUID, inc: Long): Unit = println("Decrementing order with $uuid with $inc")
listOf(1, 2, 3).traverseSage { amount ->
saga { updateOrder(amount) }.compensate { order -> reverseOrder(order.uuid, amount) }
}.transact()
Content copied to clipboard
Sources
common source
Link copied to clipboard