MessageReceiver.TryReceive Method (MessageReceipt, TimeSpan, BrokeredMessage%)

Tries to receive a brokered message.

Namespace:  Microsoft.ServiceBus.Messaging
Assembly:  Microsoft.ServiceBus.Messaging (in Microsoft.ServiceBus.Messaging.dll)


Public Function TryReceive ( _
    receipt As MessageReceipt, _
    serverWaitTime As TimeSpan, _
    <OutAttribute> ByRef message As BrokeredMessage _
) As Boolean
Dim instance As MessageReceiver
Dim receipt As MessageReceipt
Dim serverWaitTime As TimeSpan
Dim message As BrokeredMessage
Dim returnValue As Boolean

returnValue = instance.TryReceive(receipt, _
    serverWaitTime, message)
public bool TryReceive(
    MessageReceipt receipt,
    TimeSpan serverWaitTime,
    out BrokeredMessage message
bool TryReceive(
    MessageReceipt^ receipt, 
    TimeSpan serverWaitTime, 
    [OutAttribute] BrokeredMessage^% message
member TryReceive : 
        receipt:MessageReceipt * 
        serverWaitTime:TimeSpan * 
        message:BrokeredMessage byref -> bool 
public function TryReceive(
    receipt : MessageReceipt, 
    serverWaitTime : TimeSpan, 
    message : BrokeredMessage
) : boolean


  • serverWaitTime
    Type: System.TimeSpan
    The server wait time before the operation times out.

Return Value

Type: System.Boolean
true if the attempt succeeds, false if it fails.

See Also


MessageReceiver Class

TryReceive Overload

Microsoft.ServiceBus.Messaging Namespace