arrow icon indicating copy to clipboard operation
arrow copied to clipboard

["Request"] Resilience Saga allow

Open nomisRev opened this issue 1 year ago • 1 comments

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.

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

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

nomisRev avatar May 18 '24 12:05 nomisRev

What's the expected behaviour of a nested saga? Right now I think you can actually nest sagaScope blocks just fine. Is there a behaviour not covered by that?

kyay10 avatar Nov 06 '24 23:11 kyay10