Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.sqs.model.SendMessageRequest Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Amazon SQS module holds the client classes that are used for communicating with
Amazon Simple Queue
Service
/*
* Copyright 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 software.amazon.awssdk.services.sqs.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SendMessageRequest extends SqsRequest implements
ToCopyableBuilder {
private static final SdkField QUEUE_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QueueUrl").getter(getter(SendMessageRequest::queueUrl)).setter(setter(Builder::queueUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueueUrl").build()).build();
private static final SdkField MESSAGE_BODY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MessageBody").getter(getter(SendMessageRequest::messageBody)).setter(setter(Builder::messageBody))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageBody").build()).build();
private static final SdkField DELAY_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("DelaySeconds").getter(getter(SendMessageRequest::delaySeconds)).setter(setter(Builder::delaySeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DelaySeconds").build()).build();
private static final SdkField> MESSAGE_ATTRIBUTES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("MessageAttributes")
.getter(getter(SendMessageRequest::messageAttributes))
.setter(setter(Builder::messageAttributes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageAttributes").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(MessageAttributeValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).isFlattened(true).build()).build();
private static final SdkField> MESSAGE_SYSTEM_ATTRIBUTES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("MessageSystemAttributes")
.getter(getter(SendMessageRequest::messageSystemAttributesAsStrings))
.setter(setter(Builder::messageSystemAttributesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageSystemAttributes").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(MessageSystemAttributeValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).isFlattened(true).build()).build();
private static final SdkField MESSAGE_DEDUPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MessageDeduplicationId").getter(getter(SendMessageRequest::messageDeduplicationId))
.setter(setter(Builder::messageDeduplicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageDeduplicationId").build())
.build();
private static final SdkField MESSAGE_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MessageGroupId").getter(getter(SendMessageRequest::messageGroupId))
.setter(setter(Builder::messageGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageGroupId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(QUEUE_URL_FIELD,
MESSAGE_BODY_FIELD, DELAY_SECONDS_FIELD, MESSAGE_ATTRIBUTES_FIELD, MESSAGE_SYSTEM_ATTRIBUTES_FIELD,
MESSAGE_DEDUPLICATION_ID_FIELD, MESSAGE_GROUP_ID_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("QueueUrl", QUEUE_URL_FIELD);
put("MessageBody", MESSAGE_BODY_FIELD);
put("DelaySeconds", DELAY_SECONDS_FIELD);
put("MessageAttributes", MESSAGE_ATTRIBUTES_FIELD);
put("MessageSystemAttributes", MESSAGE_SYSTEM_ATTRIBUTES_FIELD);
put("MessageDeduplicationId", MESSAGE_DEDUPLICATION_ID_FIELD);
put("MessageGroupId", MESSAGE_GROUP_ID_FIELD);
}
});
private final String queueUrl;
private final String messageBody;
private final Integer delaySeconds;
private final Map messageAttributes;
private final Map messageSystemAttributes;
private final String messageDeduplicationId;
private final String messageGroupId;
private SendMessageRequest(BuilderImpl builder) {
super(builder);
this.queueUrl = builder.queueUrl;
this.messageBody = builder.messageBody;
this.delaySeconds = builder.delaySeconds;
this.messageAttributes = builder.messageAttributes;
this.messageSystemAttributes = builder.messageSystemAttributes;
this.messageDeduplicationId = builder.messageDeduplicationId;
this.messageGroupId = builder.messageGroupId;
}
/**
*
* The URL of the Amazon SQS queue to which a message is sent.
*
*
* Queue URLs and names are case-sensitive.
*
*
* @return The URL of the Amazon SQS queue to which a message is sent.
*
* Queue URLs and names are case-sensitive.
*/
public final String queueUrl() {
return queueUrl;
}
/**
*
* The message to send. The minimum size is one character. The maximum size is 256 KiB.
*
*
*
* A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed. For
* more information, see the W3C specification for characters .
*
*
* #x9
| #xA
| #xD
| #x20
to #xD7FF
|
* #xE000
to #xFFFD
| #x10000
to #x10FFFF
*
*
* Amazon SQS does not throw an exception or completely reject the message if it contains invalid characters.
* Instead, it replaces those invalid characters with U+FFFD
before storing the message in the queue,
* as long as the message body contains at least one valid character.
*
*
*
* @return The message to send. The minimum size is one character. The maximum size is 256 KiB.
*
* A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed.
* For more information, see the W3C specification for
* characters .
*
*
* #x9
| #xA
| #xD
| #x20
to #xD7FF
|
* #xE000
to #xFFFD
| #x10000
to #x10FFFF
*
*
* Amazon SQS does not throw an exception or completely reject the message if it contains invalid
* characters. Instead, it replaces those invalid characters with U+FFFD
before storing the
* message in the queue, as long as the message body contains at least one valid character.
*
*/
public final String messageBody() {
return messageBody;
}
/**
*
* The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15
* minutes. Messages with a positive DelaySeconds
value become available for processing after the delay
* period is finished. If you don't specify a value, the default value for the queue applies.
*
*
*
* When you set FifoQueue
, you can't set DelaySeconds
per message. You can set this
* parameter only on a queue level.
*
*
*
* @return The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum:
* 15 minutes. Messages with a positive DelaySeconds
value become available for processing
* after the delay period is finished. If you don't specify a value, the default value for the queue
* applies.
*
* When you set FifoQueue
, you can't set DelaySeconds
per message. You can set
* this parameter only on a queue level.
*
*/
public final Integer delaySeconds() {
return delaySeconds;
}
/**
* For responses, this returns true if the service returned a value for the MessageAttributes property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasMessageAttributes() {
return messageAttributes != null && !(messageAttributes instanceof SdkAutoConstructMap);
}
/**
*
* Each message attribute consists of a Name
, Type
, and Value
. For more
* information, see Amazon SQS message attributes in the Amazon SQS Developer Guide .
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasMessageAttributes} method.
*
*
* @return Each message attribute consists of a Name
, Type
, and Value
. For
* more information, see Amazon SQS message attributes in the Amazon SQS Developer Guide .
*/
public final Map messageAttributes() {
return messageAttributes;
}
/**
*
* The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must be
* String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasMessageSystemAttributes} method.
*
*
* @return The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must be
* String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
*/
public final Map messageSystemAttributes() {
return MessageBodySystemAttributeMapCopier.copyStringToEnum(messageSystemAttributes);
}
/**
* For responses, this returns true if the service returned a value for the MessageSystemAttributes property. This
* DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the
* property). This is useful because the SDK will never return a null collection or map, but you may need to
* differentiate between the service returning nothing (or null) and the service returning an empty collection or
* map. For requests, this returns true if a value for the property was specified in the request builder, and false
* if a value was not specified.
*/
public final boolean hasMessageSystemAttributes() {
return messageSystemAttributes != null && !(messageSystemAttributes instanceof SdkAutoConstructMap);
}
/**
*
* The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must be
* String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasMessageSystemAttributes} method.
*
*
* @return The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must be
* String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
*/
public final Map messageSystemAttributesAsStrings() {
return messageSystemAttributes;
}
/**
*
* This parameter applies only to FIFO (first-in-first-out) queues.
*
*
* The token used for deduplication of sent messages. If a message with a particular
* MessageDeduplicationId
is sent successfully, any messages sent with the same
* MessageDeduplicationId
are accepted successfully but aren't delivered during the 5-minute
* deduplication interval. For more information, see Exactly-once processing in the Amazon SQS Developer Guide .
*
*
*
*
* Every message must have a unique MessageDeduplicationId
,
*
*
*
*
* You may provide a MessageDeduplicationId
explicitly.
*
*
*
*
* If you aren't able to provide a MessageDeduplicationId
and you enable
* ContentBasedDeduplication
for your queue, Amazon SQS uses a SHA-256 hash to generate the
* MessageDeduplicationId
using the body of the message (but not the attributes of the message).
*
*
*
*
* If you don't provide a MessageDeduplicationId
and the queue doesn't have
* ContentBasedDeduplication
set, the action fails with an error.
*
*
*
*
* If the queue has ContentBasedDeduplication
set, your MessageDeduplicationId
overrides
* the generated one.
*
*
*
*
*
*
* When ContentBasedDeduplication
is in effect, messages with identical content sent within the
* deduplication interval are treated as duplicates and only one copy of the message is delivered.
*
*
*
*
* If you send one message with ContentBasedDeduplication
enabled and then another message with a
* MessageDeduplicationId
that is the same as the one generated for the first
* MessageDeduplicationId
, the two messages are treated as duplicates and only one copy of the message
* is delivered.
*
*
*
*
*
* The MessageDeduplicationId
is available to the consumer of the message (this can be useful for
* troubleshooting delivery issues).
*
*
* If a message is sent successfully but the acknowledgement is lost and the message is resent with the same
* MessageDeduplicationId
after the deduplication interval, Amazon SQS can't detect duplicate messages.
*
*
* Amazon SQS continues to keep track of the message deduplication ID even after the message is received and
* deleted.
*
*
*
* The maximum length of MessageDeduplicationId
is 128 characters. MessageDeduplicationId
* can contain alphanumeric characters (a-z
, A-Z
, 0-9
) and punctuation (
* !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
).
*
*
* For best practices of using MessageDeduplicationId
, see Using the MessageDeduplicationId Property in the Amazon SQS Developer Guide .
*
*
* @return This parameter applies only to FIFO (first-in-first-out) queues.
*
* The token used for deduplication of sent messages. If a message with a particular
* MessageDeduplicationId
is sent successfully, any messages sent with the same
* MessageDeduplicationId
are accepted successfully but aren't delivered during the 5-minute
* deduplication interval. For more information, see Exactly-once processing in the Amazon SQS Developer Guide .
*
*
*
*
* Every message must have a unique MessageDeduplicationId
,
*
*
*
*
* You may provide a MessageDeduplicationId
explicitly.
*
*
*
*
* If you aren't able to provide a MessageDeduplicationId
and you enable
* ContentBasedDeduplication
for your queue, Amazon SQS uses a SHA-256 hash to generate the
* MessageDeduplicationId
using the body of the message (but not the attributes of the
* message).
*
*
*
*
* If you don't provide a MessageDeduplicationId
and the queue doesn't have
* ContentBasedDeduplication
set, the action fails with an error.
*
*
*
*
* If the queue has ContentBasedDeduplication
set, your MessageDeduplicationId
* overrides the generated one.
*
*
*
*
*
*
* When ContentBasedDeduplication
is in effect, messages with identical content sent within the
* deduplication interval are treated as duplicates and only one copy of the message is delivered.
*
*
*
*
* If you send one message with ContentBasedDeduplication
enabled and then another message with
* a MessageDeduplicationId
that is the same as the one generated for the first
* MessageDeduplicationId
, the two messages are treated as duplicates and only one copy of the
* message is delivered.
*
*
*
*
*
* The MessageDeduplicationId
is available to the consumer of the message (this can be useful
* for troubleshooting delivery issues).
*
*
* If a message is sent successfully but the acknowledgement is lost and the message is resent with the same
* MessageDeduplicationId
after the deduplication interval, Amazon SQS can't detect duplicate
* messages.
*
*
* Amazon SQS continues to keep track of the message deduplication ID even after the message is received and
* deleted.
*
*
*
* The maximum length of MessageDeduplicationId
is 128 characters.
* MessageDeduplicationId
can contain alphanumeric characters (a-z
,
* A-Z
, 0-9
) and punctuation (
* !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
).
*
*
* For best practices of using MessageDeduplicationId
, see Using the MessageDeduplicationId Property in the Amazon SQS Developer Guide .
*/
public final String messageDeduplicationId() {
return messageDeduplicationId;
}
/**
*
* This parameter applies only to FIFO (first-in-first-out) queues.
*
*
* The tag that specifies that a message belongs to a specific message group. Messages that belong to the same
* message group are processed in a FIFO manner (however, messages in different message groups might be processed
* out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId
* values (for example, session data for multiple users). In this scenario, multiple consumers can process the
* queue, but the session data of each user is processed in a FIFO fashion.
*
*
*
*
* You must associate a non-empty MessageGroupId
with a message. If you don't provide a
* MessageGroupId
, the action fails.
*
*
*
*
* ReceiveMessage
might return messages with multiple MessageGroupId
values. For each
* MessageGroupId
, the messages are sorted by time sent. The caller can't specify a
* MessageGroupId
.
*
*
*
*
* The maximum length of MessageGroupId
is 128 characters. Valid values: alphanumeric characters and
* punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)
.
*
*
* For best practices of using MessageGroupId
, see Using the MessageGroupId Property in the Amazon SQS Developer Guide .
*
*
*
* MessageGroupId
is required for FIFO queues. You can't use it for Standard queues.
*
*
*
* @return This parameter applies only to FIFO (first-in-first-out) queues.
*
* The tag that specifies that a message belongs to a specific message group. Messages that belong to the
* same message group are processed in a FIFO manner (however, messages in different message groups might be
* processed out of order). To interleave multiple ordered streams within a single queue, use
* MessageGroupId
values (for example, session data for multiple users). In this scenario,
* multiple consumers can process the queue, but the session data of each user is processed in a FIFO
* fashion.
*
*
*
*
* You must associate a non-empty MessageGroupId
with a message. If you don't provide a
* MessageGroupId
, the action fails.
*
*
*
*
* ReceiveMessage
might return messages with multiple MessageGroupId
values. For
* each MessageGroupId
, the messages are sorted by time sent. The caller can't specify a
* MessageGroupId
.
*
*
*
*
* The maximum length of MessageGroupId
is 128 characters. Valid values: alphanumeric
* characters and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)
.
*
*
* For best practices of using MessageGroupId
, see Using the MessageGroupId Property in the Amazon SQS Developer Guide .
*
*
*
* MessageGroupId
is required for FIFO queues. You can't use it for Standard queues.
*
*/
public final String messageGroupId() {
return messageGroupId;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(queueUrl());
hashCode = 31 * hashCode + Objects.hashCode(messageBody());
hashCode = 31 * hashCode + Objects.hashCode(delaySeconds());
hashCode = 31 * hashCode + Objects.hashCode(hasMessageAttributes() ? messageAttributes() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasMessageSystemAttributes() ? messageSystemAttributesAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(messageDeduplicationId());
hashCode = 31 * hashCode + Objects.hashCode(messageGroupId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SendMessageRequest)) {
return false;
}
SendMessageRequest other = (SendMessageRequest) obj;
return Objects.equals(queueUrl(), other.queueUrl()) && Objects.equals(messageBody(), other.messageBody())
&& Objects.equals(delaySeconds(), other.delaySeconds()) && hasMessageAttributes() == other.hasMessageAttributes()
&& Objects.equals(messageAttributes(), other.messageAttributes())
&& hasMessageSystemAttributes() == other.hasMessageSystemAttributes()
&& Objects.equals(messageSystemAttributesAsStrings(), other.messageSystemAttributesAsStrings())
&& Objects.equals(messageDeduplicationId(), other.messageDeduplicationId())
&& Objects.equals(messageGroupId(), other.messageGroupId());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("SendMessageRequest").add("QueueUrl", queueUrl()).add("MessageBody", messageBody())
.add("DelaySeconds", delaySeconds())
.add("MessageAttributes", hasMessageAttributes() ? messageAttributes() : null)
.add("MessageSystemAttributes", hasMessageSystemAttributes() ? messageSystemAttributesAsStrings() : null)
.add("MessageDeduplicationId", messageDeduplicationId()).add("MessageGroupId", messageGroupId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "QueueUrl":
return Optional.ofNullable(clazz.cast(queueUrl()));
case "MessageBody":
return Optional.ofNullable(clazz.cast(messageBody()));
case "DelaySeconds":
return Optional.ofNullable(clazz.cast(delaySeconds()));
case "MessageAttributes":
return Optional.ofNullable(clazz.cast(messageAttributes()));
case "MessageSystemAttributes":
return Optional.ofNullable(clazz.cast(messageSystemAttributesAsStrings()));
case "MessageDeduplicationId":
return Optional.ofNullable(clazz.cast(messageDeduplicationId()));
case "MessageGroupId":
return Optional.ofNullable(clazz.cast(messageGroupId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function getter(Function g) {
return obj -> g.apply((SendMessageRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SqsRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The URL of the Amazon SQS queue to which a message is sent.
*
*
* Queue URLs and names are case-sensitive.
*
*
* @param queueUrl
* The URL of the Amazon SQS queue to which a message is sent.
*
* Queue URLs and names are case-sensitive.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder queueUrl(String queueUrl);
/**
*
* The message to send. The minimum size is one character. The maximum size is 256 KiB.
*
*
*
* A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed. For
* more information, see the W3C specification for
* characters .
*
*
* #x9
| #xA
| #xD
| #x20
to #xD7FF
|
* #xE000
to #xFFFD
| #x10000
to #x10FFFF
*
*
* Amazon SQS does not throw an exception or completely reject the message if it contains invalid characters.
* Instead, it replaces those invalid characters with U+FFFD
before storing the message in the
* queue, as long as the message body contains at least one valid character.
*
*
*
* @param messageBody
* The message to send. The minimum size is one character. The maximum size is 256 KiB.
*
* A message can include only XML, JSON, and unformatted text. The following Unicode characters are
* allowed. For more information, see the W3C
* specification for characters .
*
*
* #x9
| #xA
| #xD
| #x20
to #xD7FF
|
* #xE000
to #xFFFD
| #x10000
to #x10FFFF
*
*
* Amazon SQS does not throw an exception or completely reject the message if it contains invalid
* characters. Instead, it replaces those invalid characters with U+FFFD
before storing the
* message in the queue, as long as the message body contains at least one valid character.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder messageBody(String messageBody);
/**
*
* The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15
* minutes. Messages with a positive DelaySeconds
value become available for processing after the
* delay period is finished. If you don't specify a value, the default value for the queue applies.
*
*
*
* When you set FifoQueue
, you can't set DelaySeconds
per message. You can set this
* parameter only on a queue level.
*
*
*
* @param delaySeconds
* The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900.
* Maximum: 15 minutes. Messages with a positive DelaySeconds
value become available for
* processing after the delay period is finished. If you don't specify a value, the default value for the
* queue applies.
*
* When you set FifoQueue
, you can't set DelaySeconds
per message. You can set
* this parameter only on a queue level.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder delaySeconds(Integer delaySeconds);
/**
*
* Each message attribute consists of a Name
, Type
, and Value
. For more
* information, see Amazon SQS message attributes in the Amazon SQS Developer Guide .
*
*
* @param messageAttributes
* Each message attribute consists of a Name
, Type
, and Value
. For
* more information, see Amazon SQS message attributes in the Amazon SQS Developer Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder messageAttributes(Map messageAttributes);
/**
*
* The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must be
* String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
*
*
* @param messageSystemAttributes
* The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must
* be String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder messageSystemAttributesWithStrings(Map messageSystemAttributes);
/**
*
* The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must be
* String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
*
*
* @param messageSystemAttributes
* The message system attribute to send. Each message system attribute consists of a Name
,
* Type
, and Value
.
*
*
*
* Currently, the only supported message system attribute is AWSTraceHeader
. Its type must
* be String
and its value must be a correctly formatted X-Ray trace header string.
*
*
*
*
* The size of a message system attribute doesn't count towards the total size of a message.
*
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder messageSystemAttributes(
Map messageSystemAttributes);
/**
*
* This parameter applies only to FIFO (first-in-first-out) queues.
*
*
* The token used for deduplication of sent messages. If a message with a particular
* MessageDeduplicationId
is sent successfully, any messages sent with the same
* MessageDeduplicationId
are accepted successfully but aren't delivered during the 5-minute
* deduplication interval. For more information, see Exactly-once processing in the Amazon SQS Developer Guide .
*
*
*
*
* Every message must have a unique MessageDeduplicationId
,
*
*
*
*
* You may provide a MessageDeduplicationId
explicitly.
*
*
*
*
* If you aren't able to provide a MessageDeduplicationId
and you enable
* ContentBasedDeduplication
for your queue, Amazon SQS uses a SHA-256 hash to generate the
* MessageDeduplicationId
using the body of the message (but not the attributes of the message).
*
*
*
*
* If you don't provide a MessageDeduplicationId
and the queue doesn't have
* ContentBasedDeduplication
set, the action fails with an error.
*
*
*
*
* If the queue has ContentBasedDeduplication
set, your MessageDeduplicationId
* overrides the generated one.
*
*
*
*
*
*
* When ContentBasedDeduplication
is in effect, messages with identical content sent within the
* deduplication interval are treated as duplicates and only one copy of the message is delivered.
*
*
*
*
* If you send one message with ContentBasedDeduplication
enabled and then another message with a
* MessageDeduplicationId
that is the same as the one generated for the first
* MessageDeduplicationId
, the two messages are treated as duplicates and only one copy of the
* message is delivered.
*
*
*
*
*
* The MessageDeduplicationId
is available to the consumer of the message (this can be useful for
* troubleshooting delivery issues).
*
*
* If a message is sent successfully but the acknowledgement is lost and the message is resent with the same
* MessageDeduplicationId
after the deduplication interval, Amazon SQS can't detect duplicate
* messages.
*
*
* Amazon SQS continues to keep track of the message deduplication ID even after the message is received and
* deleted.
*
*
*
* The maximum length of MessageDeduplicationId
is 128 characters.
* MessageDeduplicationId
can contain alphanumeric characters (a-z
, A-Z
,
* 0-9
) and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
).
*
*
* For best practices of using MessageDeduplicationId
, see Using the MessageDeduplicationId Property in the Amazon SQS Developer Guide .
*
*
* @param messageDeduplicationId
* This parameter applies only to FIFO (first-in-first-out) queues.
*
* The token used for deduplication of sent messages. If a message with a particular
* MessageDeduplicationId
is sent successfully, any messages sent with the same
* MessageDeduplicationId
are accepted successfully but aren't delivered during the 5-minute
* deduplication interval. For more information, see Exactly-once processing in the Amazon SQS Developer Guide .
*
*
*
*
* Every message must have a unique MessageDeduplicationId
,
*
*
*
*
* You may provide a MessageDeduplicationId
explicitly.
*
*
*
*
* If you aren't able to provide a MessageDeduplicationId
and you enable
* ContentBasedDeduplication
for your queue, Amazon SQS uses a SHA-256 hash to generate the
* MessageDeduplicationId
using the body of the message (but not the attributes of the
* message).
*
*
*
*
* If you don't provide a MessageDeduplicationId
and the queue doesn't have
* ContentBasedDeduplication
set, the action fails with an error.
*
*
*
*
* If the queue has ContentBasedDeduplication
set, your MessageDeduplicationId
* overrides the generated one.
*
*
*
*
*
*
* When ContentBasedDeduplication
is in effect, messages with identical content sent within
* the deduplication interval are treated as duplicates and only one copy of the message is delivered.
*
*
*
*
* If you send one message with ContentBasedDeduplication
enabled and then another message
* with a MessageDeduplicationId
that is the same as the one generated for the first
* MessageDeduplicationId
, the two messages are treated as duplicates and only one copy of
* the message is delivered.
*
*
*
*
*
* The MessageDeduplicationId
is available to the consumer of the message (this can be
* useful for troubleshooting delivery issues).
*
*
* If a message is sent successfully but the acknowledgement is lost and the message is resent with the
* same MessageDeduplicationId
after the deduplication interval, Amazon SQS can't detect
* duplicate messages.
*
*
* Amazon SQS continues to keep track of the message deduplication ID even after the message is received
* and deleted.
*
*
*
* The maximum length of MessageDeduplicationId
is 128 characters.
* MessageDeduplicationId
can contain alphanumeric characters (a-z
,
* A-Z
, 0-9
) and punctuation (
* !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
).
*
*
* For best practices of using MessageDeduplicationId
, see Using the MessageDeduplicationId Property in the Amazon SQS Developer Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder messageDeduplicationId(String messageDeduplicationId);
/**
*
* This parameter applies only to FIFO (first-in-first-out) queues.
*
*
* The tag that specifies that a message belongs to a specific message group. Messages that belong to the same
* message group are processed in a FIFO manner (however, messages in different message groups might be
* processed out of order). To interleave multiple ordered streams within a single queue, use
* MessageGroupId
values (for example, session data for multiple users). In this scenario, multiple
* consumers can process the queue, but the session data of each user is processed in a FIFO fashion.
*
*
*
*
* You must associate a non-empty MessageGroupId
with a message. If you don't provide a
* MessageGroupId
, the action fails.
*
*
*
*
* ReceiveMessage
might return messages with multiple MessageGroupId
values. For each
* MessageGroupId
, the messages are sorted by time sent. The caller can't specify a
* MessageGroupId
.
*
*
*
*
* The maximum length of MessageGroupId
is 128 characters. Valid values: alphanumeric characters
* and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)
.
*
*
* For best practices of using MessageGroupId
, see Using the MessageGroupId Property in the Amazon SQS Developer Guide .
*
*
*
* MessageGroupId
is required for FIFO queues. You can't use it for Standard queues.
*
*
*
* @param messageGroupId
* This parameter applies only to FIFO (first-in-first-out) queues.
*
* The tag that specifies that a message belongs to a specific message group. Messages that belong to the
* same message group are processed in a FIFO manner (however, messages in different message groups might
* be processed out of order). To interleave multiple ordered streams within a single queue, use
* MessageGroupId
values (for example, session data for multiple users). In this scenario,
* multiple consumers can process the queue, but the session data of each user is processed in a FIFO
* fashion.
*
*
*
*
* You must associate a non-empty MessageGroupId
with a message. If you don't provide a
* MessageGroupId
, the action fails.
*
*
*
*
* ReceiveMessage
might return messages with multiple MessageGroupId
values.
* For each MessageGroupId
, the messages are sorted by time sent. The caller can't specify a
* MessageGroupId
.
*
*
*
*
* The maximum length of MessageGroupId
is 128 characters. Valid values: alphanumeric
* characters and punctuation (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~)
.
*
*
* For best practices of using MessageGroupId
, see Using the MessageGroupId Property in the Amazon SQS Developer Guide .
*
*
*
* MessageGroupId
is required for FIFO queues. You can't use it for Standard queues.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder messageGroupId(String messageGroupId);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends SqsRequest.BuilderImpl implements Builder {
private String queueUrl;
private String messageBody;
private Integer delaySeconds;
private Map messageAttributes = DefaultSdkAutoConstructMap.getInstance();
private Map messageSystemAttributes = DefaultSdkAutoConstructMap.getInstance();
private String messageDeduplicationId;
private String messageGroupId;
private BuilderImpl() {
}
private BuilderImpl(SendMessageRequest model) {
super(model);
queueUrl(model.queueUrl);
messageBody(model.messageBody);
delaySeconds(model.delaySeconds);
messageAttributes(model.messageAttributes);
messageSystemAttributesWithStrings(model.messageSystemAttributes);
messageDeduplicationId(model.messageDeduplicationId);
messageGroupId(model.messageGroupId);
}
public final String getQueueUrl() {
return queueUrl;
}
public final void setQueueUrl(String queueUrl) {
this.queueUrl = queueUrl;
}
@Override
public final Builder queueUrl(String queueUrl) {
this.queueUrl = queueUrl;
return this;
}
public final String getMessageBody() {
return messageBody;
}
public final void setMessageBody(String messageBody) {
this.messageBody = messageBody;
}
@Override
public final Builder messageBody(String messageBody) {
this.messageBody = messageBody;
return this;
}
public final Integer getDelaySeconds() {
return delaySeconds;
}
public final void setDelaySeconds(Integer delaySeconds) {
this.delaySeconds = delaySeconds;
}
@Override
public final Builder delaySeconds(Integer delaySeconds) {
this.delaySeconds = delaySeconds;
return this;
}
public final Map getMessageAttributes() {
Map result = MessageBodyAttributeMapCopier
.copyToBuilder(this.messageAttributes);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setMessageAttributes(Map messageAttributes) {
this.messageAttributes = MessageBodyAttributeMapCopier.copyFromBuilder(messageAttributes);
}
@Override
public final Builder messageAttributes(Map messageAttributes) {
this.messageAttributes = MessageBodyAttributeMapCopier.copy(messageAttributes);
return this;
}
public final Map getMessageSystemAttributes() {
Map result = MessageBodySystemAttributeMapCopier
.copyToBuilder(this.messageSystemAttributes);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setMessageSystemAttributes(Map messageSystemAttributes) {
this.messageSystemAttributes = MessageBodySystemAttributeMapCopier.copyFromBuilder(messageSystemAttributes);
}
@Override
public final Builder messageSystemAttributesWithStrings(Map messageSystemAttributes) {
this.messageSystemAttributes = MessageBodySystemAttributeMapCopier.copy(messageSystemAttributes);
return this;
}
@Override
public final Builder messageSystemAttributes(
Map messageSystemAttributes) {
this.messageSystemAttributes = MessageBodySystemAttributeMapCopier.copyEnumToString(messageSystemAttributes);
return this;
}
public final String getMessageDeduplicationId() {
return messageDeduplicationId;
}
public final void setMessageDeduplicationId(String messageDeduplicationId) {
this.messageDeduplicationId = messageDeduplicationId;
}
@Override
public final Builder messageDeduplicationId(String messageDeduplicationId) {
this.messageDeduplicationId = messageDeduplicationId;
return this;
}
public final String getMessageGroupId() {
return messageGroupId;
}
public final void setMessageGroupId(String messageGroupId) {
this.messageGroupId = messageGroupId;
}
@Override
public final Builder messageGroupId(String messageGroupId) {
this.messageGroupId = messageGroupId;
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public SendMessageRequest build() {
return new SendMessageRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}