LrSqsClient.getQueueAttributes

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

public static LrSqsQueueAttributes getQueueAttributes(Collection<?> attributeNames)

Arguments

NameDescription
attributeNames The container of strings or QueueAttributeName values, listing the attributes to be retrieved.

Return values

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

General information

This API gets all of the queue attributes specified in the attributeNames parameter. The returned value is a container with key-value pairs that contain all of the requested attributes.

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();
    }