Beispiel #1
0
 /// <summary>
 /// Ensures the feed exists.
 /// </summary>
 /// <param name="domain">The domain.</param>
 /// <exception cref="RestMSClientException"></exception>
 public void EnsureFeedExists(RestMSDomain domain)
 {
     var feedName = _gateway.Configuration.Feed.Name;
     _logger.Value.DebugFormat("Checking for existence of the feed {0} on the RestMS server: {1}", feedName, _gateway.Configuration.RestMS.Uri.AbsoluteUri);
     var isFeedDeclared = IsFeedDeclared(domain, feedName);
     if (!isFeedDeclared)
     {
         domain = CreateFeed(domain.Href, feedName);
         if (domain == null || !domain.Feeds.Any(feed => feed.Name == feedName))
         {
             throw new RestMSClientException(string.Format("Unable to create feed {0} on the default domain; see log for errors", feedName));
         }
     }
     FeedUri = domain.Feeds.First(feed => feed.Name == feedName).Href;
 }
Beispiel #2
0
        public void EnsurePipeExists(string pipeTitle, string routingKey, RestMSDomain domain)
        {
            _logger.Value.DebugFormat("Checking for existence of the pipe {0} on the RestMS server: {1}", pipeTitle, _gateway.Configuration.RestMS.Uri.AbsoluteUri);
            var pipeExists = PipeExists(pipeTitle, domain);
            if (!pipeExists)
            {
                domain = CreatePipe(domain.Href, pipeTitle);
                if (domain == null || !domain.Pipes.Any(dp => dp.Title == pipeTitle))
                {
                    throw new RestMSClientException(string.Format("Unable to create pipe {0} on the default domain; see log for errors", pipeTitle));
                }

                _join.CreateJoin(domain.Pipes.First(p => p.Title == pipeTitle).Href, routingKey);
            }

            PipeUri = domain.Pipes.First(dp => dp.Title == pipeTitle).Href;
        }
Beispiel #3
0
 private bool PipeExists(string pipeTitle, RestMSDomain domain)
 {
     return domain?.Pipes != null && domain.Pipes.Any(p => p.Title == pipeTitle);
 }
Beispiel #4
0
 private bool IsFeedDeclared(RestMSDomain domain, string feedName)
 {
     return domain?.Feeds != null && domain.Feeds.Any(feed => feed.Name == feedName);
 }