Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RestMSMessage"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public RestMSMessage(Message message)
 {
     Address = message.Address.Value;
     MessageId = message.MessageId.ToString();
     ReplyTo = message.ReplyTo == null ? "" : message.ReplyTo.AbsoluteUri;
     Feed = message.FeedHref.AbsoluteUri;
     Headers = message.Headers.All.Select(header => new RestMSMessageHeader(header)).ToArray();
     Content = new RestMSMessageContent(message.Content);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RestMSMessageLink" /> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public RestMSMessageLink(Message message)
 {
     Href = message.Href.AbsoluteUri;
     Address = message.Address.Value;
     MessageId = message.MessageId.ToString();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the message. Messages are ordered by time of arrival
        /// </summary>
        /// <param name="message">The message.</param>
        public void AddMessage(Message message)
        {
            lock (_messageSyncRoot)
            {
                long ticks = DateTime.UtcNow.Ticks;
                var matchingKey = _messages.Keys.FirstOrDefault(key => key == ticks);
                if (matchingKey == 0)
                {
                    _messages.Add(ticks, new List<Message>() { message });
                }
                else
                {
                    _messages[ticks].Add(message);
                }

                message.PipeName = Name;
            }
        }
Ejemplo n.º 4
0
        public IEnumerable<Pipe> AddMessage(Message message)
        {
            var updatedPipes = new List<Pipe>();
            var matchingJoins = Joins[message.Address];
            if (matchingJoins.Any())
            {
                matchingJoins.Each(join =>
                                   {
                                       var pipe = join.Pipe;
                                       pipe.AddMessage(new Message(message));
                                       updatedPipes.Add(pipe);
                                   });
                message.Content.Dispose();
            }

            return updatedPipes;
        }