arrow-kt / arrow-kt/arrow

["Request"] Resilience Saga allow

Open
#3,432 1 comment 0 reactions 0 assignees View on GitHub
resilience
Dominant language
Kotlin
Stars
6.6k
Forks
472
Avg merge
3d 49m
Merged PRs (30d)
4

Description

What version are you currently using?

2.0.0-alpha.1

What would you like to see?

Similarly to nested transaction, I want to be able to automatically created nested Sagas. This can easily be done by injecting the `SagaContext` into the `CoroutineContext`, **if** nested sagas are configured, and any nested Saga could automatically be nested into the parent. This machinery should be internal to Resilience, so all new code to add this functionality should be private, and **not inlined**.

```kotlin
private class SagaContext(private val scope: SagaScope): CoroutineContext
private fun sagaContext(): SagaContext? = TODO()

fun sagaScope(
allowNested: Boolean = false,
block: SagaScope.() -> A
): Saga
{
...
}
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the Resilience Saga implementation and the existing nested-transaction behavior, then inspect the SagaScope, sagaScope, and proposed SagaContext entry points. Done means nested Sagas are automatically attached to a parent only when nesting is enabled, with the added machinery private and not inlined.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.