Share via


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)

Syntax

'Declaration
Public Function TryReceive ( _
    receipt As MessageReceipt, _
    serverWaitTime As TimeSpan, _
    <OutAttribute> ByRef message As BrokeredMessage _
) As Boolean
'Usage
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
)
public:
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

Parameters

  • 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

Reference

MessageReceiver Class

TryReceive Overload

Microsoft.ServiceBus.Messaging Namespace