Skip to content

Conversation

@Aaronontheweb
Copy link
Member

Fixes #666

Summary

Journal health checks were not being registered when using .WithHealthCheck() without adding event adapters. This was caused by an early return in AkkaPersistenceJournalBuilder.Build() that exited before health check registration occurred.

Changes

  • Moved health check registration before the early return in AkkaPersistenceHostingExtensions.cs:113-133 to ensure health checks are registered regardless of event adapter configuration
  • Added regression test JournalHealthCheckWithoutAdaptersSpec that verifies health checks work without event adapters

Testing

All 16 persistence hosting tests pass, including the new regression test that specifically tests the bug scenario.

Fixes akkadotnet#666

Journal health checks were not being registered when using
.WithHealthCheck() without adding event adapters. This was caused by
an early return in AkkaPersistenceJournalBuilder.Build() that exited
before health check registration occurred.

Changes:
- Move health check registration before the early return to ensure
  health checks are registered regardless of event adapter configuration
- Add regression test that verifies health checks work without adapters

All 16 persistence hosting tests pass.
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detailed my changes

Builder.WithHealthCheck(HealthCheckRegistration);

// useless configuration - don't bother.
if (Adapters.Count == 0 || Bindings.Count == 0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the source of the bug.

/// Regression test for https://github.com/akkadotnet/Akka.Hosting/issues/666
/// Ensures journal health checks are registered even without event adapters
/// </summary>
public sealed class JournalHealthCheckWithoutAdaptersSpec : Akka.Hosting.TestKit.TestKit
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression test for #666

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) October 2, 2025 13:36
@Aaronontheweb Aaronontheweb merged commit c0fb543 into akkadotnet:dev Oct 2, 2025
2 checks passed
This was referenced Oct 23, 2025
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.

Journal health checks not registered when no event adapters are configured

1 participant