Workflow: Make resilient to either/or loading + workflow reconnections #1680
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In the current version of
Dapr.Workflowit's imperative that daprd load first and then the app load so that it's available when the app attempts to connect. All e2e tests are written to expect this.This isn't always feasible though as it's perfectly possible that the application could load first and needs to be able to gracefully attempt to reconnect to daprd should it ever fail to connect properly. This PR accommodates this scenario, ensuring that the gRPC client in
Dapr.Workflowwill indefinitely attempt to connect (every 5 seconds) in case of a failure to connect. This should also handle a disconnection scenario that wasn't triggered by the cancellation token indicating that cancellation has been requested (e.g. the application gracefully closing).Further, because this is a scenario that might be desirable to validate in an e2e testing scenario (e.g. not just for the purpose of validating here), this PR also extends the
DaprTestApplicationBuilderinDapr.Testcontainersto support theWithDaprStartupOrdermethod. By default, this has atruevalue meaning that daprd and the other resources on the test harness will be started up first and then the test application loaded. But by calling and passingfalseto this method, it'll result in the opposite order happening: start the test application and then load daprd and the other resources on the test harness.Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #1678 #1293
cc: @olitomlinson
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: