Beispiel #1
0
        /// <summary>
        /// Destorys the queue
        /// </summary>
        public async Task Destroy()
        {
            await TimeKeeper.Destroy();

            lock (HighPriorityLinkedList)
                HighPriorityLinkedList.Clear();

            lock (RegularLinkedList)
                RegularLinkedList.Clear();

            if (_ackSync != null)
            {
                _ackSync.Dispose();
                _ackSync = null;
            }

            if (_listSync != null)
            {
                _listSync.Dispose();
            }

            if (_pushSync != null)
            {
                _pushSync.Dispose();
            }

            if (_triggerTimer != null)
            {
                await _triggerTimer.DisposeAsync();

                _triggerTimer = null;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Destorys the queue
        /// </summary>
        public async Task Destroy()
        {
            IsDestroyed = true;

            try
            {
                await TimeKeeper.Destroy();

                OnMessageProduced.Dispose();

                lock (PriorityMessagesList)
                    PriorityMessagesList.Clear();

                lock (MessagesList)
                    MessagesList.Clear();

                if (_ackSync != null)
                {
                    _ackSync.Dispose();
                    _ackSync = null;
                }

                if (_listSync != null)
                {
                    _listSync.Dispose();
                }

                if (_pushSync != null)
                {
                    _pushSync.Dispose();
                }

                if (_triggerTimer != null)
                {
                    await _triggerTimer.DisposeAsync();

                    _triggerTimer = null;
                }
            }
            finally
            {
                OnDestroyed?.Invoke(this);
            }

            _clients.Clear();
            OnConsumerSubscribed.Dispose();
            OnConsumerUnsubscribed.Dispose();
        }