Actors
The Dapr.Actors package enables you to interact with Dapr virtual actors from a .NET application. Actors are virtual, addressed by type and id, with support for state management, reminders, timers, and both strongly-typed and weakly-typed proxy clients. The actor pattern is suited to scenarios where you need single-threaded, instance-based concurrency for stateful objects.
Status of Dapr.Actors
Active development on Dapr.Actors has stopped; this package now receives security fixes only, and all new actor development happens in Dapr.Actors.Next. There is no deprecation date for Dapr.Actors but it’s considered to be in a maintenance-only mode.
Dapr.Actors.Next is expected to be released as a stable package alongside the v1.19 Dapr runtime and SDK release.
Core concepts
- How to: Run and use virtual actors in the .NET SDK: a complete tutorial building a three-project solution — actor interfaces, an actor service with state, reminders, and timers, and a proxy client.
- Author & run actors: authoring actors with
ActorHost, dependency injection, disposal, logging, and custom type names; hosting actors in ASP.NET Core withAddActors, JSON options, endpoint routing viaMapActorsHandlers, and middleware pitfalls. - Actor serialization: the two serialization models — the weakly-typed client (System.Text.Json, JSON output) and the strongly-typed client (Data Contract Serializer, XML output) — and the rules for configuring types in each.
- The IActorProxyFactory interface: creating actor clients with the strongly-typed (
CreateActorProxy<>) and weakly-typed (Create) proxy styles, and reading exception details from method invocations.