public JournalSequenceActor(IReadJournalDAO readJournalDao, JournalSequenceRetrievalConfig config) { _mat = Materializer.CreateSystemMaterializer((ExtendedActorSystem)Context.System, ActorMaterializerSettings.Create(Context.System), "linq2db-query"); _readJournalDao = readJournalDao; _config = config; queryDelay = config.QueryDelay; maxTries = config.MaxTries; _log = Context.GetLogger(); }
public Linq2DbWriteJournal(Configuration.Config config) { try { _journalConfig = new JournalConfig(config); _mat = Materializer.CreateSystemMaterializer((ExtendedActorSystem)Context.System, ActorMaterializerSettings.Create(Context.System) .WithDispatcher(_journalConfig.MaterializerDispatcher) , "l2dbWriteJournal" ); try { _journal = new ByteArrayJournalDao( Context.System.Scheduler.Advanced, _mat, new AkkaPersistenceDataConnectionFactory( _journalConfig), _journalConfig, Context.System.Serialization, Context.GetLogger()); } catch (Exception e) { Context.GetLogger().Error(e, "Error Initializing Journal!"); throw; } if (_journalConfig.TableConfig.AutoInitialize) { try { _journal.InitializeTables(); } catch (Exception e) { Context.GetLogger().Warning(e, "Unable to Initialize Persistence Journal Table!"); } } } catch (Exception ex) { Context.GetLogger().Warning(ex, "Unexpected error initializing journal!"); throw; } }
public Linq2DbSnapshotStore(Configuration.Config config) { _snapshotConfig = new SnapshotConfig(config); _dao = new ByteArraySnapshotDao( new AkkaPersistenceDataConnectionFactory(_snapshotConfig), _snapshotConfig, Context.System.Serialization, Materializer.CreateSystemMaterializer((ExtendedActorSystem)Context.System), Context.GetLogger()); if (_snapshotConfig.TableConfig.AutoInitialize) { try { _dao.InitializeTables(); } catch (Exception e) { Context.GetLogger().Warning(e, "Unable to Initialize Persistence Snapshot Table!"); } } }
public Linq2DbReadJournal(ExtendedActorSystem system, Configuration.Config config, string configPath) { writePluginId = config.GetString("write-plugin"); //IDK Why we need this, but we do. system.RegisterExtension(Persistence.Instance); var persist = Persistence.Instance.Get(system); eventAdapters = persist .AdaptersFor(writePluginId); readJournalConfig = new ReadJournalConfig(config); this.system = system; var connFact = new AkkaPersistenceDataConnectionFactory(readJournalConfig); _mat = Materializer.CreateSystemMaterializer(system, ActorMaterializerSettings.Create(system), "l2db-query-mat" + configPath); readJournalDao = new ByteArrayReadJournalDao( system.Scheduler.Advanced, _mat, connFact, readJournalConfig, new ByteArrayJournalSerializer(readJournalConfig, system.Serialization, readJournalConfig.PluginConfig.TagSeparator)); journalSequenceActor = system.ActorOf(Props.Create(() => new JournalSequenceActor(readJournalDao , readJournalConfig .JournalSequenceRetrievalConfiguration)), readJournalConfig.TableConfig.TableName + "akka-persistence-linq2db-sequence-actor"); delaySource = Source.Tick( TimeSpan.FromSeconds(0), readJournalConfig.RefreshInterval, 0L) .Take(1); }