Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.sqs.model;
 
 
Container for the parameters to the SendMessage operation.

Delivers a message to the specified queue. With Amazon SQS, you now have the ability to send large payload messages that are up to 256KB (262,144 bytes) in size. To send large payloads, you must use an AWS SDK that supports SigV4 signing. To verify whether SigV4 is supported for an AWS SDK, check the SDK release notes.

IMPORTANT: The following list shows the characters (in Unicode) allowed in your message, according to the W3C XML specification. For more information, go to http://www.w3.org/TR/REC-xml/#charsets If you send any characters not included in the list, your request will be rejected. #x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF]

 
 public class SendMessageRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The URL of the Amazon SQS queue to take action on.
 
     private String queueUrl;

    
The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.
 
     private String messageBody;

    
The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.
 
     private Integer delaySeconds;

    
Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.
 
Default constructor for a new SendMessageRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public SendMessageRequest() {}
    
    
Constructs a new SendMessageRequest 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.
messageBody The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.
 
     public SendMessageRequest(String queueUrlString messageBody) {
         setQueueUrl(queueUrl);
         setMessageBody(messageBody);
     }

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

Returns:
The URL of the Amazon SQS queue to take action on.
 
     public String getQueueUrl() {
         return ;
     }
    
    
The URL of the Amazon SQS queue to take action on.

Parameters:
queueUrl The URL of the Amazon SQS queue to take action on.
    public void setQueueUrl(String queueUrl) {
        this. = 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.
    public SendMessageRequest withQueueUrl(String queueUrl) {
        this. = queueUrl;
        return this;
    }

    
The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.

Returns:
The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.
    public String getMessageBody() {
        return ;
    }
    
    
The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.

Parameters:
messageBody The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.
    public void setMessageBody(String messageBody) {
        this. = messageBody;
    }
    
    
The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.

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

Parameters:
messageBody The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.
Returns:
A reference to this updated object so that method calls can be chained together.
    public SendMessageRequest withMessageBody(String messageBody) {
        this. = messageBody;
        return this;
    }

    
The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.

Returns:
The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.
    public Integer getDelaySeconds() {
        return ;
    }
    
    
The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.

Parameters:
delaySeconds The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.
    public void setDelaySeconds(Integer delaySeconds) {
        this. = delaySeconds;
    }
    
    
The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.

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

Parameters:
delaySeconds The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.
Returns:
A reference to this updated object so that method calls can be chained together.
    public SendMessageRequest withDelaySeconds(Integer delaySeconds) {
        this. = delaySeconds;
        return this;
    }

    
Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.

Returns:
Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.
        
        if ( == null) {
             = new java.util.HashMap<String,MessageAttributeValue>();
        }
        return ;
    }
    
    
Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.

Parameters:
messageAttributes Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.
    public void setMessageAttributes(java.util.Map<String,MessageAttributeValuemessageAttributes) {
        this. = messageAttributes;
    }
    
    
Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.

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

Parameters:
messageAttributes Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.
Returns:
A reference to this updated object so that method calls can be chained together.
        setMessageAttributes(messageAttributes);
        return this;
    }

    
Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.

The method adds a new key-value pair into MessageAttributes parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into MessageAttributes.
value The corresponding value of the entry to be added into MessageAttributes.
    if (null == this.) {
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into MessageAttributes.

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

    this. = null;
    return this;
  }
  
    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getQueueUrl() != nullsb.append("QueueUrl: " + getQueueUrl() + ",");
        if (getMessageBody() != nullsb.append("MessageBody: " + getMessageBody() + ",");
        if (getDelaySeconds() != nullsb.append("DelaySeconds: " + getDelaySeconds() + ",");
        if (getMessageAttributes() != nullsb.append("MessageAttributes: " + getMessageAttributes() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getQueueUrl() == null) ? 0 : getQueueUrl().hashCode()); 
        hashCode = prime * hashCode + ((getMessageBody() == null) ? 0 : getMessageBody().hashCode()); 
        hashCode = prime * hashCode + ((getDelaySeconds() == null) ? 0 : getDelaySeconds().hashCode()); 
        hashCode = prime * hashCode + ((getMessageAttributes() == null) ? 0 : getMessageAttributes().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof SendMessageRequest == falsereturn false;
        SendMessageRequest other = (SendMessageRequest)obj;
        
        if (other.getQueueUrl() == null ^ this.getQueueUrl() == nullreturn false;
        if (other.getQueueUrl() != null && other.getQueueUrl().equals(this.getQueueUrl()) == falsereturn false
        if (other.getMessageBody() == null ^ this.getMessageBody() == nullreturn false;
        if (other.getMessageBody() != null && other.getMessageBody().equals(this.getMessageBody()) == falsereturn false
        if (other.getDelaySeconds() == null ^ this.getDelaySeconds() == nullreturn false;
        if (other.getDelaySeconds() != null && other.getDelaySeconds().equals(this.getDelaySeconds()) == falsereturn false
        if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == nullreturn false;
        if (other.getMessageAttributes() != null && other.getMessageAttributes().equals(this.getMessageAttributes()) == falsereturn false
        return true;
    }
    
    @Override
    public SendMessageRequest clone() {
        
            return (SendMessageRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X