Skip to content

Conversation

@Aaronontheweb
Copy link
Member

Summary

Implements connectivity health checks for Redis persistence plugin to enable proactive monitoring of database connectivity status.

  • Adds RedisJournalConnectivityCheck and RedisSnapshotStoreConnectivityCheck classes implementing IAkkaHealthCheck
  • Uses Redis PING command for liveness checks via StackExchange.Redis
  • Includes comprehensive unit tests with 6 test cases covering healthy/unhealthy scenarios and parameter validation
  • All tests passing

Test Plan

  • Unit tests for journal connectivity check (healthy/unhealthy when disconnected, parameter validation)
  • Unit tests for snapshot store connectivity check (healthy/unhealthy when disconnected, parameter validation)
  • All 6 tests passing

References

Implements Akka.Hosting Epic: akkadotnet/Akka.Hosting#678

Implement IAkkaHealthCheck-based connectivity checks for Redis journal and snapshot stores.
These are liveness checks that proactively verify backend database connectivity using PING commands.

Changes:
- RedisJournalConnectivityCheck: Verifies journal connectivity
- RedisSnapshotStoreConnectivityCheck: Verifies snapshot store connectivity
- RedisConnectivityCheckSpec: Unit tests with 6 test cases covering healthy/unhealthy scenarios and parameter validation
- All 6 tests passing

Implements Akka.Hosting Epic #678.
- Upgraded Akka.Hosting from 1.5.53 to 1.5.55-beta1
- Upgraded Akka.NET from 1.5.53 to 1.5.55
- Added RedisConnectivityCheckExtensions with WithConnectivityCheck methods
- Uses the new WithCustomHealthCheck() API from Akka.Hosting 1.5.55-beta1
- All 6 connectivity health check tests pass successfully
- Modified RedisConnectivityCheckSpec to use RedisFixture with Docker containers
- Added happy path tests that verify health checks return Healthy when Redis is available:
  - Journal_Connectivity_Check_Should_Return_Healthy_When_Connected
  - Snapshot_Connectivity_Check_Should_Return_Healthy_When_Connected
- Kept existing unhealthy path tests to verify failure detection
- Added [Collection("RedisSpec")] attribute to share Redis Docker containers across tests
- Tests now properly validate both success and failure scenarios

All 8 tests pass locally, ensuring the liveness checks work correctly on the happy path.
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.

Need to make some changes

{
try
{
var connection = await ConnectionMultiplexer.ConnectAsync(_connectionString);
Copy link
Member Author

Choose a reason for hiding this comment

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

Do we need to dispose this?

{
try
{
var connection = await ConnectionMultiplexer.ConnectAsync(_connectionString);
Copy link
Member Author

Choose a reason for hiding this comment

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

Same - do we need to dispose this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tags need to be customizable for all health checks

- Fixed ConnectionMultiplexer disposal using 'using' statements in both Journal and Snapshot connectivity checks
- Added customizable tags parameter to WithConnectivityCheck extension methods
- Tags default to standard values but can now be customized by users

Addresses all three review comments:
1. Proper disposal of Redis connections
2. Customizable tags for health checks
Copy link
Member Author

Choose a reason for hiding this comment

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

Why was the README file packaging removed from this file?

@Aaronontheweb Aaronontheweb merged commit 9a631b9 into akkadotnet:dev Oct 26, 2025
1 check passed
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.

1 participant