예제 #1
0
 private void SendDeleteMessage(RestMSMessageLink matchingMessage)
 {
     var client = Client();
     var response = client.DeleteAsync(matchingMessage.Href).Result;
     response.EnsureSuccessStatusCode();
 }
예제 #2
0
        private Message GetMessage(RestMSMessageLink messageUri)
        {
            if (messageUri == null)
            {
                return new Message();
            }

            _logger.Value.DebugFormat("Getting the message from the RestMS server: {0}", messageUri);
            var client = Client();

            try
            {
                var response = client.GetAsync(messageUri.Href).Result;
                response.EnsureSuccessStatusCode();
                var pipeMessage = ParseResponse<RestMSMessage>(response);
                return RestMSMessageCreator.CreateMessage(pipeMessage);
            }
            catch (AggregateException ae)
            {
                foreach (var exception in ae.Flatten().InnerExceptions)
                {
                    _logger.Value.ErrorFormat("Threw exception getting Pipe {0} from RestMS Server {1}", _pipe.PipeUri, exception.Message);
                }

                throw new RestMSClientException(string.Format("Error retrieving the domain from the RestMS server, see log for details"));
            }
        }