Receive(TimeSpan,MessageQueueTransactionType) Method
Receives the first message available in the queue referenced by the MessageQueue. This call is synchronous, and waits until either a message is available in the queue, or the time-out expires.
Syntax
'Declaration Public Overloads Function Receive( _ ByVal timeout As TimeSpan, _ ByVal transactionType As MessageQueueTransactionType _ ) As Message
'Usage Dim instance As MessageQueue Dim timeout As TimeSpan Dim transactionType As MessageQueueTransactionType Dim value As Message value = instance.Receive(timeout, transactionType)
public Message Receive( TimeSpan timeout, MessageQueueTransactionType transactionType )
public: Message^ Receive( TimeSpan timeout, MessageQueueTransactionType transactionType )
Parameters
- timeout
- A System.TimeSpan that indicates the time to wait until a new message is available for inspection.
- transactionType
- One of the MessageQueueTransactionType values, describing the type of transaction context to associate with the message.
Return Value
A Message that references the first message available in the queue.
Exceptions
Exception | Description |
---|---|
System.ArgumentException | The value specified for the timeout parameter is not valid, possibly timeout is less than System.TimeSpan.Zero or greater than InfiniteTimeout. |
System.ComponentModel.InvalidEnumArgumentException | The transactionType parameter is not one of the MessageQueueTransactionType members. |
MessageQueueException | A message did not arrive in the queue before the time-out expired.-or- An error occurred when accessing a Message Queuing method. |
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also