com.amazonaws.services.sqs.model
Class DeleteMessageRequest

java.lang.Object
  extended by com.amazonaws.AmazonWebServiceRequest
      extended by com.amazonaws.services.sqs.model.DeleteMessageRequest
All Implemented Interfaces:
java.io.Serializable

public class DeleteMessageRequest
extends AmazonWebServiceRequest
implements java.io.Serializable

Container for the parameters to the DeleteMessage operation.

Deletes the specified message from the specified queue. You specify the message by using the message's receipt handle and not the message ID you received when you sent the message. Even if the message is locked by another reader due to the visibility timeout setting, it is still deleted from the queue. If you leave a message in the queue for longer than the queue's configured retention period, Amazon SQS automatically deletes it.

NOTE: The receipt handle is associated with a specific instance of receiving the message. If you receive a message more than once, the receipt handle you get each time you receive the message is different. When you request DeleteMessage, if you don't provide the most recently received receipt handle for the message, the request will still succeed, but the message might not be deleted.

IMPORTANT: It is possible you will receive a message even after you have deleted it. This might happen on rare occasions if one of the servers storing a copy of the message is unavailable when you request to delete the message. The copy remains on the server and might be returned to you again on a subsequent receive request. You should create your system to be idempotent so that receiving a particular message more than once is not a problem.

See Also:
AmazonSQS.deleteMessage(DeleteMessageRequest), Serialized Form

Constructor Summary
DeleteMessageRequest()
          Default constructor for a new DeleteMessageRequest object.
DeleteMessageRequest(java.lang.String queueUrl, java.lang.String receiptHandle)
          Constructs a new DeleteMessageRequest object.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getQueueUrl()
          The URL of the Amazon SQS queue to take action on.
 java.lang.String getReceiptHandle()
          The receipt handle associated with the message to delete.
 int hashCode()
           
 void setQueueUrl(java.lang.String queueUrl)
          The URL of the Amazon SQS queue to take action on.
 void setReceiptHandle(java.lang.String receiptHandle)
          The receipt handle associated with the message to delete.
 java.lang.String toString()
          Returns a string representation of this object; useful for testing and debugging.
 DeleteMessageRequest withQueueUrl(java.lang.String queueUrl)
          The URL of the Amazon SQS queue to take action on.
 DeleteMessageRequest withReceiptHandle(java.lang.String receiptHandle)
          The receipt handle associated with the message to delete.
 
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyPrivateRequestParameters, getDelegationToken, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setDelegationToken, setRequestCredentials, setRequestMetricCollector, withRequestMetricCollector
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeleteMessageRequest

public DeleteMessageRequest()
Default constructor for a new DeleteMessageRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.


DeleteMessageRequest

public DeleteMessageRequest(java.lang.String queueUrl,
                            java.lang.String receiptHandle)
Constructs a new DeleteMessageRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
queueUrl - The URL of the Amazon SQS queue to take action on.
receiptHandle - The receipt handle associated with the message to delete.
Method Detail

getQueueUrl

public java.lang.String getQueueUrl()
The URL of the Amazon SQS queue to take action on.

Returns:
The URL of the Amazon SQS queue to take action on.

setQueueUrl

public void setQueueUrl(java.lang.String queueUrl)
The URL of the Amazon SQS queue to take action on.

Parameters:
queueUrl - The URL of the Amazon SQS queue to take action on.

withQueueUrl

public DeleteMessageRequest withQueueUrl(java.lang.String queueUrl)
The URL of the Amazon SQS queue to take action on.

Returns a reference to this object so that method calls can be chained together.

Parameters:
queueUrl - The URL of the Amazon SQS queue to take action on.
Returns:
A reference to this updated object so that method calls can be chained together.

getReceiptHandle

public java.lang.String getReceiptHandle()
The receipt handle associated with the message to delete.

Returns:
The receipt handle associated with the message to delete.

setReceiptHandle

public void setReceiptHandle(java.lang.String receiptHandle)
The receipt handle associated with the message to delete.

Parameters:
receiptHandle - The receipt handle associated with the message to delete.

withReceiptHandle

public DeleteMessageRequest withReceiptHandle(java.lang.String receiptHandle)
The receipt handle associated with the message to delete.

Returns a reference to this object so that method calls can be chained together.

Parameters:
receiptHandle - The receipt handle associated with the message to delete.
Returns:
A reference to this updated object so that method calls can be chained together.

toString

public java.lang.String toString()
Returns a string representation of this object; useful for testing and debugging.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object.
See Also:
Object.toString()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.