Example usage for com.amazonaws.services.sns AmazonSNSClient getCachedResponseMetadata

List of usage examples for com.amazonaws.services.sns AmazonSNSClient getCachedResponseMetadata

Introduction

In this page you can find the example usage for com.amazonaws.services.sns AmazonSNSClient getCachedResponseMetadata.

Prototype

public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) 

Source Link

Document

Returns additional metadata for a previously executed successful, request, typically used for debugging issues where a service isn't acting as expected.

Usage

From source file:com.dev.appx.sns.SNSMobilePush.java

License:Open Source License

public void createTopic(String topic) throws IOException {
    //create a new SNS client and set endpoint
    AmazonSNSClient snsClient = new AmazonSNSClient(new ClasspathPropertiesFileCredentialsProvider());

    /*AmazonSNS snsClient = new AmazonSNSClient(new PropertiesCredentials(
    SNSMobilePush.class// ww  w  . ja  v a 2s .co  m
          .getResourceAsStream("AwsCredentials.properties")));*/

    snsClient.setRegion(Region.getRegion(Regions.US_EAST_1));

    //create a new SNS topic
    CreateTopicRequest createTopicRequest = new CreateTopicRequest(topic);
    CreateTopicResult createTopicResult = snsClient.createTopic(createTopicRequest);
    //print TopicArn
    System.out.println(createTopicResult);
    //get request id for CreateTopicRequest from SNS metadata      
    System.out.println("CreateTopicRequest - " + snsClient.getCachedResponseMetadata(createTopicRequest));
}