Class ReceiveMessageRequest

java.lang.Object
com.amazonaws.AmazonWebServiceRequest
com.amazonaws.services.sqs.model.ReceiveMessageRequest
All Implemented Interfaces:
ReadLimitInfo, Serializable, Cloneable

public class ReceiveMessageRequest extends AmazonWebServiceRequest implements Serializable, Cloneable

See Also:
  • Constructor Details

    • ReceiveMessageRequest

      public ReceiveMessageRequest()
      Default constructor for ReceiveMessageRequest object. Callers should use the setter or fluent setter (with...) methods to initialize the 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 Amazon SQS queue to take action on.

      Queue URLs are case-sensitive.

  • Method Details

    • setQueueUrl

      public void setQueueUrl(String queueUrl)

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

      Queue URLs are case-sensitive.

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

      Queue URLs are case-sensitive.

    • getQueueUrl

      public String getQueueUrl()

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

      Queue URLs are case-sensitive.

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

      Queue URLs are case-sensitive.

    • withQueueUrl

      public ReceiveMessageRequest withQueueUrl(String queueUrl)

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

      Queue URLs are case-sensitive.

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

      Queue URLs are case-sensitive.

      Returns:
      Returns a reference to this 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. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      Returns:
      A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      See Also:
    • setAttributeNames

      public void setAttributeNames(Collection<String> attributeNames)

      A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      Parameters:
      attributeNames - A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      See Also:
    • withAttributeNames

      public ReceiveMessageRequest withAttributeNames(String... attributeNames)

      A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      NOTE: This method appends the values to the existing list (if any). Use setAttributeNames(java.util.Collection) or withAttributeNames(java.util.Collection) if you want to override the existing values.

      Parameters:
      attributeNames - A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • withAttributeNames

      public ReceiveMessageRequest withAttributeNames(Collection<String> attributeNames)

      A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      Parameters:
      attributeNames - A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • withAttributeNames

      public ReceiveMessageRequest withAttributeNames(QueueAttributeName... attributeNames)

      A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      Parameters:
      attributeNames - A list of attributes that need to be returned along with each message. These attributes include:

      • All - returns all values.

      • ApproximateFirstReceiveTimestamp - returns the time when the message was first received from the queue (epoch time in milliseconds).

      • ApproximateReceiveCount - returns the number of times a message has been received from the queue but not deleted.

      • SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

      • SentTimestamp - returns the time when the message was sent to the queue (epoch time in milliseconds).

      Any other valid special request parameters that are specified (such as ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, DelaySeconds, LastModifiedTimestamp, MaximumMessageSize, MessageRetentionPeriod, Policy, QueueArn, ReceiveMessageWaitTimeSeconds, RedrivePolicy, and VisibilityTimeout) will be ignored.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • getMessageAttributeNames

      public List<String> getMessageAttributeNames()

      The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

      Returns:
      The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

    • setMessageAttributeNames

      public void setMessageAttributeNames(Collection<String> messageAttributeNames)

      The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

      Parameters:
      messageAttributeNames - The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

    • withMessageAttributeNames

      public ReceiveMessageRequest withMessageAttributeNames(String... messageAttributeNames)

      The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

      NOTE: This method appends the values to the existing list (if any). Use setMessageAttributeNames(java.util.Collection) or withMessageAttributeNames(java.util.Collection) if you want to override the existing values.

      Parameters:
      messageAttributeNames - The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

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

      public ReceiveMessageRequest withMessageAttributeNames(Collection<String> messageAttributeNames)

      The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

      Parameters:
      messageAttributeNames - The name of the message attribute, where N is the index. The message attribute name can contain the following characters: A-Z, a-z, 0-9, underscore (_), hyphen (-), and period (.). The name must not start or end with a period, and it should not have successive periods. The name is case sensitive and must be unique among all attribute names for the message. The name can be up to 256 characters long. The name cannot start with "AWS." or "Amazon." (or any variations in casing), because these prefixes are reserved for use by Amazon Web Services.

      When using ReceiveMessage, you can send a list of attribute names to receive, or you can return all of the attributes by specifying "All" or ".*" in your request. You can also use "bar.*" to return all message attributes starting with the "bar" prefix.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • 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. Values can be from 1 to 10. Default is 1.

      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. Values can be from 1 to 10. Default is 1.

      All of the messages are not necessarily returned.

    • getMaxNumberOfMessages

      public Integer getMaxNumberOfMessages()

      The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer. Values can be from 1 to 10. Default is 1.

      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. Values can be from 1 to 10. Default is 1.

      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. Values can be from 1 to 10. Default is 1.

      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. Values can be from 1 to 10. Default is 1.

      All of the messages are not necessarily returned.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • 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.
    • 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.
    • 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.

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

      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:
      Returns a reference to this 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:
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public ReceiveMessageRequest clone()
      Description copied from class: AmazonWebServiceRequest
      Creates a shallow clone of this request. Explicitly does not clone the deep structure of the request object.
      Overrides:
      clone in class AmazonWebServiceRequest
      See Also: