Akka.Hosting extension methods to add Akka.Persistence.SqlServer to an ActorSystem
public static AkkaConfigurationBuilder WithSqlServerPersistence(
this AkkaConfigurationBuilder builder,
string connectionString,
PersistenceMode mode = PersistenceMode.Both,
Action<AkkaPersistenceJournalBuilder>? configurator = null,
bool autoInitialize = true);
public static AkkaConfigurationBuilder WithSqlServerPersistence(
this AkkaConfigurationBuilder builder,
Action<SqlServerJournalOptions>? journalConfigurator = null,
Action<SqlServerSnapshotOptions>? snapshotConfigurator = null,
Action<AkkaPersistenceJournalBuilder>? configurator = null);
public static AkkaConfigurationBuilder WithSqlServerPersistence(
this AkkaConfigurationBuilder builder,
SqlServerJournalOptions? journalOptions = null,
SqlServerSnapshotOptions? snapshotOptions = null,
Action<AkkaPersistenceJournalBuilder>? configurator = null);
-
connectionString
stringConnection string used for database access.
-
mode
PersistenceModeDetermines which settings should be added by this method call.
PersistenceMode.Journal
: Only add the journal settingsPersistenceMode.SnapshotStore
: Only add the snapshot store settingsPersistenceMode.Both
: Add both journal and snapshot store settings
-
configurator
Action<AkkaPersistenceJournalBuilder>An Action delegate used to configure an
AkkaPersistenceJournalBuilder
instance. Used to configure Event Adapters -
journalConfigurator
Action<SqlServerJournalOptions>An Action delegate to configure a
SqlServerJournalOptions
instance. -
snapshotConfigurator
Action<SqlServerSnapshotOptions>An Action delegate to configure a
SqlServerSnapshotOptions
instance. -
journalOptions
SqlServerJournalOptionsAn
SqlServerJournalOptions
instance to configure the SqlServer journal. -
snapshotOptions
SqlServerSnapshotOptionsAn
SqlServerSnapshotOptions
instance to configure the SqlServer snapshot store.
using var host = new HostBuilder()
.ConfigureServices((context, services) =>
{
services.AddAkka("ecsBootstrapDemo", (builder, provider) =>
{
builder
.WithRemoting("localhost", 8110)
.WithClustering()
.WithSqlServerPersistence("your-sqlserver-connection-string");
});
}).Build();
await host.RunAsync();