-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize DaprClient from workflow registration #1411
Open
WhitWaldo
wants to merge
4
commits into
dapr:master
Choose a base branch
from
WhitWaldo:customize-dapr-from-workflow-registration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fbabbc3
Added means to customize the Dapr client from the Dapr Workflow regis…
WhitWaldo c6eafe6
Updated to favor the overload that provides an IServiceProvider
WhitWaldo ebedc41
Merge branch 'master' into customize-dapr-from-workflow-registration
WhitWaldo 4f5457d
Merge branch 'master' into customize-dapr-from-workflow-registration
WhitWaldo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is probably ok, I wonder if, in this specific situation, the developer couldn't just call
AddDaprClient()
themselves before callingAddDaprWorkflow()
(as the registration can only happen once)? This would save every derivative registration (e.g. workflow, AI, pub/sub, etc.) from having to add the complexity of additional lambdas in their APIs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to be able to have users install the various packages potentially independently of one another. If I want to connect to my local Dapr runtime for pubsub, but connect to a remote Dapr runtime for state management, that wouldn't be trivially done by having the developer call
AddDaprClient()
as it would supersede the per-client options.Perhaps in the shorter term then, instead of what I've got here, I need to refactor it all to output a
DaprConnectionOptions
or the like and within each of the clients, stand up an unregistered instance ofDaprClient
using those options.Then, if you want the
DaprClient
(as you would for most of today's Dapr functionality), you useAddDaprClient()
and if you want any of the other clients, you useAddWhateverClient()
, but the underlyingDaprClient
s themselves are discrete from one another.In the short term, it ensures you don't have lifecycle conflicts across the board. In the really long term, it means we can eventually drop
AddDaprClient()
altogether once all the existing functionality is migrated into the purpose-built clients.What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking a little more about this - today, because all the clients use static builders, it's insufficient to rely on the previously created DaprClient instances to get the configuration as the builders are recreating the connections from scratch.
So while the configuration bits may be available in the
IConfiguration
, that's not necessarily going to cover all configuration scenarios (e.g. setting their own timeout, specifying their own gRPC options or their own JSON serialization settings), it'd at least handle setting endpoints (HTTP and gRPC) and the API token.