예제 #1
0
 private NameValueCollection GetHeadersFromMessage(RestMSMessage messageSpecification)
 {
     var headers = new NameValueCollection();
     if (messageSpecification.Headers != null)
         messageSpecification.Headers.Each(header => headers.Add(header.Name, header.Value));
     return headers;
 }
예제 #2
0
        public HttpResponseMessage PostMessageToFeed(string name, RestMSMessage messageSpecification)
        {
            var addMessageToFeedCommand = new AddMessageToFeedCommand(
                name,
                messageSpecification.Address,
                messageSpecification.ReplyTo ?? "",
                GetHeadersFromMessage(messageSpecification),
                GetAttachmentFromMessage(messageSpecification.Content)
                );

            _commandProcessor.Send(addMessageToFeedCommand);

            var item = new RestMSMessagePosted() { Count = addMessageToFeedCommand.MatchingJoins };
            return Request.CreateResponse<RestMSMessagePosted>(HttpStatusCode.OK, item);
        }