RestMSDomain CreatePipe(string domainUri, string title) { gateway.Logger.DebugFormat("Creating the pipe {0} on the RestMS server: {1}", title, gateway.Configuration.RestMS.Uri.AbsoluteUri); var client = gateway.Client(); try { var response = client.SendAsync(gateway.CreateRequest( domainUri, gateway.CreateEntityBody( new RestMSPipeNew { Type = "Default", Title = title }) ) ) .Result; response.EnsureSuccessStatusCode(); return(gateway.ParseResponse <RestMSDomain>(response)); } catch (AggregateException ae) { foreach (var exception in ae.Flatten().InnerExceptions) { gateway.Logger.ErrorFormat("Threw exception adding Pipe {0} to RestMS Server {1}", title, exception.Message); } throw new RestMSClientException(string.Format("Error adding the Feed {0} to the RestMS server, see log for details", title)); } }
public RestMSJoin CreateJoin(string pipeUri, string routingKey) { _logger.Value.DebugFormat("Creating the join with key {0} for pipe {1}", routingKey, pipeUri); var client = _gateway.Client(); try { var response = client.SendAsync( _gateway.CreateRequest( pipeUri, _gateway.CreateEntityBody( new RestMSJoin { Address = routingKey, Feed = _feed.FeedUri, Type = "Default" } ) ) ) .Result; response.EnsureSuccessStatusCode(); var pipe = _gateway.ParseResponse <RestMSPipe>(response); return(pipe.Joins.FirstOrDefault()); } catch (AggregateException ae) { foreach (var exception in ae.Flatten().InnerExceptions) { _logger.Value.ErrorFormat("Threw exception adding join with routingKey {0} to Pipe {1} on RestMS Server {2}", routingKey, pipeUri, exception.Message); } throw new RestMSClientException(string.Format("Error adding the join with routingKey {0} to Pipe {1} to the RestMS server, see log for details", routingKey, pipeUri)); } }