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); }
public static bool CanCreate(this MsmqAddress mqAddr) { return(mqAddr.IsLocal && mqAddr.IsAvailable()); }