Beispiel #1
0
 public MessageDetail(Message msg)
 {
     this.User = msg.User;
     this.ID = msg.ID;
     this.EventID = msg.EventID;
     this.SchemaID = msg.SchemaID;
     this.Message = msg.MessageContent;
     this.PostTime = msg.PostTime;
 }
Beispiel #2
0
        public void SpreadMessage(Message message)
        {
            List<UserProfile> followers = _accManager.Followers(message.User);
            followers.Add(_accManager.FindUser(message.User));
            //speed tweet to followers

            //todo: BatchInsert
            foreach (UserProfile user in followers)
            {
                HomeLineEntity entity = new HomeLineEntity(user.Userid, message);
                TableOperation insertOperation = TableOperation.Insert(entity);
                _homeline.Execute(insertOperation);
            }
        }
Beispiel #3
0
        public void PostMessage(string userid, string eventID, string schemaID, string message, DateTime timestamp)
        {
            if (message.Length > 2048)
            {
                throw new MessageTooLongException();
            }
            if (_accManager.FindUser(userid) == null)
            {
                throw new UserNotFoundException(userid);
            }

            if (!_schemaManager.Contain(schemaID))
            {
                throw new SchemaNotFoundException();
            }

            if (!Utils.IsValidID(eventID))
            {
                throw new InvalidIDException("Event");
            }

            Message msg = new Message(userid, message, timestamp, eventID, schemaID);
            //insert into Userline
            TableOperation insertOperation = TableOperation.Insert(new UserLineEntity(msg));
            _userline.Execute(insertOperation);

            //insert into Eventline
            insertOperation = TableOperation.Insert(new EventLineEntity(msg));
            _eventline.Execute(insertOperation);

            //insert into PublicSquareLine
            insertOperation = TableOperation.Insert(new PublicSquareLineEntity(msg));
            _publicSquareLine.Execute(insertOperation);

            //insert into QueueMessage
            //QueueMessage queueMessage = new QueueMessage(QueueMessage.TypeMessage, msg.ToJsonString());
            _queue.AddMessage(msg.toAzureCloudQueueMessage());
        }