Fixed consistency of WorkflowConsumer when persisting workflow
Describe the change
Fixed consistency of WorkflowConsumer when persisting workflow.
Persisting workflow instance and subscriptions within single database transaction.
It is needed because if application crashes or stops between PersistWorkflow and CreateEventSubsctiption workflow stops forever.
Describe your implementation or design
Declared method in IWorkflowRepository and implemented for all persistence providers to persist workflow and subscription within single database transaction.
Tests Yes
Breaking change No
Additional context Any additional information you'd like to provide?
@danielgerlag could you please review this PR? The workflow will never run if the application crashes or stops between PersistWorkflow and CreateEventSubsctiption.
See https://github.com/danielgerlag/workflow-core/pull/1078/files#diff-716d3b6475bbc125167970522ffbf9b96c77437efed7c8a421441f02b5ebc335L58 and https://github.com/danielgerlag/workflow-core/pull/1078/files#diff-716d3b6475bbc125167970522ffbf9b96c77437efed7c8a421441f02b5ebc335L106.
If we used the TransactionScope API, we wouldn't have to change the persistence provider interface.
@danielgerlag But TransactionScope doesn't work for DynamoDB, CosmosDB...
Looks like some integration tests are failing
@danielgerlag I believe the tests must be fixed by a different PR, please take a look https://github.com/danielgerlag/workflow-core/pull/1039
@danielgerlag I changed the name of method. Failed integration test is not related to changes in this PR. It was fixed in https://github.com/danielgerlag/workflow-core/pull/1039
hmmm... looks like the appveyor pipeline is still passing even though tests are failing... will need to check that