feat(dapr): add IValueProvider support for component metadata configuration#810
Merged
FullStackChef merged 22 commits intoCommunityToolkit:mainfrom Sep 6, 2025
Conversation
Implements IResourceWithWaitSupport for IDaprSidecarResource to enable proper service startup sequencing. This allows Dapr sidecars to wait for dependent services (like Redis for pubsub) to be ready before starting, preventing component loading failures during application startup. Fixes CommunityToolkit#604 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added new WithMetadata overload that accepts EndpointReference parameter - Extracts URL from EndpointReference for metadata configuration - Added comprehensive tests for the new functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…tern - Removed placeholder values from DaprDistributedApplicationLifecycleHook - Replaced with cleaner hasValueProviders flag for tracking value providers - Consolidated tests from EndpointReferenceTests into ResourceBuilderExtensionsTests - Deleted redundant EndpointReferenceTests.cs file - All tests pass with cleaner separation of concerns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3 tasks
FullStackChef
approved these changes
Aug 26, 2025
davidfowl
reviewed
Aug 26, 2025
| /// Represents a Dapr sidecar resource. | ||
| /// </summary> | ||
| public interface IDaprSidecarResource : IResource | ||
| public interface IDaprSidecarResource : IResource, IResourceWithWaitSupport |
Contributor
There was a problem hiding this comment.
Did you implement the waiting? To make this work, the resource needs a lifecycle, see https://github.com/dotnet/aspire/blob/main/docs/specs/appmodel.md#built-in-resources--lifecycle.
When you implement IResourceWithWaitSupport, at some point you have to raise https://github.com/dotnet/aspire/blob/364382724b4cd3590ec75010525ce36ef0b5e769/src/Aspire.Hosting/ConnectionStringBuilderExtensions.cs#L92
Contributor
Author
There was a problem hiding this comment.
Implemented it, don't know if it's the correct approach but I followed the examples. Also implemented on the IDaprComponentResource as it seems it was missing support
…ation - Add comprehensive XML documentation for WithMetadata method explaining runtime value resolution - Implement DaprSidecarAvailableEvent for sidecar lifecycle tracking - Add automatic dependency detection and wait logic for value provider resources - Ensure sidecars wait for dependent resources before starting - Add proper state management for sidecar resources (NotStarted -> Starting -> Running) - Improve error handling with FailedToStart state on initialization errors This improves reliability when using dynamic endpoint references and ensures proper initialization order. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ifecycle - Add SetupComponentLifecycle method to configure WaitAnnotations for Dapr components - Extract resource dependencies from value provider annotations - Ensure components wait for their dependencies before becoming ready - Follow the same pattern as SetupSidecarLifecycle for consistency This ensures proper dependency ordering when Dapr components reference other resources through value providers, preventing initialization failures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…e parent resource
This was referenced Sep 29, 2025
This was referenced Oct 7, 2025
This was referenced Dec 8, 2025
This was referenced Jan 5, 2026
Closed
Closed
This was referenced Jan 19, 2026
This was referenced Feb 8, 2026
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
IValueProvider(includingEndpointReference) in Dapr component metadata configurationChanges
WithMetadataoverload acceptingIValueProviderfor flexible metadata configurationDaprComponentValueProviderAnnotationto track value providers requiring resolutionDaprComponentSchemawith async value resolution capabilitiesTest Plan
Example Usage
This allows Dapr components to dynamically reference Aspire resource endpoints that are only known at runtime.
Closes #604