String secretKey = Constants.SECRET_KEY;
AWSCredentials credentials = new BasicAWSCredentials(accessKey,
secretKey);
// get the SNS service
AmazonSNS sns = new AmazonSNSClient(credentials);
String nextToken = null;
int subscriptions = 0;
do { // call service ListSubscriptionsByTopic
ListSubscriptionsByTopicResult result = sns
.listSubscriptionsByTopic(new ListSubscriptionsByTopicRequest(
Constants.AN_SNS_TOPIC).withNextToken(nextToken));
nextToken = result.getNextToken();
// show the subscriptions
for (Subscription subscription : result.getSubscriptions()) {