public void TranslateExternalUnDeleteCommandToAkkaMessage(HTTPSourcedCommand cmdExternal) { JObject jo = cmdExternal.Data as JObject; string id = jo.Value <string>("Id") ?? jo.Value <string>("id"); ClientUnDeleteCommand deleteCmd = new ClientUnDeleteCommand(id, cmdExternal.User, cmdExternal.ConnectionId); SendTo.Tell(deleteCmd, ReplyTo); }
private void UnDeleteClientCommand(ClientUnDeleteCommand c) { if (_ActorState.isActive == true) { var message = new ClientFailedUnDeleteEvent("Client is already active.", c.Id, c.User, c.ConnectionId); Sender.Tell(message, Self); } else { // Journal the fact that the client was deleted Persist <ClientUnDeleteCommand>(c, PostUnDeleteHandler); } }
private void PostUnDeleteHandler(ClientUnDeleteCommand c) { _ActorState.isActive = true; // Once a client has been marked as inactive we want to save the state so that future incarnations of the actor will // be in a inactive state. AutoSaveSnashot(true); _logger.Debug($"User:{c.User} undeleted client id:{_ActorState.Id}."); ClientUnDeletedEvent message = new ClientUnDeletedEvent(_ActorState.Clone(), c.User, c.ConnectionId); Sender.Tell(message, Self); NotifyCommandEventSubscribers(message); }
private bool UnDeleteClientRecoveryCommand(ClientUnDeleteCommand c) { _ActorState.isActive = true; return(true); }