public DbActor() { Context.System.Scheduler.ScheduleTellRepeatedly(AppDataBase.EventualConsistencyReloadingInterval, AppDataBase.EventualConsistencyReloadingInterval, Self, new CheckReHyDrationMessage(), Self); Receive <CheckReHyDrationMessage>(_ => { if (AppDataBase.TurnOnEventualConsistencyReloading) { foreach (var className in AppDataBase.GetAllAccessedClasses()) { if (AppDataBase.HasRecentlyAccessed(className)) { AppDataBase.ResetLastAccessUtc(className); if (AppDataBase.DbActorFacts.ContainsKey(className)) { DbReHydrationActorActor.Tell(new CheckReHyDrationMessage(className)); } } } } }); this.Receive <DbActorRequestMessage>(message => { if (message.TransactionId == null || message.TransactionId.Count == 0) { return; } if (message.Operation == null) { RemoveAllStoredTransactionRoutes(message); return; } string transactionSig = null; transactionSig = GetTransactionSigIfTransactionIdIsPresentInTransactionRoute(message); if (transactionSig == null && message.TransactionId.Count > 1) { transactionSig = CreateNewTransactionActor(transactionSig, message); } if (transactionSig != null) { _transactionActors[transactionSig].Forward(message); } else { var id = message.TransactionId[0]; if (!_actors.ContainsKey(id)) { _actors.Add(id, Context.System.ActorOf(Props.Create(() => new DbPerIdActor(id, false)))); } _actors[id].Forward(message); } }); }