Skip to main content

TSQSMessageAttributeValue

Class in AWS.SQS

SQS MessageAttributeValue class.

Ancestors

Properties

DataType

property DataType: string

BinaryListValues

property BinaryListValues: TList<TBytes>

BinaryValue

property BinaryValue: TBytes

StringListValues

property StringListValues: TList<string>

StringValue

property StringValue: string

Constructors

Create

constructor Create; overload;

Creates a new empty message attribute value.

This default constructor creates an uninitialized message attribute value. You must set the appropriate data type and value properties after construction. Consider using the static factory methods (WithStringValue, WithBinaryValue, etc.) for type-safe construction with automatic data type configuration.


constructor Create(const AValue: string; const ADataType: string = 'String'); overload;

Creates a new message attribute value with a string value and specified data type.

This constructor supports both basic string types (String, Number) and custom string types (e.g., String.JSON, Number.int). For Number data types, the string value must represent a valid numeric value (integer, floating-point, or scientific notation). Custom data types should follow the format BaseType.CustomLabel where BaseType is String or Number.

Parameters

NameDescription
AValueThe string value to be stored in the message attribute.
ADataTypeThe data type for the message attribute. Defaults to.

constructor Create(const AValues: TArray<string>; const ADataType: string = 'StringList'); overload;

Creates a new message attribute value with multiple string values and specified data type.

This constructor provides future support for string list attributes, which are not currently supported by Amazon SQS but may be available in future service updates. The total size of all string values combined should not exceed 1,024 KB when service support is available. Each string value can contain any valid Unicode characters. Currently, consider using the single string constructor with JSON encoding or delimited values as a workaround for multiple string values.

Parameters

NameDescription
AValuesAn array of string values to be stored in the message attribute.
ADataTypeThe data type for the message attribute. Defaults to.

constructor Create(const AValue: TBytes; const ADataType: string = 'Binary'); overload;

Creates a new message attribute value with binary data and specified data type.

This constructor supports both basic binary type (Binary) and custom binary types (e.g., Binary.jpeg, Binary.gzip). Binary values can contain any binary data including images, serialized objects, encrypted data, or compressed content. Maximum size is 1,024 KB. Amazon SQS automatically handles Base64 encoding/decoding during message transmission. Custom data types help identify the format for appropriate consumer processing.

Parameters

NameDescription
AValueThe binary data to be stored in the message attribute.
ADataTypeThe data type for the message attribute. Defaults to.

constructor Create(const AValues: TArray<TBytes>; const ADataType: string = 'BinaryList'); overload;

Creates a new message attribute value with multiple binary values and specified data type.

This constructor provides future support for binary list attributes, which are not currently supported by Amazon SQS but may be available in future service updates. When supported, this will be useful for scenarios where you need to send multiple related binary objects as part of a single message attribute. The total size of all binary values combined should not exceed 1,024 KB when service support is available. Each individual binary value would be Base64-encoded independently during transmission. Currently, consider concatenating binary values with appropriate delimiters or using a container format as a workaround for multiple binary values.

Parameters

NameDescription
AValuesAn array of binary data to be stored in the message attribute.
ADataTypeThe data type for the message attribute. Defaults to.

Methods

WithStringValue

class function WithStringValue(const AValue: string): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value with a string data type.

String values can contain any valid Unicode characters and have a maximum length of 1,024 KB. The returned object has DataType set to String and StringValue populated.

Parameters

NameDescription
AValueThe string value to be stored in the message attribute.

Returns

A message attribute value configured withdata type and the specified value.

WithNumberValue

class function WithNumberValue(const AValue: string): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value with a number data type.

Number values must be valid numeric representations including integers, floating-point numbers, or scientific notation. The value is stored as a string but interpreted as numeric data. The returned object has DataType set to Number and StringValue populated with the numeric string representation.

Parameters

NameDescription
AValueThe numeric value represented as a string to be stored in the message attribute.

Returns

A message attribute value configured withdata type and the specified value.

WithBinaryValue

class function WithBinaryValue(const ABytes: TBytes): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value with a binary data type.

Binary values can contain any binary data including images, serialized objects, encrypted data, or compressed content. Maximum size is 1,024 KB. Amazon SQS automatically handles Base64 encoding/decoding during message transmission. The returned object has DataType set to Binary and BinaryValue populated.

Parameters

NameDescription
ABytesThe binary data to be stored in the message attribute.

Returns

A message attribute value configured withdata type and the specified binary data.

WithStringListValues

class function WithStringListValues(const AValues: TArray<string>): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value containing multiple string values.

This method is useful for scenarios such as lists of tags, categories, identifiers, or collections of related text values. The total size of all string values combined cannot exceed 1,024 KB. The returned object has DataType set to String and StringListValues populated.

Parameters

NameDescription
AValuesAn array of string values to be stored in the message attribute.

Returns

A message attribute value configured withdata type and multiple string values.

WithBinaryListValues

class function WithBinaryListValues(const AValues: TArray<TBytes>): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value containing multiple binary values.

This method is useful for scenarios where you need to send multiple related binary objects as part of a single message attribute. The total size of all binary values combined cannot exceed 1,024 KB. Each individual binary value is Base64-encoded independently during transmission. The returned object has DataType set to Binary and BinaryListValues populated.

Parameters

NameDescription
AValuesAn array of binary data to be stored in the message attribute.

Returns

A message attribute value configured withdata type and multiple binary values.

WithCustomStringValue

class function WithCustomStringValue(const AValue: string; const ACustomType: string): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value with a custom string data type.

Custom type labels allow you to provide additional semantic information about the data format, helping consumers understand how to process the attribute value appropriately. Example custom types: JSON, XML, CSV, HTML. The returned object has DataType set to String.{ACustomType} and StringValue populated.

Parameters

NameDescription
AValueThe string value to be stored in the message attribute.
ACustomTypeThe custom type label to provide additional semantic information about the data format.

Returns

A message attribute value configured with custom string data type and the specified value.

WithCustomNumberValue

class function WithCustomNumberValue(const AValue: string; const ACustomType: string): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value with a custom number data type.

Custom numeric types help specify the intended interpretation of the numeric value, such as integer types, precision requirements, or units of measurement. Example custom types: int, float, currency, timestamp. The returned object has DataType set to Number.{ACustomType} and StringValue populated.

Parameters

NameDescription
AValueThe numeric value represented as a string to be stored in the message attribute.
ACustomTypeThe custom type label to provide additional semantic information about the numeric format.

Returns

A message attribute value configured with custom number data type and the specified value.

WithCustomBinaryValue

class function WithCustomBinaryValue(const ABytes: TBytes; const ACustomType: string): TSQSMessageAttributeValue; static;

TSQSMessageAttributeValue

Creates a new message attribute value with a custom binary data type.

Custom binary types help identify the format and intended processing of binary content, enabling consumers to handle the data appropriately. Example custom types: jpeg, pdf, gzip, protobuf. The returned object has DataType set to Binary.{ACustomType} and BinaryValue populated.

Parameters

NameDescription
ABytesThe binary data to be stored in the message attribute.
ACustomTypeThe custom type label to specify the binary data format or content type.

Returns

A message attribute value configured with custom binary data type and the specified binary data.