dapr / dotnet-sdk

Dapr SDK for .NET
Apache License 2.0
1.11k stars 335 forks source link

During workflow/actor registration, validate metadata endpoint reflects actor-compatible state store #1369

Open WhitWaldo opened 3 days ago

WhitWaldo commented 3 days ago

Describe the feature

A recurring concern was raised in Discord and then in https://github.com/dapr/dapr/issues/8208 indicating that it was unclear why the app would fail to start up during workflow initialization and this was later traced to there not being an actorStateStore registered to use.

While this makes for a prime documentation target to clarify, the SDK could do more on this front as well.

The specific details need more consideration, but I'm initially thinking that because of the hot reload capability for components, this should be implemented as a sort of health check (read: recurring) registered whenever the developer registers the Dapr actor runtime or the Dapr workflow client. As @olitomlinson mentioned, rather than necessarily expand on the Health API here, this could simply retrieve the configuration from the Metadata endpoint and indicate whether an actor-compatible state store is registered, then fail in the application with a clear exception.

Release Note

RELEASE NOTE: ADD Validate whether actor state store is correctly registered during SDK initialization preempting endless connection failures

olitomlinson commented 3 days ago

I think using the metadata endpoint for an initial check is fine, as this is going to cover most common use-cases.

I also think that if a mismatch is detected, then the SDK should throw an Exception, rather than just log an error/warning.

The solution can eventually be upgraded to support post-initialisation changes i.e. with hot-reload support, but I see this as a should, not a must at this point.