public static void CheckQueue(string address)
{
var msmqAddress = MsmqAddress.Parse(address);
var queuePath = msmqAddress.PathWithoutPrefix;
Logger.Debug($"Checking if queue exists: {queuePath}.");
var path = msmqAddress.PathWithoutPrefix;
try
{
if (MessageQueue.Exists(path))
{
using (var messageQueue = new MessageQueue(path))
{
Logger.DebugFormat("Verified that the queue: [{0}] existed", queuePath);
WarnIfPublicAccess(messageQueue);
}
}
}
catch (MessageQueueException ex)
{
if (msmqAddress.IsRemote)
{
Logger.Warn($"Unable to verify remote queue '{queuePath}'. Make sure the queue exists, and that the address is correct. Processing will still continue.", ex);
return;
}
Logger.Warn($"Unable to verify queue at address '{queuePath}'. Make sure the queue exists, and that the address is correct. Processing will still continue.", ex);
}
}