System.Messaging Reference (Document! X Sample)
System.Messaging Namespace / MessageQueue Class / Receive Method / Receive(TimeSpan,Cursor,MessageQueueTransactionType) Method
A System.TimeSpan that indicates the time to wait until a new message is available for inspection.
A Cursor that maintains a specific position in the message queue.
One of the MessageQueueTransactionType values that describes the type of transaction context to associate with the message.



In This Topic
    Receive(TimeSpan,Cursor,MessageQueueTransactionType) Method
    In This Topic
    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.
    Syntax
    'Declaration
     
    
    Public Overloads Function Receive( _
       ByVal timeout As TimeSpan, _
       ByVal cursor As Cursor, _
       ByVal transactionType As MessageQueueTransactionType _
    ) As Message
    'Usage
     
    
    Dim instance As MessageQueue
    Dim timeout As TimeSpan
    Dim cursor As Cursor
    Dim transactionType As MessageQueueTransactionType
    Dim value As Message
     
    value = instance.Receive(timeout, cursor, transactionType)

    Parameters

    timeout
    A System.TimeSpan that indicates the time to wait until a new message is available for inspection.
    cursor
    A Cursor that maintains a specific position in the message queue.
    transactionType
    One of the MessageQueueTransactionType values that describes the type of transaction context to associate with the message.

    Return Value

    A Message that references a message in the queue.
    Exceptions
    ExceptionDescription
    The cursor 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.
    The transactionType parameter is not one of the MessageQueueTransactionType members.
    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