Пример #1
0
        /// <summary>
        /// Helper method to update the state of the Admin Actor once the event has be journaled.
        /// </summary>
        /// <param name="c"></param>
        private void postClientListItemInsertHandler(ClientListInsertCommand c)
        {
            _ActorState[c.Id] = c.ClientListItemData;
            _logger.Info($"Inserting new client list item Id:{c.Id} UserName:{c.ClientListItemData.Name}.");
            ClientListInsertedEvent message = new ClientListInsertedEvent(c.ClientListItemData.Copy(), c.User, c.ConnectionId);

            NotifySubscribers(message);
            AutoSaveSnashot(false);
        }
Пример #2
0
        /// <summary>
        /// This method handles client insert events by updating the Admin's client list to the latest information.
        /// </summary>
        /// <param name="e">ClientInserted event.</param>
        private void HandleClientInsertedEvent(ClientInsertedEvent e)
        {
            if (_ActorState[e.Id] == null)
            {
                ClientState    cs = e.ResultClientState;
                ClientListItem newClientListItem = ClientListItem.GenerateClientListItemFromClientState(cs);

                // It does not matter if the item exists or not we will stomp for that particular client the existing data
                // with the new data - see post insert handler.
                // Persist the event that a new client was added to the client list
                ClientListInsertCommand newCLIC = new ClientListInsertCommand(newClientListItem, e.User, e.ConnectionId);
                _logger.Info($"Inserting new client list item Id:{cs.Id} UserName:{cs.Name}.");
                Persist <ClientListInsertCommand>(newCLIC, postClientListItemInsertHandler);
            }
        }
Пример #3
0
 /// <summary>
 /// This recovery command handler will instantiate the child ClientActor and add/update the ClientItem to the ClientAdminActor's client list.  It will also maintain a reference to the child ClientActor.
 /// </summary>
 /// <param name="c"></param>
 private void InsertNewClientListItemRecoveryCommand(ClientListInsertCommand c)
 {
     _logger.Info($"Recovering Insert new client list item Id:{c.Id} UserName:{c.ClientListItemData.Name}.");
     _ActorState[c.Id] = c.ClientListItemData;
     _logger.Info($"Recovered Insert new client list item Id:{c.Id} UserName:{c.ClientListItemData.Name}.");
 }