workflow-core icon indicating copy to clipboard operation
workflow-core copied to clipboard

Fixed consistency of WorkflowConsumer when persisting workflow

Open viktorshevchenko210 opened this issue 3 years ago • 3 comments

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?

viktorshevchenko210 avatar Aug 06 '22 16:08 viktorshevchenko210

@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.

SergiiKram avatar Aug 08 '22 08:08 SergiiKram

If we used the TransactionScope API, we wouldn't have to change the persistence provider interface.

danielgerlag avatar Aug 09 '22 15:08 danielgerlag

@danielgerlag But TransactionScope doesn't work for DynamoDB, CosmosDB...

viktorshevchenko210 avatar Aug 09 '22 15:08 viktorshevchenko210

Looks like some integration tests are failing

danielgerlag avatar Aug 13 '22 16:08 danielgerlag

@danielgerlag I believe the tests must be fixed by a different PR, please take a look https://github.com/danielgerlag/workflow-core/pull/1039

SergiiKram avatar Aug 14 '22 09:08 SergiiKram

@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

viktorshevchenko210 avatar Aug 14 '22 12:08 viktorshevchenko210

hmmm... looks like the appveyor pipeline is still passing even though tests are failing... will need to check that

danielgerlag avatar Aug 14 '22 18:08 danielgerlag