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

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

Introduction

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

Prototype

QueueAttributeName ApproximateNumberOfMessagesDelayed

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

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;// ww w. j  a  v  a 2 s  . com
    }
    log.debug("calculated size: {}", size);
    return size;
}