Delete a Message from an Amazon SQS Queue - AWS SDK for .NET (version 2)

End of support announcement: http://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-the-aws-sdk-for-net-version-2/.

This documentation is for version 2.0 of the AWS SDK for .NET. For current content, see the latest version of the AWS SDK for .NET developer guide instead.

Delete a Message from an Amazon SQS Queue

You can use the Amazon SDK for .NET to receive messages from an Amazon SQS queue.

To delete a message from an Amazon SQS queue

  1. Create and initialize a DeleteMessageRequest instance. Specify the Amazon SQS queue to delete a message from and the receipt handle of the message to delete, as follows:

    DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest(); deleteMessageRequest.QueueUrl = queueUrl; deleteMessageRequest.ReceiptHandle = recieptHandle;
  2. Pass the request object as a parameter to the DeleteMessage method. The method returns a DeleteMessageResponse object, as follows:

    DeleteMessageResponse response = amazonSQSClient.DeleteMessage(deleteMessageRequest);

    Calling DeleteMessage unconditionally removes the message from the queue, regardless of the visibility timeout setting. For more information about visibility timeouts, go to Visibility Timeout.

For information about sending a message to a queue, see Sending an Amazon SQS Message.

For information about receiving messages from a queue, see Receiving a Message from an Amazon SQS Queue.