dapr / python-sdk

Dapr SDK for Python
Apache License 2.0
221 stars 125 forks source link

Support for user supplied actor_factory callable #713

Closed ksachdeva closed 2 months ago

ksachdeva commented 3 months ago

Describe the feature

ActorRuntimeContext has the support to take the user-supplied callable that would instantiate the Actor object. However, the classes (e.g. ActorRuntime and various register_actor functions in the extensions (flask and fastapi)) do not expose the possibility of providing the callable from the user code.

Release Note

RELEASE NOTE: ADD Support for user-supplied actor_factory callable.

berndverst commented 3 months ago

Can you go into more detail as to why we would want this? And can you see whether any of the other SDKs support this?

ksachdeva commented 3 months ago

This would enable dependency injection in the Actors.

See an example of it in the .net SDK https://github.com/dapr/dotnet-sdk/blob/master/examples/Actor/DemoActor/DemoActor.cs