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

            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 HandleClientUnDeletedEvent(ClientUnDeletedEvent e)
        {
            // Is the item still in the list?
            if (_ActorState[e.Id] == null)
            {
                _logger.Info($"{e.User} tried undeleting from client list id:{e.Id} but was not found.");
            }
            else
            {
                ClientListItem cliNewState = _ActorState[e.Id].Copy();
                cliNewState.IsActive = true;

                // Memorialize that we are recovering the item from the list in the journal
                ClientListUnDeleteCommand clientListUnDeleteCommand = new ClientListUnDeleteCommand(
                    cliNewState,
                    e.User,
                    e.ConnectionId);

                _logger.Info($"Undeleting client list item Id{e.Id} UserName:{e.ResultClientState.Name}.");
                Persist <ClientListUnDeleteCommand>(clientListUnDeleteCommand, PostClientListUnDeleteHandler);
            }
        }