Wednesday, March 19, 2008

MSMQ Multicast with .net

msmq 3.0 and above supports multicast with PGM

1. Create a non transactional queue and set the multicast address

2. Create a publisher
MessageQueue msq = new MessageQueue("formatname:MULTICAST=234.1.1.1:1234");
msq.Formatter = new BinaryMessageFormatter();
msq.Send("hello world");
msq.Close();

3. Create a consumer
MessageQueue q = new MessageQueue(@".\private$\myqueue");
q.Formatter = new BinaryMessageFormatter();
Message m = q.Receive();
Console.WriteLine(m.Body.ToString());
Console.ReadLine();
q.Close();

2 comments:

linux said...

I met an error, when I started receive after start send in widnows 7.


would you give me answer for me ?

my email is limlinux@naver.com

linux said...

I met an error, when I started receive after start send in widnows 7.


would you give me answer for me ?

my email is limlinux@naver.com