Sending a Message

To send a message, you use the MessageQueue.Send method. This method accepts the object you want to send and the label (title) of the message. Example 8-8 shows an example.

Example 8-8. Sending a simple text message in XML

Dim Queue As MessageQueue

If MessageQueue.Exists(".\Private$\TestQueue") Then
    Queue = New MessageQueue(".\Private$\TestQueue")
    Queue = MessageQueue.Create(".\Private$\TestQueue")
End If

Queue.Send("Inventory Request Order Item #222", "Test Message")

Figure 8-5 shows the retrieved message.

Receiving a message

Figure 8-5. Receiving a message

By default, the message is serialized to an XML format. Figure 8-6 shows the message ...

Get Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.