com.amazonaws.services.sqs.model
Class ChangeMessageVisibilityRequest

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

public class ChangeMessageVisibilityRequest
extends AmazonWebServiceRequest
implements java.io.Serializable

Container for the parameters to the ChangeMessageVisibility operation.

Changes the visibility timeout of a specified message in a queue to a new value. The maximum allowed timeout value you can set the value to is 12 hours. This means you can't extend the timeout of a message in an existing queue to more than a total visibility timeout of 12 hours. (For more information visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide .)

For example, let's say you have a message and its default message visibility timeout is 30 minutes. You could call ChangeMessageVisiblity with a value of two hours and the effective timeout would be two hours and 30 minutes. When that time comes near you could again extend the time out by calling ChangeMessageVisiblity, but this time the maximum allowed timeout would be 9 hours and 30 minutes.

NOTE: There is a 120,000 limit for the number of inflight messages per queue. Messages are inflight after they have been received from the queue by a consuming component, but have not yet been deleted from the queue. If you reach the 120,000 limit, you will receive an OverLimit error message from Amazon SQS. To help avoid reaching the limit, you should delete the messages from the queue after they have been processed. You can also increase the number of queues you use to process the messages.

IMPORTANT:If you attempt to set the VisibilityTimeout to an amount more than the maximum time left, Amazon SQS returns an error. It will not automatically recalculate and increase the timeout to the maximum time remaining.

IMPORTANT:Unlike with a queue, when you change the visibility timeout for a specific message, that timeout value is applied immediately but is not saved in memory for that message. If you don't delete a message after it is received, the visibility timeout for the message the next time it is received reverts to the original timeout value, not the value you set with the ChangeMessageVisibility action.

See Also:
AmazonSQS.changeMessageVisibility(ChangeMessageVisibilityRequest), Serialized Form

Constructor Summary
ChangeMessageVisibilityRequest()
          Default constructor for a new ChangeMessageVisibilityRequest object.
ChangeMessageVisibilityRequest(java.lang.String queueUrl, java.lang.String receiptHandle, java.lang.Integer visibilityTimeout)
          Constructs a new ChangeMessageVisibilityRequest 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 whose visibility timeout should be changed.
 java.lang.Integer getVisibilityTimeout()
          The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.
 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 whose visibility timeout should be changed.
 void setVisibilityTimeout(java.lang.Integer visibilityTimeout)
          The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.
 java.lang.String toString()
          Returns a string representation of this object; useful for testing and debugging.
 ChangeMessageVisibilityRequest withQueueUrl(java.lang.String queueUrl)
          The URL of the Amazon SQS queue to take action on.
 ChangeMessageVisibilityRequest withReceiptHandle(java.lang.String receiptHandle)
          The receipt handle associated with the message whose visibility timeout should be changed.
 ChangeMessageVisibilityRequest withVisibilityTimeout(java.lang.Integer visibilityTimeout)
          The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.
 
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

ChangeMessageVisibilityRequest

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


ChangeMessageVisibilityRequest

public ChangeMessageVisibilityRequest(java.lang.String queueUrl,
                                      java.lang.String receiptHandle,
                                      java.lang.Integer visibilityTimeout)
Constructs a new ChangeMessageVisibilityRequest 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 whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.
visibilityTimeout - The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.
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 ChangeMessageVisibilityRequest 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 whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.

Returns:
The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.

setReceiptHandle

public void setReceiptHandle(java.lang.String receiptHandle)
The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.

Parameters:
receiptHandle - The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.

withReceiptHandle

public ChangeMessageVisibilityRequest withReceiptHandle(java.lang.String receiptHandle)
The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.

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

Parameters:
receiptHandle - The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.
Returns:
A reference to this updated object so that method calls can be chained together.

getVisibilityTimeout

public java.lang.Integer getVisibilityTimeout()
The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.

Returns:
The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.

setVisibilityTimeout

public void setVisibilityTimeout(java.lang.Integer visibilityTimeout)
The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.

Parameters:
visibilityTimeout - The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.

withVisibilityTimeout

public ChangeMessageVisibilityRequest withVisibilityTimeout(java.lang.Integer visibilityTimeout)
The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.

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

Parameters:
visibilityTimeout - The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.
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.