Esempio n. 1
0
        public static bool IsAvailable(this MsmqAddress mqAddr)
        {
            var queue = new MessageQueue(mqAddr.OriginalPath);

            try
            {
                queue.Peek(TimeSpan.FromMilliseconds(5));
                return(true);
            }
            catch (MessageQueueException mqex)
            {
                return(mqex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout);
            }
            catch (Exception)
            {
            }
            return(false);
        }
Esempio n. 2
0
 public static bool CanCreate(this MsmqAddress mqAddr)
 {
     return(mqAddr.IsLocal && mqAddr.IsAvailable());
 }