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!

MessageQueue.BeginPeek (TimeSpan)

Returns without removing (peeks) the first message available in the queue referenced by the MessageQueue. Waits the specified interval for a message to become available.

[Visual Basic]
Overloads Public Function BeginPeek( _
   ByVal timeout As TimeSpan _
) As IAsyncResult
[C#]
public IAsyncResult BeginPeek(
   TimeSpan timeout
);
[C++]
public: IAsyncResult* BeginPeek(
   TimeSpan timeout
);
[JScript]
public function BeginPeek(
   timeout : TimeSpan
) : IAsyncResult;

Parameters

timeout
The interval of time, in milliseconds, to wait for a message to become available.

Return Value

The IAsyncResult that identifies the asynchronous request posted.

Exceptions

Exception Type Condition
ArgumentException The value specified for the timeout parameter is invalid. It may represent a negative number.

Remarks

BeginPeek is used in asynchronous processing to raise the System.Messaging.MessageQueue.MessageQueue.PeekCompleted event when a message is available or the specified timeout has expired.

Because BeginPeek is asynchronous, you can use this method to peek the queue without blocking the current thread of execution. To peek the queue synchronously, use the Peek method.

Set the timeout to zero to determine whether there is a message in the queue without peeking the message.

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | MessageQueue.BeginPeek Overload List | EndPeek | BeginReceive | Peek | Receive