I swear this code used to work .....
I'm using code from this sample: https://www.codeproject.com/Articles/871746/Implementing-pub-sub-using-MSMQ-in-minutes
using System;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Messaging;
using System.Threading;
namespace MSMQPublisher
{
class Publisher
{
static void Main(string[] args)
{
try
{
string MSMQMulticastAddress = "FormatName:MULTICAST=234.1.1.1:8001";
var messageQueue = MessageQueue.Create(MSMQMulticastAddress, true);
var stopWatch = new Stopwatch();
stopWatch.Start();
for (var i = 0; i < 10; i++)
{
Message msg = new Message(string.Format($"{DateTime.UtcNow.Ticks}: msg:{i} hello world "));
msg.UseDeadLetterQueue = true;
msg.TimeToBeReceived = new TimeSpan(0, 0, 1, 0);
messageQueue.Send(msg);
Console.WriteLine("[MSMQ] Sent");
Thread.Sleep(10);
}
stopWatch.Stop();
Console.WriteLine("====================================================");
Console.WriteLine("[MSMQ] done sending messages in " + stopWatch.ElapsedMilliseconds);
Console.WriteLine("[MSMQ] Sending reset counter to consumers.");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine("EXCEPTION: " + ex.Message);
Console.Read();
}
}
}
}
Which throws the exception :
"Cannot create a queue with the path FormatName:MULTICAST=234.1.1.1:8001."} System.Exception {System.ArgumentException}
I've tried this on several Windows 10 Machines. I tried setting [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters] "MulticastBindIP"
Can anyone suggest a possible resolution or point out what stupid thing I'm doing?
Thanks