public ShopNode(NodeConfiguration cfg, ISqlNodeDbConfiguration persistenceCfg, string readModelString, ILogger logger = null) { _logger = logger; NodeConfiguration = cfg; PersistenceConfiguration = persistenceCfg; ReadDbConnectionString = readModelString; }
public PersistenceJournalConfig(ISqlNodeDbConfiguration dbConfiguration, IHoconConfig eventAdatpersConfig, Type sqlJournalType = null) { _eventAdatpersConfig = eventAdatpersConfig; _dbConfiguration = dbConfiguration; _sqlJournalType = sqlJournalType; }
public static async Task ClearDomainData(ISqlNodeDbConfiguration nodeConf) { await TestDbTools.Truncate(nodeConf.SnapshotConnectionString.Replace("\\\\", "\\"), nodeConf.SnapshotTableName); await TestDbTools.Truncate(nodeConf.JournalConnectionString.Replace("\\\\", "\\"), nodeConf.JournalTableName, nodeConf.MetadataTableName); }
public static string ToStandAloneSystemConfig(this NodeConfiguration conf, ISqlNodeDbConfiguration persistence, bool serializeMessagesCreators = false) { return(ActorSystemBuilder.New() .Log(conf.LogLevel) .DomainSerialization(serializeMessagesCreators) .RemoteActorProvider() .Remote(conf.Address) .SqlPersistence(persistence) .BuildHocon()); }
public static T UseSqlPersistence <T>(this T fixture, bool clearData = true, ISqlNodeDbConfiguration dbConfig = null) where T : NodeTestFixture { var persistence = dbConfig ?? new AutoTestNodeDbConfiguration(); if (clearData) { fixture.OnNodePreparingEvent += (s, e) => { ClearDomainData(persistence).Wait(); } } ; fixture.ConfigBuilder = n => n.ToDebugStandAloneSystemConfig(persistence); return(fixture); }
public static string BuildPersistenceSnapshotConfig(ISqlNodeDbConfiguration sqlNodeDbConfiguration) { var persistenceSnapshotStorageConfig = @" snapshot-store { plugin = ""akka.persistence.snapshot-store.sql-server"" sql-server { class = ""Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"" plugin-dispatcher = ""akka.actor.default-dispatcher"" connection-string = """ + sqlNodeDbConfiguration.SnapshotConnectionString + @""" connection-timeout = " + sqlNodeDbConfiguration.SnapshotsConnectionTimeoutSeconds + @"s schema-name = " + sqlNodeDbConfiguration.SchemaName + @" table-name = """ + sqlNodeDbConfiguration.SnapshotTableName + @""" auto-initialize = on } }"; return(persistenceSnapshotStorageConfig); }
public static ActorSystem CreateSystem(this NodeConfiguration conf, ISqlNodeDbConfiguration cfg) { return(ActorSystem.Create(conf.Name, conf.ToStandAloneSystemConfig(cfg))); }
public static string ToClusterNonSeedNodeSystemConfig(this NodeConfiguration conf, ISqlNodeDbConfiguration persistence, params INodeNetworkAddress[] seeds) { return(ActorSystemBuilder.New() .Log(conf.LogLevel) .ClusterNonSeed(conf, seeds) .SqlPersistence(persistence) .BuildHocon()); }
public PersistenceSnapshotConfig(ISqlNodeDbConfiguration sqlNodeDbConfiguration) { _sqlNodeDbConfiguration = sqlNodeDbConfiguration; }
public static ActorSystemBuilder SqlPersistence(this ActorSystemBuilder builder, ISqlNodeDbConfiguration conf) { builder.Add(new PersistenceConfig(new PersistenceJournalConfig(conf ?? throw new ArgumentNullException(nameof(conf)), new DomainEventAdaptersConfig()), new PersistenceSnapshotConfig(conf))); return(builder); }
public static IActorSystemFactory Build(this ActorSystemBuilder builder, NodeConfiguration conf, ISqlNodeDbConfiguration persistence) { return(builder.Log(conf.LogLevel) .DomainSerialization(false) .RemoteActorProvider() .Remote(conf.Address) .SqlPersistence(persistence) .BuildActorSystemFactory(conf.Name)); }
public static string ToDebugStandAloneSystemConfig(this NodeConfiguration conf, ISqlNodeDbConfiguration persistence) { #if DEBUG return(conf.ToStandAloneSystemConfig(persistence, true)); #else return(conf.ToStandAloneSystemConfig(persistence, false)); #endif }