×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

C# (C Sharp) example - How to receive message from a Microsoft message queue?


C# (C Sharp) - How to receive message from a Microsoft message queue?

The sample code below shows how to connect to a message queue and receive a message

System.Messaging.MessageQueue queue = new
System.Messaging.MessageQueue(".\Private$\MyPrivateQueue");

queue.Send("Sample message");

System.Messaging.Message msg = queue.Receive();

msg.Formatter = new System.Messaging.XmlMessageFormatter(
new string[] {"System.String"});

Console.WriteLine(msg.Body);

Category: C# (C Sharp)

 
<< Go back