NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Receiving Messages Asynchronously

You can retrieve messages asynchronously in two ways: by using an event handler to receive notification when the operation finishes processing, or by using a callback. This procedure explains how to use event notification.

In event notification, you first bind an event handler to the procedure you want to run when the asynchronous call completes. You then call the BeginReceive method in your code. This starts the asynchronous processing and returns processing to your component. When the processing completes, an event you've defined is raised and the results of the retrieval are processed.

Note   BeginReceive will retrieve only a single message. If you want to continue processing messages asynchronously, you must either call BeginReceive again or use the callback parameter on BeginReceive to call a delegate that will continue to watch for new messages arriving on the queue.

See Also

Asynchronous Message Processing | Peeking at Messages Asynchronously | Reading and Receiving Messages | Peeking at Messages | Receiving Messages Programmatically | Creating MessageQueue Components