Akka.Persistence.Redis.Hosting
Akka.NET Persistence journal and snapshot store backed by Redis.
Install
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard |
README
Akka.Persistence.Redis.Hosting
Akka.Hosting extension methods to add Akka.Persistence.Redis to an ActorSystem
Akka.Persistence.Redis Extension Methods
WithRedisPersistence() Method
public static AkkaConfigurationBuilder WithRedisPersistence(
this AkkaConfigurationBuilder builder,
string configurationString,
PersistenceMode mode = PersistenceMode.Both,
bool autoInitialize = true,
Action<AkkaPersistenceJournalBuilder>? journalBuilder = null,
Action<AkkaPersistenceSnapshotBuilder>? snapshotBuilder = null,
string pluginIdentifier = "Redis",
bool isDefaultPlugin = true);
public static AkkaConfigurationBuilder WithRedisPersistence(
this AkkaConfigurationBuilder builder,
Action<RedisJournalOptions>? journalOptionConfigurator = null,
Action<RedisSnapshotOptions>? snapshotOptionConfigurator = null,
bool isDefaultPlugin = true)
public static AkkaConfigurationBuilder WithRedisPersistence(
this AkkaConfigurationBuilder builder,
RedisJournalOptions? journalOptions = null,
RedisSnapshotOptions? snapshotOptions = null
Action<AkkaPersistenceJournalBuilder>? journalBuilder = null,
Action<AkkaPersistenceSnapshotBuilder>? snapshotBuilder = null)
Parameters
configurationStringstringConnection string used for database access. Connection string as described here: https://stackexchange.github.io/StackExchange.Redis/Configuration#basic-configuration-strings.
modePersistenceModeDetermines which settings should be added by this method call. Default:
PersistenceMode.BothPersistenceMode.Journal: Only add the journal settingsPersistenceMode.SnapshotStore: Only add the snapshot store settingsPersistenceMode.Both: Add both journal and snapshot store settings
autoInitializeboolShould the Redis store collection be initialized automatically. Default:
falsejournalBuilderAction<AkkaPersistenceJournalBuilder>An Action delegate used to configure an
AkkaPersistenceJournalBuilderinstance. Used to configure health check.snapshotBuilderAction<AkkaPersistenceSnapshotBuilder>An Action delegate used to configure an
AkkaPersistenceSnapshotBuilderinstance. Used to configure health check.journalConfiguratorAction<RedisJournalOptions>An Action delegate to configure a
RedisJournalOptionsinstance.snapshotConfiguratorAction<RedisSnapshotOptions>An Action delegate to configure a
RedisSnapshotOptionsinstance.journalOptionsRedisJournalOptionsAn
RedisJournalOptionsinstance to configure the Redis journal store.snapshotOptionsRedisSnapshotOptionsAn
RedisSnapshotOptionsinstance to configure the Redis snapshot store.
Microsoft.Extensions.Diagnostics.HealthChecks Integration
Akka.Persistence.Redis.Hosting includes built-in health check support for Redis persistence plugins through the WithHealthCheck() extension methods. These health checks integrate with Microsoft.Extensions.Diagnostics.HealthChecks to monitor the health of your Redis journal and snapshot stores.
Built-in Health Checks
All health checks are tagged with akka, persistence, and mongodb for easy filtering.
Configuring Health Checks
You can add health checks when configuring Redis persistence using the WithHealthCheck() method:
builder
.WithRedisPersistence(
journalOptions: new RedisJournalOptions
{
ConfigurationString = "your-redis-connection-string",
},
snapshotOptions: new RedisSnapshotOptions
{
ConfigurationString = "your-redis-connection-string",
},
journalBuilder: journal => journal.WithHealthCheck(HealthStatus.Degraded),
snapshotBuilder: snapshot.WithHealthCheck(HealthStatus.Degraded));
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.