Esempio n. 1
0
 public void Add(string path, MessageBase message)
 {
     var outputMessage = new OutputMessage(path, message);
     lock (this)
     {
         _messagesDictionary.Add(outputMessage.Message.MessageNo, outputMessage);
         _messages.AddLast(outputMessage);
     }
 }
Esempio n. 2
0
 public void AddMessage(string path, MessageBase message)
 {
     if (!OutOfWindow(message)) return;
     lock (this)
     {
         if (!OutOfWindow(message)) return;
         if(!_waitingMessages.ContainsKey(message.MessageNo))
             _waitingMessages.Add(message.MessageNo,new MessageWithPath(path, message));
         if (_lastDeliveredMessageNo == -1) _lastDeliveredMessageNo = message.MessageNo - 1;
         UpdateLastSentMessage(message.MessageNo);
     }
 }
Esempio n. 3
0
 private bool OutOfWindow(MessageBase message)
 {
     if (_lastDeliveredMessageNo == -1) return true;
     if (_lastDeliveredMessageNo < message.MessageNo) return true;
     return false;
 }
Esempio n. 4
0
 public OutputMessage(string path, MessageBase message)
     : this(path, message, DateTime.UtcNow)
 {
 }
Esempio n. 5
0
 public OutputMessage(string path, MessageBase message, DateTime publishedAt)
 {
     Path = path;
     Message = message;
     PublishedAt = publishedAt;
 }
        private void OnLowerLayerMessagePayload(string path, MessageBase messageBase)
        {
            var window = _windows.GetOrAdd(messageBase.ConnectionId, _ => new InputMovingWindow());
            window.AddMessage(path, messageBase);
            var flushedMessages = window.Flush();
            foreach (var flushed in flushedMessages)
            {
                if (flushed.Message is Message)
                {
                    _subscriber.Trigger(flushed.Path, ((Message) flushed.Message).InnerObject);
                }
            }

            AskForRegeneration(messageBase.ConnectionId, window);
        }