Ejemplo n.º 1
0
        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);
        }
        public bool TranslateAkkaDeleteEventToExternalMessage(CommandEventMessage internalCommandEvent)
        {
            ClientDeletedEvent e = internalCommandEvent as ClientDeletedEvent;

            HTTPExternalInterface.HandleEDStateMessage(
                new HTTPDestinedCommandStateEvent(
                    MicroServices.ProcessingStatus.Processed,
                    e.Message,
                    new HTTPSourcedCommand(
                        e.CommandType.ToString(),
                        e.Area.ToString(),
                        null,
                        e.ResultClientState,
                        e.User,
                        e.ConnectionId,
                        e.Id
                        )
                    ),
                false //User only?
                );
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Removes client(item) from the list.  If an instance of the ClientActor is in memory it unloads it.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private void HandleClientDeletedEvent(ClientDeletedEvent e)
        {
            // Is the item still in the list?
            if (_ActorState[e.Id] == null)
            {
                _logger.Info($"{e.User} tried deleting from client list id:{e.Id} but was not found.");
            }
            else
            {
                ClientListItem cliNewState = _ActorState[e.Id].Copy();
                cliNewState.IsActive = false;

                // Memorialize that we are removing the item from the list in the journal
                ClientListDeleteCommand clientListDeleteCommand = new ClientListDeleteCommand(
                    cliNewState,
                    e.User,
                    e.ConnectionId);

                _logger.Info($"Deleting client list item Id{e.Id} UserName:{e.ResultClientState.Name}.");
                Persist <ClientListDeleteCommand>(clientListDeleteCommand, PostClientListDeleteHandler);
            }
        }