private void ReceivedStopMessage(StopedReadingMessage message) { IActorRef userActor; if (!_users.TryGetValue(message.User, out userActor)) { throw new InvalidOperationException("User doesn't exists!"); } userActor.Tell(message); }
private void ReceivedStopMessage(StopedReadingMessage message) { if (!_isAlreadyReading) throw new InvalidOperationException("User was not reading any article!"); _stopwatch.Stop(); _isAlreadyReading = false; Context.ActorSelection("../../reporting").Tell(new ReportMessage(message.User, message.Article, _stopwatch.ElapsedMilliseconds)); _stopwatch.Reset(); }