System.Messaging Reference (Document! X Sample)
ReceiveById(String,TimeSpan,MessageQueueTransaction) Method



System.Messaging Namespace > MessageQueue Class > ReceiveById Method : ReceiveById(String,TimeSpan,MessageQueueTransaction) Method
The Id of the message to receive.
A System.TimeSpan that indicates the time to wait until a new message is available for inspection.
The MessageQueueTransaction object.
Receives the message that matches the given identifier (from a transactional queue) and waits until either a message with the specified identifier is available in the queue or the time-out expires.
Syntax
'Declaration
 
Public Overloads Function ReceiveById( _
   ByVal id As String, _
   ByVal timeout As TimeSpan, _
   ByVal transaction As MessageQueueTransaction _
) As Message
'Usage
 
Dim instance As MessageQueue
Dim id As String
Dim timeout As TimeSpan
Dim transaction As MessageQueueTransaction
Dim value As Message
 
value = instance.ReceiveById(id, timeout, transaction)

Parameters

id
The Id of the message to receive.
timeout
A System.TimeSpan that indicates the time to wait until a new message is available for inspection.
transaction
The MessageQueueTransaction object.

Return Value

The Message whose Id property matches the id parameter passed in.
Exceptions
ExceptionDescription
The id parameter is null.-or- The transaction parameter is null.
The value specified for the timeout parameter is not valid, possibly timeout is less than System.TimeSpan.Zero or greater than InfiniteTimeout.
A message with the specified id did not arrive in the queue before the time-out expired.-or- The queue is non-transactional.-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

Reference

MessageQueue Class
MessageQueue Members
Overload List