LrSqsClient.setQueueAttributes

Sets the specified attributes for the LrSqsClient's current queue.

public static void setQueueAttributes(Map<?, String> attributes)

Arguments

NameDescription
AttributesThe container of strings or QueueAttributeName values, listing the attributes to be set.

Return values

This function does not return any values.

General information

This API sets all of the queue attributes specified in the Attributes parameter.

Example

Copy code
public void checkAttributes(){
        
        LrSqsClient.initClient(region, fifoQueueUrl);
        Map<String, String> initialQueueAttributes = LrSqsClient.getQueueAttributes(new ArrayList()
        {{
              add("ContentBasedDeduplication");
              add("FifoThroughputLimit");
              add("DeduplicationScope");
         }}).attributesAsStrings();
        
        boolean contentBasedDeduplication = initialQueueAttributes.get("ContentBasedDeduplication") == "true";
        String fifoThroughputLimit = initialQueueAttributes.get("FifoThroughputLimit");
        String deduplicationScope = initialQueueAttributes.get("DeduplicationScope");
            
        HashMap<String, String> newAttributeValues = new HashMap()
        {{
            put("ContentBasedDeduplication", !contentBasedDeduplication ? "true" : "false");
            put("FifoThroughputLimit", fifoThroughputLimit.equals("perQueue") ? "perMessageGroupId" : "perQueue");
            put("DeduplicationScope", deduplicationScope.equals("messageGroup") ? "queue" : "messageGroup");
                
        }};    
        LrSqsClient.setQueueAttributes(newAttributeValues);
            
        LrSqsClient.setQueueAttributes(initialQueueAttributes);
        LrSqsClient.closeClient();
    }