public void TranslateExternalDeleteCommandToAkkaMessage(HTTPSourcedCommand cmdExternal) { JObject jo = cmdExternal.Data as JObject; string id = jo.Value <string>("Id") ?? jo.Value <string>("id"); ClientDeleteCommand deleteCmd = new ClientDeleteCommand(id, cmdExternal.User, cmdExternal.ConnectionId); SendTo.Tell(deleteCmd, ReplyTo); }
private void DeleteClientCommand(ClientDeleteCommand c) { if (_ActorState.isActive == false) { var message = new ClientFailedDeleteEvent("Client has been already deleted.", c.Id, c.User, c.ConnectionId); Sender.Tell(message, Self); } else { // Journal the fact that the client was deleted Persist <ClientDeleteCommand>(c, PostDeleteHandler); } }
private void PostDeleteHandler(ClientDeleteCommand c) { // Deleting a client is not permanently removing them from the datastore but rather a simple state change to inactive. _ActorState.isActive = false; // 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} deleted client id:{_ActorState.Id}."); ClientDeletedEvent message = new ClientDeletedEvent(_ActorState.Clone(), c.User, c.ConnectionId); Sender.Tell(message, Self); NotifyCommandEventSubscribers(message); }
private bool DeleteClientRecoveryCommand(ClientDeleteCommand c) { _ActorState.isActive = false; return(true); }