コード例 #1
0
        public async Task <IHttpActionResult> Delete(string name)
        {
            var queues = await _messageQueueManager.ListQueues();

            if (!queues.Any(x => x.Equals(name, StringComparison.InvariantCultureIgnoreCase)))
            {
                return(NotFound());
            }

            var subs = _subscriptionManager.ListSubscribers().Where(s => s.QueueName == name);

            foreach (var sub in subs)
            {
                _subscriptionManager.StopSubscriber(sub.Id);
            }

            await _messageQueueManager.DeleteQueueIfExists(name);

            foreach (var sub in subs)
            {
                _subscriptionManager.RemoveSubscriber(sub.Id);
            }
            return(Ok());
        }