Esempio n. 1
0
        private void RemoveReceiverConsumer()
        {
            if (Interlocked.Read(ref _receiverThreads) > 0)
            {
                return;
            }
            if (_receiver is null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(_receiverConsumerTag))
            {
                _receiver.Channel.BasicCancel(_receiverConsumerTag);
                _receiverConsumerTag = null;
            }
            _receiverConsumer = null;
            _receiver.Close();
            var rcvName = _receiver.Name;

            if (!UseSingleResponseQueue)
            {
                rcvName += "-" + Core.InstanceIdString;
            }
            Core.Log.LibVerbose("The Receiver for the queue \"{0}\" has been disposed.", rcvName);
        }
Esempio n. 2
0
        /// <inheritdoc />
        /// <summary>
        /// Create a new message queue
        /// </summary>
        /// <param name="queue">Message Queue connection instance</param>
        /// <returns>true if the message queue was created; otherwise, false.</returns>
        public bool Create(MQConnection queue)
        {
            if (Exist(queue))
            {
                return(false);
            }
            var rabbitQueue = new RabbitMQueue(queue);

            if (!rabbitQueue.EnsureConnectionAsync(2000, 100).WaitAndResults())
            {
                return(false);
            }
            rabbitQueue.EnsureQueue();
            rabbitQueue.EnsureExchange();
            rabbitQueue.Close();
            return(true);
        }
Esempio n. 3
0
 private void RemoveReceiverConsumer()
 {
     if (Interlocked.Read(ref _receiverThreads) > 0)
     {
         return;
     }
     if (_receiver == null)
     {
         return;
     }
     if (!string.IsNullOrEmpty(_receiverConsumerTag))
     {
         _receiver.Channel.BasicCancel(_receiverConsumerTag);
         _receiverConsumerTag = null;
     }
     _receiverConsumer = null;
     _receiver.Close();
     Core.Log.LibVerbose("The Receiver for the queue \"{0}\" has been disposed.", _receiver.Name);
 }