aaronontheweb avatar

Akka Hosting Actor Patterns

This is a solid architectural pattern for building Akka.NET entity actors that work identically in unit tests and production. The key insight is using GenericChildPerEntityParent to mimic cluster sharding semantics locally, so you write your actor once and swap execution modes via configuration. The message extractor pattern keeps routing logic consistent whether you're running locally or in a real cluster. The Akka.Hosting extension methods are clean and the ITimeProvider abstraction solves the DateTime.Now testing problem elegantly. If you're building domain entities with Akka and tired of maintaining separate test and production actor setups, this pattern saves real work.

skills.sh installs
434
GitHub stars
1.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add aaronontheweb/dotnet-skills --skill akka-hosting-actor-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

Akka.Hosting Actor Patterns

When to Use This Skill

Use this skill when:

  • Building entity actors that represent domain objects (users, orders, invoices, etc.)
  • Need actors that work in both unit tests (no clustering) and production (cluster sharding)
  • Setting up scheduled tasks with akka-reminders
  • Registering actors with Akka.Hosting extension methods
  • Creating reusable actor configuration patterns

Core Principles

  1. Execution Mode Abstraction - Same actor code runs locally (tests) or clustered (production)
  2. GenericChildPerEntityParent for Local - Mimics sharding semantics without cluster overhead
  3. Message Extractors for Routing - Reuse Akka.Cluster.Sharding's IMessageExtractor interface
  4. Akka.Hosting Extension Methods - Fluent configuration that composes well
  5. ITimeProvider for Testability - Use ActorSystem.Scheduler instead of DateTime.Now

Execution Modes

Define an enum to control actor behavior:

Sponsors

Details

Repository
github.com/aaronontheweb/dotnet-skills
Categories
Testing & QA, .NET & C#
First seen
Jun 3, 2026

More from aaronontheweb/dotnet-skills

All 34
1guia-matthieu avatarheadline-formulasguia-matthieu/clawfu-skills25+ proven headline formulas that stop the scroll, capture attention, and drive clicks. Templates and examples for every situation. Use when: Writing headlines 431skills.sh installs
2syncfusion avatarsyncfusion-blazor-commonsyncfusion/blazor-ui-components-skillsSet up Syncfusion Blazor components — project creation, NuGet packages, service registration, script loading, bUnit testing, and localization & globalization co424skills.sh installs
3yelban avatarcamofox-browseryelban/camofox-browser-skillsAnti-detection browser automation using Camoufox (Firefox fork with C++ fingerprint spoofing). Use when standard browser tools get blocked by Cloudflare, Akamai416skills.sh installs
4mims-harvard avatarcreate-tooluniverse-skillmims-harvard/tooluniverseCreate high-quality ToolUniverse skills following test-driven, implementation-agnostic methodology.412skills.sh installs
5jthack avatarffuf-web-fuzzingjthack/ffuf_claude_skillExpert guidance for ffuf web fuzzing during penetration testing, including authenticated fuzzing with raw requests, auto-calibration, and result analysis409skills.sh installs
6pedronauck avatarsystematic-debuggingpedronauck/skillsUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes388skills.sh installs