@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetQueueAttributesResult == false) return false; GetQueueAttributesResult other = (GetQueueAttributesResult) obj; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; }
// Get approximate number of the messages from queue. public static int getNumberOfMessages(AmazonSQS sqs, String url) { List<String> attr = new ArrayList<String>(); attr.add("ApproximateNumberOfMessages"); GetQueueAttributesResult res = sqs.getQueueAttributes(url, attr); return Integer.parseInt(res.getAttributes().get("ApproximateNumberOfMessages")); }