- Notifications
You must be signed in to change notification settings - Fork 19
Transactional Creation of Flows #116
Description
Currently, when a flow is created by the primary function invocation, the stages are executed eagerly as the flow is constructed. If adding a stage subsequently fails, the user's flow will be partially executed and partially constructed. Stages that executed prior to the construction failure could have side effects, and any subsequent error-handling will be skipped, preventing the user from managing rollbacks.
For example, a function invocation could attempt to construct the following flow
Flows.currentFlow().invokeFunction(otherFunction).thenApply(operation).exceptionally(rollback); successfully creating an invoke stage and executing otherFunction with side-effects. It could then fail to create the next stage associated with operation. This failure will bubble up and the function call will fail, also preventing the exceptionally stage from being constructed and running the rollback logic.
As a developer of Fn Flow applications with side-effects, I would like to be able to execute the above types of flows safely in a transactional manner, such that any operations associated with my flow are only executed once the flow has been safely constructed and my error-handling is in place.