Esempio n. 1
0
 public Queue(MessageQueue queue)
     : this()
 {
     QueueName = queue.QueueName;
     QueuePath = queue.Path;
     MessageCount = (int)queue.GetCount();
 }
Esempio n. 2
0
        public Queue(MessageQueue queue)
            : this()
        {
            QueuePath = queue.Path;
            try
            {
                QueueName = queue.QueueName;
            }
            catch (Exception e)
            {
                Messenger.Default.Send(NotificationEvent.Fail(e.ToString(),
                                                              "An error occurred while getting queue name for {0}: {1}",
                                                              queue.Path, e.Message));
                QueueName = QueuePath;
            }

            try
            {
                MessageCount = (int)queue.GetCount();
            }
            catch (Exception e)
            {
                Messenger.Default.Send(NotificationEvent.Fail(e.ToString(),
                                                              "An error occurred while retrieving message count from {0}: {1}",
                                                              QueueName, e.Message));
                MessageCount = -1;
            }
        }
 public EnqueuedAndFetchedCountDto GetEnqueuedAndFetchedCount(string queue)
 {
     using (var messageQueue = new MessageQueue(String.Format(_pathPattern, queue)))
     {                
         return new EnqueuedAndFetchedCountDto
         {
             EnqueuedCount = (int?)messageQueue.GetCount()
         };
     }
 }
Esempio n. 4
0
        public Queue(MessageQueue queue)
            : this()
        {
            QueuePath = queue.Path;
            try
            {
                QueueName = queue.QueueName;
            }
            catch (Exception e)
            {
                if (queue.Path.ToLowerInvariant()
                         .Contains("deadxact"))
                {
                    QueueName = "Dead-letter queue (TX)";
                    CanBeDeleted = false;
                }
                else
                {
                    Messenger.Default.Send(NotificationEvent.Fail(e.ToString(),
                                                                  "An error occurred while getting queue name for {0}: {1}",
                                                                  queue.Path, e.Message));
                    QueueName = QueuePath;
                }
            }

            try
            {
                MessageCount = (int)queue.GetCount();
            }
            catch (Exception e)
            {
                Messenger.Default.Send(NotificationEvent.Fail(e.ToString(),
                                                              "An error occurred while retrieving message count from {0}: {1}",
                                                              QueueName, e.Message));
                MessageCount = -1;
            }
        }