Share via


PeekLock Method (TimeSpan)

Retrieves the first message from the message buffer and locks the message on the buffer for the default lock duration of two minutes.

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

Syntax

'Declaration
Public Function PeekLock ( _
    timeout As TimeSpan _
) As Message
'Usage
Dim instance As MessageBufferClient
Dim timeout As TimeSpan
Dim returnValue As Message

returnValue = instance.PeekLock(timeout)
public Message PeekLock(
    TimeSpan timeout
)
public:
Message^ PeekLock(
    TimeSpan timeout
)
member PeekLock : 
        timeout:TimeSpan -> Message 
public function PeekLock(
    timeout : TimeSpan
) : Message

Parameters

  • timeout
    Type: System. . :: . .TimeSpan
    The length of time to wait for the call to return. The default is one minute, which is the maximum supported timeout interval.

Return Value

Type: System.ServiceModel.Channels. . :: . .Message
Returns a Message that contains the message from the buffer.

Remarks

If no messages are present, this method waits up to the specified timeout interval for a message to arrive before returning a response. This method is provided in order to support polling patterns. The default timeout interval is 1 minute, which is the maximum supported timeout interval.

Use this version of the peek/lock if you want to use a unique timeout value other than 1 minute, but if you want to use the default lock duration of two minutes.

For more information on performing a peek/lock on a message in the message buffer, see How to: Retrieve a Message from an AppFabric Service Bus Message Buffer.

See Also

Reference

MessageBufferClient Class

PeekLock Overload

Microsoft.ServiceBus Namespace