CoAkka Runtime · C#/.NET 3.3.2
CoAkka Runtime · C#/.NET cheat sheet
Look up the NuGet coordinate, API shape, outcomes, and lifecycle; open the full lesson when you need the failure law.
Version and package
Project
<PackageReference Include="CoAkka.Runtime" Version="3.3.2" />- Connector
3.3.2: Core generation 3.3, connector revision 2.- Framework
net8.0for this learning path.- Native RID assets
- macOS ARM64, Linux ARM64/x64, Windows ARM64/x64. A support claim still needs exact package + OS + CPU evidence.
- Owner
RuntimeHost; useawait usingorDisposeAsyncat the app lifecycle boundary.
Embedded request/reply
C#
await using var runtime = RuntimeHost.StartLocal(
systemName: "orders",
target: "orders.quote",
nodeId: "orders-1");
runtime.RegisterTextHandler("orders.quote", quantity => Quote(quantity));
var reply = await runtime.AskTextAsync(
source: "checkout",
target: "orders.quote",
payload: "2",
timeoutMs: 2_000);Outcomes and Deadletter
- Reply
AskTextAsyncandAskAsyncreturn a correlated terminal response.- Deadletter
DeadletterException.Deadlettercarries the reason, original envelope, generation, and delivery failure facts.- Timeout/cancel
- A separate failure boundary; it does not prove that the handler never ran.
- OneWay
SendOneWay*waits for no business response but still has admission and observability evidence.- Classification
- Use typed exceptions, enums, and stable numeric codes; do not parse message text.
Direct peers
Service
Network = RuntimeNetworkConfig.NetworkNode(
bindHost: "0.0.0.0",
bindPort: 19_321,
advertiseHost: "pricing.internal",
advertisePort: 19_321)Caller
Network = RuntimeNetworkConfig.OutboundOnly(),
Routes = [new RuntimeRouteSpec(
Target: "orders.quote",
Endpoints: [new RuntimeEndpointSpec("pricing.internal", 19_321, 1)],
Strategy: RuntimeRouteStrategy.SingleOwner)]File Lane and Stream Lane
- File: hash → receiver grant → sender submit → both terminals OK → forget → dispose.
- Stream: publisher grant → subscriber window → bounded callbacks → both terminals OK → forget → dispose.
- A grant names an exact owner; it is not load-balanced through a Service address.
Span<byte>/ReadOnlySpan<byte>are borrowed only during the callback; copy before retaining.- Lane owners are independent from
RuntimeHost; never dispose one from its own callback.
Monitor and effective state
EnableMonitor = true- Startup intent.
StartupConfig()- Core-accepted Monitor and default facts.
Health()/Stats()- Observed runtime state and counters.
RuntimeConfig()- Generation, routes, state, and transport bind facts.
- API boundary
- C# 3.3.2 does not project a Monitor wait API; do not copy methods from another connector.
Integration checklist
- Pin the exact NuGet version and inspect the actual RID asset.
- Own one
RuntimeHostfor the app lifecycle, not one per request. - Use named arguments for constructors and calls with many parameters.
- Wait for operations and callbacks before shutdown.
- Read capability and effective state before advanced transport or tuning.
- File/Stream Lane has an independent lifecycle; root delegates until confirmed retirement.
- Run blocking lane waits away from the UI thread.