public PersistenceExtension(ExtendedActorSystem system) { _system = system; _system.Settings.InjectTopLevelFallback(Persistence.DefaultConfig()); _config = system.Settings.Config.GetConfig("akka.persistence"); _defaultJournalPluginId = new Lazy <string>(() => { var configPath = _config.GetString("journal.plugin"); if (string.IsNullOrEmpty(configPath)) { throw new NullReferenceException("Default journal plugin is not configured"); } return(configPath); }); _defaultSnapshotPluginId = new Lazy <string>(() => { var configPath = _config.GetString("snapshot-store.plugin"); if (string.IsNullOrEmpty(configPath)) { throw new NullReferenceException("Default snapshot-store plugin is not configured"); } return(configPath); }); Settings = new PersistenceSettings(_system, _config); }
public PersistenceExtension(ExtendedActorSystem system) { _system = system; _system.Settings.InjectTopLevelFallback(Persistence.DefaultConfig()); _config = system.Settings.Config.GetConfig("akka.persistence"); _journal = CreatePlugin("journal", type => typeof(AsyncWriteJournal).IsAssignableFrom(type) ? Dispatchers.DefaultDispatcherId : DefaultPluginDispatcherId); _snapshotStore = CreatePlugin("snapshot-store", _ => DefaultPluginDispatcherId); Settings = new PersistenceSettings(_system, _config); }
/// <summary> /// TBD /// </summary> /// <param name="system">TBD</param> /// <exception cref="NullReferenceException">TBD</exception> public PersistenceExtension(ExtendedActorSystem system) { _system = system; _system.Settings.InjectTopLevelFallback(Persistence.DefaultConfig()); _config = system.Settings.Config.GetConfig("akka.persistence"); _log = Logging.GetLogger(_system, this); _defaultJournalPluginId = new Lazy <string>(() => { var configPath = _config.GetString("journal.plugin"); if (string.IsNullOrEmpty(configPath)) { throw new NullReferenceException("Default journal plugin is not configured"); } return(configPath); }, LazyThreadSafetyMode.ExecutionAndPublication); _defaultSnapshotPluginId = new Lazy <string>(() => { var configPath = _config.GetString("snapshot-store.plugin"); if (string.IsNullOrEmpty(configPath)) { if (_log.IsWarningEnabled) { _log.Warning("No default snapshot store configured! " + "To configure a default snapshot-store plugin set the `akka.persistence.snapshot-store.plugin` key. " + "For details see 'persistence.conf'"); } return(NoSnapshotStorePluginId); } return(configPath); }, LazyThreadSafetyMode.ExecutionAndPublication); _defaultInternalStashOverflowStrategy = new Lazy <IStashOverflowStrategy>(() => { var configuratorTypeName = _config.GetString("internal-stash-overflow-strategy"); var configuratorType = Type.GetType(configuratorTypeName); return(((IStashOverflowStrategyConfigurator)Activator.CreateInstance(configuratorType)).Create(_system.Settings.Config)); }); Settings = new PersistenceSettings(_system, _config); _config.GetStringList("journal.auto-start-journals").ForEach(id => { if (_log.IsInfoEnabled) { _log.Info("Auto-starting journal plugin `{0}`", id); } JournalFor(id); }); _config.GetStringList("journal.auto-start-snapshot-stores").ForEach(id => { if (_log.IsInfoEnabled) { _log.Info("Auto-starting snapshot store `{0}`", id); } SnapshotStoreFor(id); }); }