void IMessageTransport.Init(Address address)
{
if (address == null)
{
throw new ArgumentNullException("address");
}
var machine = address.Machine;
if (machine.ToLower() != Environment.MachineName.ToLower())
{
throw new InvalidOperationException(
string.Format("Input queue [{0}] must be on the same machine as this process [{1}].",
address, Environment.MachineName.ToLower()));
}
var fullPath = MsmqUtilities.GetFullPathWithoutPrefix(address);
if (MessageQueue.Exists(fullPath))
{
_messageQueue = new MessageQueue(fullPath);
}
else
{
_messageQueue = MessageQueue.Create(fullPath);
}
var mpf = new MessagePropertyFilter();
mpf.SetAll();
_messageQueue.MessageReadPropertyFilter = mpf;
if (PurgeOnStartup)
{
_messageQueue.Purge();
}
}