EnsureFeedExists() public method

Ensures the feed exists.
public EnsureFeedExists ( paramore.brighter.commandprocessor.messaginggateway.restms.Model.RestMSDomain domain ) : void
domain paramore.brighter.commandprocessor.messaginggateway.restms.Model.RestMSDomain The domain.
return void
        /// <summary>
        /// Sends the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns>Task.</returns>
        public Task Send(Message message)
        {
            var tcs = new TaskCompletionSource <object>();

            try
            {
                feed.EnsureFeedExists(domain.GetDomain());
                SendMessage(Configuration.Feed.Name, message);
            }
            catch (RestMSClientException rmse)
            {
                Logger.ErrorFormat("Error sending to the RestMS server: {0}", rmse.ToString());
                tcs.SetException(rmse);
                throw;
            }
            catch (HttpRequestException he)
            {
                Logger.ErrorFormat("HTTP error on request to the RestMS server: {0}", he.ToString());
                tcs.SetException(he);
                throw;
            }

            tcs.SetResult(new object());
            return(tcs.Task);
        }
 /// <summary>
 /// Sends the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 public void Send(Message message)
 {
     try
     {
         _feed.EnsureFeedExists(_domain.GetDomain());
         SendMessage(Configuration.Feed.Name, message);
     }
     catch (RestMSClientException rmse)
     {
         _logger.Value.ErrorFormat("Error sending to the RestMS server: {0}", rmse.ToString());
         throw;
     }
     catch (HttpRequestException he)
     {
         _logger.Value.ErrorFormat("HTTP error on request to the RestMS server: {0}", he.ToString());
         throw;
     }
 }
Beispiel #3
0
        /// <summary>
        /// Receives the specified queue name.
        /// </summary>

        /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
        /// <returns>Message.</returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public Message Receive(int timeoutInMilliseconds = -1)
        {
            try
            {
                _feed.EnsureFeedExists(_domain.GetDomain());
                _pipe = new Pipe(this, _feed);
                _pipe.EnsurePipeExists(_queueName, _routingKey, _domain.GetDomain());

                return(ReadMessage());
            }
            catch (RestMSClientException rmse)
            {
                Logger.ErrorFormat("Error sending to the RestMS server: {0}", rmse.ToString());
                throw;
            }
            catch (HttpRequestException he)
            {
                Logger.ErrorFormat("HTTP error on request to the RestMS server: {0}", he.ToString());
                throw;
            }
        }