SquidStd.Actors
0.40.0
See the version list below for details.
dotnet add package SquidStd.Actors --version 0.40.0
NuGet\Install-Package SquidStd.Actors -Version 0.40.0
<PackageReference Include="SquidStd.Actors" Version="0.40.0" />
<PackageVersion Include="SquidStd.Actors" Version="0.40.0" />
<PackageReference Include="SquidStd.Actors" />
paket add SquidStd.Actors --version 0.40.0
#r "nuget: SquidStd.Actors, 0.40.0"
#:package SquidStd.Actors@0.40.0
#addin nuget:?package=SquidStd.Actors&version=0.40.0
#tool nuget:?package=SquidStd.Actors&version=0.40.0
<h1 align="center">SquidStd.Actors</h1>
Ordered, single-threaded, lock-free per-entity message processing for SquidStd, built on TPL Dataflow
ActionBlock<T>. Each actor owns a mailbox processed by one consumer, so handler state is mutated
without locks. Complements the EventBus (stateless broadcast) and CommandDispatcher (stateless fan-out)
with ordered, stateful, per-instance processing.
Install
dotnet add package SquidStd.Actors
Usage
using SquidStd.Actors;
public interface ISessionMessage { }
public sealed record LineReceived(string Raw) : ISessionMessage;
public sealed record SendText(string Text) : ISessionMessage;
public sealed record GetNick : ActorRequest<string?>, ISessionMessage; // request/response
public sealed class SessionActor : Actor<ISessionMessage>
{
private readonly INetworkConnection _conn;
private string? _nick;
public SessionActor(INetworkConnection conn) { _conn = conn; }
protected override async ValueTask ReceiveAsync(ISessionMessage message, CancellationToken ct)
{
switch (message)
{
case LineReceived(var raw): if (raw.StartsWith("NICK ")) _nick = raw[5..]; break;
case SendText(var text): await _conn.WriteAsync(text, ct); break;
case GetNick q: q.Reply(_nick); break;
}
}
}
await using var session = new SessionActor(conn);
await session.TellAsync(new LineReceived("NICK alice")); // fire-and-forget
string? nick = await session.AskAsync<GetNick, string?>(new GetNick()); // request/response
Use the event bus as an ordered source:
using SquidStd.Actors.Extensions;
using var sub = session.SubscribeToEventBus(eventBus, (UserJoinedEvent e) => new SendText($":{e.Nick} JOIN"));
Key types
| Type | Purpose |
|---|---|
Actor<TMessage> |
Mailbox base class (TellAsync / AskAsync). |
ActorRequest<TReply> |
Base record for request/response messages. |
IActorRequest<TReply> |
Request contract (implement directly if not using the base). |
ActorOptions |
Capacity / overflow / error configuration. |
Options
ActorOptions controls the mailbox:
| Property | Values | Default |
|---|---|---|
Capacity |
bounded mailbox size | 1024 |
OverflowPolicy |
Wait / DropNewest / Unbounded |
Wait |
ErrorPolicy |
Isolate / StopOnError |
Isolate |
ShutdownDrainTimeout |
any TimeSpan |
5s |
- Wait:
TellAsyncawaits until capacity frees (back-pressure). - DropNewest:
TellAsyncreturnsfalsewhen full. - Isolate: a throwing handler is logged and skipped; the actor stays alive.
AskAsyncexceptions always propagate to the caller regardless of policy.
DisposeAsync completes the mailbox and drains queued messages - every Tell runs and every Ask
replies - within ShutdownDrainTimeout. If a handler is still running when that budget elapses, the
actor cancels its handlers and faults any requests that never completed with ObjectDisposedException.
Related
- Tutorial: Actors
- Concept: Messaging models
License
MIT - part of SquidStd.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Serilog (>= 4.4.0)
- SquidStd.Core (>= 0.40.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.41.2 | 113 | 9/1/2026 |
| 0.41.1 | 111 | 8/5/2026 |
| 0.41.0 | 118 | 7/24/2026 |
| 0.40.1 | 114 | 7/23/2026 |
| 0.40.0 | 103 | 7/21/2026 |
| 0.39.0 | 114 | 7/20/2026 |
| 0.38.0 | 112 | 7/20/2026 |
| 0.37.0 | 124 | 7/17/2026 |
| 0.36.0 | 118 | 7/15/2026 |
| 0.35.0 | 112 | 7/15/2026 |
| 0.34.0 | 119 | 7/14/2026 |
| 0.33.1 | 119 | 7/13/2026 |
| 0.33.0 | 114 | 7/13/2026 |
| 0.32.1 | 118 | 7/13/2026 |
| 0.32.0 | 117 | 7/13/2026 |
| 0.31.0 | 112 | 7/12/2026 |
| 0.30.0 | 109 | 7/12/2026 |
| 0.29.0 | 117 | 7/11/2026 |
| 0.28.0 | 120 | 7/8/2026 |
| 0.27.0 | 119 | 7/7/2026 |