Esempio n. 1
0
        private void SubsManager_OnEventReplyRemoved(object sender, string eventName)
        {
            if (!PersistentConnection.IsConnected)
            {
                PersistentConnection.TryConnect();
            }

            using (var channel = PersistentConnection.CreateModel())
            {
                channel.QueueUnbind(QueueName, ExchangeDeclareParameters.ExchangeName, eventName);

                channel.QueueUnbind(_queueNameReply, ExchangeDeclareParameters.ExchangeName, eventName);
            }

            if (!SubsManager.IsReplyEmpty)
            {
                return;
            }

            QueueName = string.Empty;
            ConsumerChannel?.Close();

            //ToDo

            _queueNameReply = string.Empty;
            _consumerChannelReply?.Close();
        }
 /// <summary>
 /// Closes this instance channel to rabbitmq.
 /// </summary>
 public void Close()
 {
     if (ConsumerChannel.IsOpen)
     {
         // set auto close to true, so that it will close if no other channel is active
         if (Connection.IsOpen)
         {
             Connection.AutoClose = true;
         }
         ConsumerChannel.Close();
     }
 }