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

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

Introduction

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

Prototype

AmazonSNSClient(AwsSyncClientParams clientParams) 

Source Link

Document

Constructs a new client to invoke service methods on Amazon SNS using the specified parameters.

Usage

From source file:Servlet.WorkPool.java

License:Open Source License

/**
 * The only information needed to create a client are security credentials
 * consisting of the AWS Access Key ID and Secret Access Key. All other
 * configuration, such as the service endpoints, are performed
 * automatically. Client parameters, such as proxies, can be specified in an
 * optional ClientConfiguration object when constructing a client.
 *
 * @see com.amazonaws.auth.BasicAWSCredentials
 * @see com.amazonaws.auth.PropertiesCredentials
 * @see com.amazonaws.ClientConfiguration
 *//*from  ww  w  .  j  a  v  a 2  s  .com*/
private static void init() throws Exception {

    /*
     * The ProfileCredentialsProvider will return your [default] credential
     * profile by reading from the credentials file located at
     * (/home/zeweijiang/.aws/credentials).
     */
    AWSCredentials credentials = null;
    try {
        credentials = new ProfileCredentialsProvider("jiangzewei").getCredentials();
    } catch (Exception e) {
        throw new AmazonClientException("Cannot load the credentials from the credential profiles file. "
                + "Please make sure that your credentials file is at the correct "
                + "location (/home/zeweijiang/.aws/credentials), and is in valid format.", e);
    }
    sqs = new AmazonSQSClient(credentials);
    sns = new AmazonSNSClient(credentials);
}

From source file:shnakkydoodle.notifying.provider.aws.AwsProvider.java

License:Open Source License

/**
 * Get the SNS Client already initialised
 * //  ww  w. j av  a 2s .co  m
 * @return
 */
private AmazonSNSClient getSNSClient() {
    AmazonSNSClient snsClient = new AmazonSNSClient(this.credentials);
    snsClient.setRegion(Region.EU_Ireland.toAWSRegion());
    return snsClient;
}

From source file:ws.argo.responder.transport.AmazonSNSTransport.java

License:MIT License

private void initializeAWSClient(String ak, String sk) {
    AWSCredentials creds = new BasicAWSCredentials(ak, sk);
    setSNSClient(new AmazonSNSClient(creds));
}

From source file:ws.argo.transport.probe.standard.AmazonSNSTransport.java

License:MIT License

public AmazonSNSTransport(String ak, String sk) {
    AWSCredentials creds = new BasicAWSCredentials(ak, sk);
    snsClient = new AmazonSNSClient(creds);
}

From source file:ws.argo.transport.probe.standard.AmazonSNSTransport.java

License:MIT License

@Override
public void initialize(Properties p, String networkInterface) throws TransportConfigException {
    this.argoTopicName = p.getProperty("argoTopicName");
    this.ak = p.getProperty("amazonAccessKey");
    this.sk = p.getProperty("amazonSecretKey");

    // Gotta have all three configuration items or KABOOM.
    // Can't really have a default for any of these.
    if (this.argoTopicName == null || this.ak == null || this.sk == null)
        throw new TransportConfigException("The Topic Name, AK and/or the SK was not specified.");

    AWSCredentials creds = new BasicAWSCredentials(ak, sk);
    snsClient = new AmazonSNSClient(creds);
}