Share via


DeleteLockedMessage Method

Deletes the specified locked message from the message buffer.

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

Syntax

'Declaration
Public Sub DeleteLockedMessage ( _
    message As Message _
)
'Usage
Dim instance As MessageBufferClient
Dim message As Message

instance.DeleteLockedMessage(message)
public void DeleteLockedMessage(
    Message message
)
public:
void DeleteLockedMessage(
    Message^ message
)
member DeleteLockedMessage : 
        message:Message -> unit 
public function DeleteLockedMessage(
    message : Message
)

Parameters

Remarks

In most scenarios, DeleteLockedMessage(Message) is used after a message has successfully been retrieved by the client from the message buffer using PeekLock()()()(). By default, the message buffer will keep a message locked for two minutes before releasing the lock. For more information, see How to: Retrieve a Message from an AppFabric Service Bus Message Buffer.

Deleting an unlocked message returns HTTP error 404.

Examples

The following code sample describes how to delete a locked message.

message = client.PeekLock();
content = message.GetBody<string>();

Console.WriteLine("PeekLock message content: {0}", content);

// Delete previously locked message
client.DeleteLockedMessage(message);
message.Close();

See Also

Reference

MessageBufferClient Class

Microsoft.ServiceBus Namespace