コード例 #1
0
 /// <summary>
 /// Close the channel.
 /// </summary>
 public void Close()
 {
     try
     {
         this.connectionDelegate.Close();
     }
     catch (Exception e)
     {
         throw RabbitUtils.ConvertRabbitAccessException(e);
     }
 }
コード例 #2
0
        /// <summary>Create a channel, given a flag indicating whether it should be transactional or not.</summary>
        /// <param name="transactional">The transactional.</param>
        /// <returns>The channel.</returns>
        public IModel CreateChannel(bool transactional)
        {
            try
            {
                var channel = this.connectionDelegate.CreateModel();
                if (transactional)
                {
                    // Just created so we want to start the transaction
                    channel.TxSelect();
                }

                return(channel);
            }
            catch (Exception e)
            {
                throw RabbitUtils.ConvertRabbitAccessException(e);
            }
        }
コード例 #3
0
 /// <summary>
 /// Create a connection.
 /// </summary>
 /// <returns>The connection.</returns>
 public virtual IConnection CreateBareConnection()
 {
     try
     {
         if (this.addresses != null)
         {
             // TODO: Waiting on RabbitMQ.Client to catch up to the Java equivalent here.
             // return new SimpleConnection(this.rabbitConnectionFactory.CreateConnection(this.executorService, this.addresses));
             return(new SimpleConnection(this.rabbitConnectionFactory.CreateConnection()));
         }
         else
         {
             // TODO: Waiting on RabbitMQ.Client to catch up to the Java equivalent here.
             // return new SimpleConnection(this.rabbitConnectionFactory.CreateConnection(this.executorService));
             return(new SimpleConnection(this.rabbitConnectionFactory.CreateConnection()));
         }
     }
     catch (Exception ex)
     {
         throw RabbitUtils.ConvertRabbitAccessException(ex);
     }
 }