Share via


PeekLock Method (TimeSpan, TimeSpan)

Retrieves a copy of the first message from the message buffer, while locking the original message in the buffer, using the specified timeout and lock duration.

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

Syntax

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

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

Parameters

  • timeout
    Type: System. . :: . .TimeSpan
    The length of time to wait for the method to return. The default is one minute, which is the maximum supported timeout interval.
  • lockDuration
    Type: System. . :: . .TimeSpan
    The time to keep the original message locked on the message buffer; the default is two minutes. The maximum supported lock duration is 5 minutes and the minimum is 10 seconds.

Return Value

Type: System.ServiceModel.Channels. . :: . .Message
Returns a Message that contains a copy of the first message in the message buffer.

Remarks

Use this version of the peek/lock method if you want to explicitly state the timeout and lock durations. If the message is not deleted or unlocked in the lockDuration period, the message buffer will unlock the message.

See Also

Reference

MessageBufferClient Class

PeekLock Overload

Microsoft.ServiceBus Namespace