Example usage for com.amazonaws.services.sqs.model QueueAttributeName ApproximateNumberOfMessagesNotVisible

List of usage examples for com.amazonaws.services.sqs.model QueueAttributeName ApproximateNumberOfMessagesNotVisible

Introduction

In this page you can find the example usage for com.amazonaws.services.sqs.model QueueAttributeName ApproximateNumberOfMessagesNotVisible.

Prototype

QueueAttributeName ApproximateNumberOfMessagesNotVisible

To view the source code for com.amazonaws.services.sqs.model QueueAttributeName ApproximateNumberOfMessagesNotVisible.

Click Source Link

Usage

From source file:org.duracloud.common.queue.aws.SQSTaskQueue.java

License:Apache License

@Override
public Integer sizeIncludingInvisibleAndDelayed() {
    GetQueueAttributesResult result = queryQueueAttributes(QueueAttributeName.ApproximateNumberOfMessages,
            QueueAttributeName.ApproximateNumberOfMessagesNotVisible,
            QueueAttributeName.ApproximateNumberOfMessagesDelayed);
    Map<String, String> attributes = result.getAttributes();
    int size = 0;
    for (String attrKey : attributes.keySet()) {
        String value = attributes.get(attrKey);
        log.debug("retrieved attribute: {}={}", attrKey, value);
        int intValue = Integer.parseInt(value);
        size += intValue;/*w  w  w . ja va2 s  .co  m*/
    }
    log.debug("calculated size: {}", size);
    return size;
}