public class DeleteMessageRequest extends AmazonWebServiceRequest implements java.io.Serializable
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.
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.
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.
Constructor and Description |
---|
DeleteMessageRequest()
Default constructor for DeleteMessageRequest object.
|
DeleteMessageRequest(java.lang.String queueUrl,
java.lang.String receiptHandle)
Constructs a new DeleteMessageRequest object.
|
Modifier and Type | Method and Description |
---|---|
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.
|
clone, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public DeleteMessageRequest()
public DeleteMessageRequest(java.lang.String queueUrl, java.lang.String receiptHandle)
queueUrl
- The URL of the Amazon SQS queue to take action on.
Queue URLs are case-sensitive.
receiptHandle
- The receipt handle associated with the message to delete.
public java.lang.String getQueueUrl()
The URL of the Amazon SQS queue to take action on.
Queue URLs are case-sensitive.
The URL of the Amazon SQS queue to take action on.
Queue URLs are case-sensitive.
public void setQueueUrl(java.lang.String queueUrl)
The URL of the Amazon SQS queue to take action on.
Queue URLs are case-sensitive.
queueUrl
- The URL of the Amazon SQS queue to take action on.
Queue URLs are case-sensitive.
public DeleteMessageRequest withQueueUrl(java.lang.String queueUrl)
The URL of the Amazon SQS queue to take action on.
Queue URLs are case-sensitive.
Returns a reference to this object so that method calls can be chained together.
queueUrl
- The URL of the Amazon SQS queue to take action on.
Queue URLs are case-sensitive.
public java.lang.String getReceiptHandle()
The receipt handle associated with the message to delete.
The receipt handle associated with the message to delete.
public void setReceiptHandle(java.lang.String receiptHandle)
The receipt handle associated with the message to delete.
receiptHandle
- The receipt handle associated with the message to delete.
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.
receiptHandle
- The receipt handle associated with the message to delete.
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.