public void TranslateExternalInsertCommandToAkkaMessage(HTTPSourcedCommand cmdExternal) { ClientState cs; if (ExtractStateObject(cmdExternal, out cs)) { ClientInsertCommand insertCommand = new ClientInsertCommand(cs, cmdExternal.User, cmdExternal.ConnectionId); SendTo.Tell(insertCommand, ReplyTo); } }
private bool InsertNewClientCommand(ClientInsertCommand c) { if (c.ClientStateData.Name == null || c.ClientStateData.Name == "") { Sender.Tell(new ClientFailedInsertEvent("UserName field cannot be blank(or null).", c.ClientStateData, c.User, c.ConnectionId)); _logger.Error($"While insert PersistenceId: {PersistenceId} client name is missing."); } if (c.ClientStateData.Id == null || c.ClientStateData.Id == "") { _ActorState = new ClientState(PersistenceId, c.ClientStateData); AutoSaveSnashot(true); _logger.Info($"Inserted {_ActorState.DocumentType} for id:{_ActorState.Id}"); ClientInsertedEvent message = new ClientInsertedEvent(_ActorState.Clone(), c.User, c.ConnectionId); Sender.Tell(message, Self); NotifyCommandEventSubscribers(message); } return(true); }
private void InsertNewClientRecoveryCommand(ClientInsertCommand c) { // When recovering set the state of the actor _ActorState = c.ClientStateData; }