Beispiel #1
0
        protected override void OnReceive(object message)
        {
            message.Match().With <ChatQuery.GetAllMessages>(get =>
            {
                var room     = ChatRoom.Get(get.ChatId);
                var messages = room.Messages;
                var ready    = new ChatQuery.MessagesReady(messages);

                Sender.Tell(ready);

                Context.Stop(Self);
            });
        }
Beispiel #2
0
        protected override void OnReceive(object message)
        {
            message.Match().With <ChatQuery.ReturnMessages>(fulfill =>
            {
                if (query.ChatId != fulfill.ChatId)
                {
                    return;
                }

                var room     = ChatRoom.Get(query.ChatId);
                var messages = room.Messages.Skip(query.Skip);
                var ready    = new ChatQuery.MessagesReady(messages);

                sender.Tell(ready);

                Context.Stop(Self);
            });
        }