Did this page help you?

   Yes   No   Tell us about it...

com.amazonaws.services.sqs.model
Class ReceiveMessageRequest

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

public class ReceiveMessageRequest
extends AmazonWebServiceRequest
implements Serializable

Container for the parameters to the ReceiveMessage operation.

Retrieves one or more messages from the specified queue, including the message body and message ID of each message. Messages returned by this action stay in the queue until you delete them. However, once a message is returned to a ReceiveMessage request, it is not returned on subsequent ReceiveMessage requests for the duration of the VisibilityTimeout . If you do not specify a VisibilityTimeout in the request, the overall visibility timeout for the queue is used for the returned messages.

If a message is available in the queue, the call will return immediately. Otherwise, it will wait up to WaitTimeSeconds for a message to arrive. If you do not specify WaitTimeSeconds in the request, the queue attribute ReceiveMessageWaitTimeSeconds is used to determine how long to wait.

You could ask for additional information about each message through the attributes. Attributes that can be requested are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp] .

See Also:
AmazonSQS.receiveMessage(ReceiveMessageRequest), Serialized Form

Constructor Summary
ReceiveMessageRequest()
          Default constructor for a new ReceiveMessageRequest object.
ReceiveMessageRequest(String queueUrl)
          Constructs a new ReceiveMessageRequest object.
 
Method Summary
 boolean equals(Object obj)
           
 List<String> getAttributeNames()
          A list of attributes that need to be returned along with each message.
 Integer getMaxNumberOfMessages()
          The maximum number of messages to return.
 String getQueueUrl()
          The URL of the SQS queue to take action on.
 Integer getVisibilityTimeout()
          The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
 Integer getWaitTimeSeconds()
          The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning.
 int hashCode()
           
 void setAttributeNames(Collection<String> attributeNames)
          A list of attributes that need to be returned along with each message.
 void setMaxNumberOfMessages(Integer maxNumberOfMessages)
          The maximum number of messages to return.
 void setQueueUrl(String queueUrl)
          The URL of the SQS queue to take action on.
 void setVisibilityTimeout(Integer visibilityTimeout)
          The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
 void setWaitTimeSeconds(Integer waitTimeSeconds)
          The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning.
 String toString()
          Returns a string representation of this object; useful for testing and debugging.
 ReceiveMessageRequest withAttributeNames(Collection<String> attributeNames)
          A list of attributes that need to be returned along with each message.
 ReceiveMessageRequest withAttributeNames(String... attributeNames)
          A list of attributes that need to be returned along with each message.
 ReceiveMessageRequest withMaxNumberOfMessages(Integer maxNumberOfMessages)
          The maximum number of messages to return.
 ReceiveMessageRequest withQueueUrl(String queueUrl)
          The URL of the SQS queue to take action on.
 ReceiveMessageRequest withVisibilityTimeout(Integer visibilityTimeout)
          The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
 ReceiveMessageRequest withWaitTimeSeconds(Integer waitTimeSeconds)
          The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning.
 
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyPrivateRequestParameters, getRequestClientOptions, getRequestCredentials, setRequestCredentials
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReceiveMessageRequest

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


ReceiveMessageRequest

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

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

getQueueUrl

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

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

setQueueUrl

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

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

withQueueUrl

public ReceiveMessageRequest withQueueUrl(String queueUrl)
The URL of the 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 SQS queue to take action on.
Returns:
A reference to this updated object so that method calls can be chained together.

getAttributeNames

public List<String> getAttributeNames()
A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].

Returns:
A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].

setAttributeNames

public void setAttributeNames(Collection<String> attributeNames)
A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].

Parameters:
attributeNames - A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].

withAttributeNames

public ReceiveMessageRequest withAttributeNames(String... attributeNames)
A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].

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

Parameters:
attributeNames - A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].
Returns:
A reference to this updated object so that method calls can be chained together.

withAttributeNames

public ReceiveMessageRequest withAttributeNames(Collection<String> attributeNames)
A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].

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

Parameters:
attributeNames - A list of attributes that need to be returned along with each message. The set of valid attributes are [SenderId, ApproximateFirstReceiveTimestamp, ApproximateReceiveCount, SentTimestamp].
Returns:
A reference to this updated object so that method calls can be chained together.

getMaxNumberOfMessages

public Integer getMaxNumberOfMessages()
The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer.

All of the messages are not necessarily returned.

Returns:
The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer.

All of the messages are not necessarily returned.


setMaxNumberOfMessages

public void setMaxNumberOfMessages(Integer maxNumberOfMessages)
The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer.

All of the messages are not necessarily returned.

Parameters:
maxNumberOfMessages - The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer.

All of the messages are not necessarily returned.


withMaxNumberOfMessages

public ReceiveMessageRequest withMaxNumberOfMessages(Integer maxNumberOfMessages)
The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer.

All of the messages are not necessarily returned.

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

Parameters:
maxNumberOfMessages - The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer.

All of the messages are not necessarily returned.

Returns:
A reference to this updated object so that method calls can be chained together.

getVisibilityTimeout

public Integer getVisibilityTimeout()
The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.

Returns:
The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.

setVisibilityTimeout

public void setVisibilityTimeout(Integer visibilityTimeout)
The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.

Parameters:
visibilityTimeout - The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.

withVisibilityTimeout

public ReceiveMessageRequest withVisibilityTimeout(Integer visibilityTimeout)
The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.

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

Parameters:
visibilityTimeout - The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
Returns:
A reference to this updated object so that method calls can be chained together.

getWaitTimeSeconds

public Integer getWaitTimeSeconds()
The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. If a message is available, the call will return sooner than WaitTimeSeconds.

Returns:
The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. If a message is available, the call will return sooner than WaitTimeSeconds.

setWaitTimeSeconds

public void setWaitTimeSeconds(Integer waitTimeSeconds)
The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. If a message is available, the call will return sooner than WaitTimeSeconds.

Parameters:
waitTimeSeconds - The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. If a message is available, the call will return sooner than WaitTimeSeconds.

withWaitTimeSeconds

public ReceiveMessageRequest withWaitTimeSeconds(Integer waitTimeSeconds)
The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. If a message is available, the call will return sooner than WaitTimeSeconds.

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

Parameters:
waitTimeSeconds - The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. If a message is available, the call will return sooner than WaitTimeSeconds.
Returns:
A reference to this updated object so that method calls can be chained together.

toString

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

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


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