Better long-running transitions
psh opened this issue · comments
Dig deeper into using https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/suspend-coroutine.html and https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/-continuation/ for long running transitions.
The "fail()" and "failAndExit()" semantics arent great. We should define "Success" and "Failure" for the transition continuation type (sealed class?) and allow the transition block to call continuation.resume(...)
- assuming that's replacing
- success()
- failAndExit()
And then treat continuation.resumeWithException(...)
as the version that doesnt call the exit handler? This would give a stable entry / exit behaviour as the general case, and could look at passing the "Success" / "Failure" transition result into the exit block for reference.