LrSqsClient.createMessageAttributeValueBinary

Creates a binary attribute value that can be assigned to a message.

public static LrSqsMessageAttributeValue createMessageAttributeValueBinary(byte[] bytes)

public static LrSqsMessageAttributeValue createMessageAttributeValueBinary(String str)

Arguments

NameDescription
bytesThe binary array value of the attribute.
str The string value to serialize.

Return values

This function returns an LrSqsMessageAttributeValue object. For details, see LrSqsMessageAttributeValue.

General information

LrSqsMessageAttributeValue can be used as a value in the key-value pairs of a message attribute.

Example

Copy code
public void sendMessageEx(){

    HashMap<String, LrSqsMessageAttributeValue> messageAttributes = new HashMap<String, LrSqsMessageAttributeValue>();
    messageAttributes.put("attrib1", LrSqsClient.createMessageAttributeValueString("my string attribute"));
    messageAttributes.put("attrib2", LrSqsClient.createMessageAttributeValueInt("1234"));
    messageAttributes.put("attrib3", LrSqsClient.createMessageAttributeValueInt(5678));
    messageAttributes.put("attrib4", LrSqsClient.createMessageAttributeValueDouble(56.78));
    messageAttributes.put("attrib5", LrSqsClient.createMessageAttributeValueBinary("string binary to bytes".getBytes()));
    messageAttributes.put("attrib6", LrSqsClient.createMessageAttributeValueBinary("string binary value"));
        
    LrSqsClient.initClient(region, standardQueueUrl);
    LrSqsClient.sendMessageEx("MessageBody1", 0, messageAttributes);

    LrSqsClient.closeClient();
  
 }