Skip to content

feat: add async-daemon opt-in to AppFoundationOptions - #162

Merged
andregoepel merged 1 commit into
mainfrom
feature/async-daemon-hook
Jul 26, 2026
Merged

feat: add async-daemon opt-in to AppFoundationOptions#162
andregoepel merged 1 commit into
mainfrom
feature/async-daemon-hook

Conversation

@andregoepel

Copy link
Copy Markdown
Owner

Summary

AddAppFoundation()'s single AddMarten(...) call never called AddAsyncDaemon(...) and exposed no hook to add one — customer-portal ships its own MartenAsyncDaemonHostedService workaround as a result (tracked separately: customer-portal#90).

Changes

  • AppFoundationOptions.EnableAsyncDaemon (bool, default false — no behavior change for existing consumers) and AppFoundationOptions.AsyncDaemonMode (DaemonMode, default Solo).
  • Initialization.cs captures AddMarten(...)'s return value and conditionally calls .AddAsyncDaemon(options.AsyncDaemonMode) before .IntegrateWithWolverine().

Design note

AddMarten(...).AddAsyncDaemon(mode) is Marten's own registration point — confirmed via reflection that it registers ProjectionCoordinator as an IHostedService, so enabling the option is sufficient on its own; no extra hosted service needed on our side. Solo is the sensible default for a single running instance; HotCold is available for hosts running multiple instances that want leader election.

Verification

  • dotnet csharpier format . clean
  • dotnet build — 0 warnings, 0 errors
  • dotnet test — 89 tests passing (4 new), covering default-disabled / enable-defaults-to-Solo / explicit-mode-override / mode-without-enabling-has-no-effect
  • dotnet list package --vulnerable --include-transitive — clean

Closes #153

@andregoepel
andregoepel merged commit 237e932 into main Jul 26, 2026
4 checks passed
@andregoepel
andregoepel deleted the feature/async-daemon-hook branch July 26, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Async-daemon hook in AppFoundationOptions (plan C4)

1 participant