MessageQueue::Receive Method (TimeSpan, Cursor^)
Receives the current message in the queue, using a specified cursor. If no message is available, this method waits until either a message is available, or the time-out expires.
Assembly: System.Messaging (in System.Messaging.dll)
Parameters
- timeout
-
Type:
System::TimeSpan
A TimeSpan that indicates the time to wait until a new message is available for inspection.
- cursor
-
Type:
System.Messaging::Cursor^
A Cursor that maintains a specific position in the message queue.
Return Value
Type: System.Messaging::Message^A Message that references the first message available in the queue.
| Exception | Condition |
|---|---|
| ArgumentException | The value specified for the timeout parameter is not valid, possibly timeout is less than TimeSpan::Zero or greater than MessageQueue::InfiniteTimeout. |
| MessageQueueException | A message did not arrive in the queue before the time-out expired. -or- An error occurred when accessing a Message Queuing method Use this overload to receive a message and return in a specified period of time if there are no messages in the queue. |
Available since 2.0
The method is not thread safe.