|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Message Queuing supports sending and receiving serialized objects that support IPersistStreamand IPersistStorage. Many persistent objects, such as all Microsoft Office documents, can be sent as the body of an Message Queuing message.
When sending an object as the body of a message, Message Queuing seamlessly invokes the object's IPersistinterface. In this way, when the message is sent, the persistent state of the object is serialized into the message body using the object's supplied IPersistinterface.
At the receiving end, an implementation of the object's interface must be installed to use the object when it is removed from the queue.
The following example sends a Microsoft® Word 8.0 document to a destination queue. This code could be modified to send any persistent object.
Make sure that Microsoft Word 8.0 is installed on your computer.
Add a reference to Microsoft Word 8.0. Create a destination queue and open it with send access.
Create the Microsoft Word document object.
Create and send a message. Set the body of the message to the document object.
Open the queue with receive access and retrieve the message.
Create a new object using the body of the retrieved message.