QueueClient.PeekLock Method (TimeSpan)

[This is prerelease documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Retrieves the next message from the queue, using a specified timeout value.

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


    Dim instance As QueueClient
Dim timeout As TimeSpan
Dim returnValue As Message

returnValue = instance.PeekLock(timeout)


Public Function PeekLock ( _
    timeout As TimeSpan _
) As Message
public Message PeekLock (
    TimeSpan timeout
Message^ PeekLock (
    TimeSpan timeout
public Message PeekLock (
    TimeSpan timeout
public function PeekLock (
    timeout : TimeSpan
) : Message


  • timeout
    The period that the client allows the call to block until a message is retrieved.

Return Value

Returns a Message that contains the next message in the queue.


Exception type Condition

The timeout has expired.


The method blocks until a message can be retrieved from the queue or until the given timeout expires.

When the receiver has processed the message it must call DeleteLockedMessage for the message to indicate that it has consumed and processed the message. If the receiver cannot process the message it should call ReleaseLock for the message to restore the message into the Queue. If the client fails to delete a locked message, the message is automatically restored into the Queue after 60 seconds.

The operation requires ‘Listen’ permission on the Queue.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008, and Windows 2000

Target Platforms

See Also


QueueClient Class
QueueClient Members
Microsoft.ServiceBus Namespace