PeekLock Method
Retrieves the first available message from the message buffer, and locks that message on the buffer.
Namespace: Microsoft.ServiceBus
Assembly: Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)
Syntax
'Declaration
Public Function PeekLock As Message
'Usage
Dim instance As MessageBufferClient
Dim returnValue As Message
returnValue = instance.PeekLock()
public Message PeekLock()
public:
Message^ PeekLock()
member PeekLock : unit -> Message
public function PeekLock() : Message
Return Value
Type: System.ServiceModel.Channels. . :: . .Message
Returns a Message instance containing the message.
Remarks
Use this version of peek/lock if you have do not wish to change the default timeout interval or lock duration. The default timeout interval is 0. The default lock duration is two minutes. See overrides for more info on these parameters.
For more information, see How to: Retrieve a Message from an AppFabric Service Bus Message Buffer.
Examples
The following code example describes how to peek/lock a message from the message buffer.
// Retrieve a message (peek/lock)
message = client.PeekLock();
content = message.GetBody<string>();
Console.WriteLine("PeekLock message content: {0}", content);
// Delete previously locked message
client.DeleteLockedMessage(message);
message.Close();