Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/Akka.Persistence.Sql.Hosting/HostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,12 +590,14 @@ public static class SqlConnectivityCheckExtensions
/// <param name="journalOptions">The journal options containing connection details</param>
/// <param name="unHealthyStatus">The status to return when check fails. Defaults to Unhealthy.</param>
/// <param name="name">Optional name for the health check. Defaults to "Akka.Persistence.Sql.Journal.{id}.Connectivity"</param>
/// <param name="tags">Optional tags for the health check. Defaults to ["akka", "persistence", "sql", "journal", "connectivity"]</param>
/// <returns>The journal builder for chaining</returns>
public static AkkaPersistenceJournalBuilder WithConnectivityCheck(
this AkkaPersistenceJournalBuilder builder,
SqlJournalOptions journalOptions,
HealthStatus unHealthyStatus = HealthStatus.Unhealthy,
string? name = null)
string? name = null,
string[]? tags = null)
{
if (journalOptions is null)
throw new ArgumentNullException(nameof(journalOptions));
Expand All @@ -610,7 +612,7 @@ public static AkkaPersistenceJournalBuilder WithConnectivityCheck(
name ?? $"Akka.Persistence.Sql.Journal.{journalOptions.Identifier}.Connectivity",
new SqlJournalConnectivityCheck(journalOptions.ConnectionString!, journalOptions.ProviderName!, journalOptions.Identifier),
unHealthyStatus,
new[] { "akka", "persistence", "sql", "journal", "connectivity" });
tags ?? new[] { "akka", "persistence", "sql", "journal", "connectivity" });

// Use the new WithCustomHealthCheck method from Akka.Hosting 1.5.55-beta1
return builder.WithCustomHealthCheck(registration);
Expand All @@ -624,12 +626,14 @@ public static AkkaPersistenceJournalBuilder WithConnectivityCheck(
/// <param name="snapshotOptions">The snapshot options containing connection details</param>
/// <param name="unHealthyStatus">The status to return when check fails. Defaults to Unhealthy.</param>
/// <param name="name">Optional name for the health check. Defaults to "Akka.Persistence.Sql.SnapshotStore.{id}.Connectivity"</param>
/// <param name="tags">Optional tags for the health check. Defaults to ["akka", "persistence", "sql", "snapshot-store", "connectivity"]</param>
/// <returns>The snapshot builder for chaining</returns>
public static AkkaPersistenceSnapshotBuilder WithConnectivityCheck(
this AkkaPersistenceSnapshotBuilder builder,
SqlSnapshotOptions snapshotOptions,
HealthStatus unHealthyStatus = HealthStatus.Unhealthy,
string? name = null)
string? name = null,
string[]? tags = null)
{
if (snapshotOptions is null)
throw new ArgumentNullException(nameof(snapshotOptions));
Expand All @@ -644,7 +648,7 @@ public static AkkaPersistenceSnapshotBuilder WithConnectivityCheck(
name ?? $"Akka.Persistence.Sql.SnapshotStore.{snapshotOptions.Identifier}.Connectivity",
new SqlSnapshotStoreConnectivityCheck(snapshotOptions.ConnectionString!, snapshotOptions.ProviderName!, snapshotOptions.Identifier),
unHealthyStatus,
new[] { "akka", "persistence", "sql", "snapshot-store", "connectivity" });
tags ?? new[] { "akka", "persistence", "sql", "snapshot-store", "connectivity" });

// Use the new WithCustomHealthCheck method from Akka.Hosting 1.5.55-beta1
return builder.WithCustomHealthCheck(registration);
Expand Down