Package com.amazonaws.services.sns

Examples of com.amazonaws.services.sns.AmazonSNSClient


    public synchronized void confirmSubscription(SnsRequest snsRequest) {
        List<SnsTopic> snsTopics = snsTopicRepository.findByTopicArn(snsRequest.getTopicArn());
        for (SnsTopic snsTopic : snsTopics) {
            MDCBuilder.buildMdcContext(snsTopic.getCredential());
            if (!snsTopic.isConfirmed()) {
                AmazonSNSClient amazonSNSClient = awsStackUtil.createSnsClient(snsTopic.getRegion(), snsTopic.getCredential());
                ConfirmSubscriptionResult result = amazonSNSClient.confirmSubscription(snsTopic.getTopicArn(), snsRequest.getToken());
                LOGGER.info("Subscription to Amazon SNS topic confirmed. [topic ARN: '{}', subscription ARN: '{}', credential: '{}']",
                        snsRequest.getTopicArn(), result.getSubscriptionArn(), snsTopic.getCredential().getId());
                snsTopic.setConfirmed(true);
                snsTopicRepository.save(snsTopic);
                notifyRequestedStacks(snsTopic);
View Full Code Here


                            snsTopic.getTopicArn())));
        }
    }

    public void subscribeToTopic(AwsCredential awsCredential, Regions region, String topicArn) {
        AmazonSNSClient amazonSNSClient = awsStackUtil.createSnsClient(region, awsCredential);
        subscribeToTopic(amazonSNSClient, topicArn);
    }
View Full Code Here

    public AmazonSNSClient createSnsClient(Regions region, AwsCredential credential) {
        MDCBuilder.buildMdcContext(credential);
        BasicSessionCredentials basicSessionCredentials = credentialsProvider
                .retrieveSessionCredentials(CrossAccountCredentialsProvider.DEFAULT_SESSION_CREDENTIALS_DURATION,
                        CrossAccountCredentialsProvider.DEFAULT_EXTERNAL_ID, credential);
        AmazonSNSClient amazonSNSClient = new AmazonSNSClient(basicSessionCredentials);
        amazonSNSClient.setRegion(Region.getRegion(region));
        LOGGER.info("Amazon SNS client successfully created.");
        return amazonSNSClient;
    }
View Full Code Here

    Assert.isTrue(snsTestProxy != null || awsCredentialsProvider != null,
        "Either snsTestProxy or awsCredentialsProvider needs to be provided");

    if (snsTestProxy == null) {
      client = new AmazonSNSClient(awsCredentialsProvider);
      if (regionId != null) {
        client.setEndpoint(String.format("sns.%s.amazonaws.com",
            regionId));
      }
      createTopicIfNotExists();
View Full Code Here

    private static final Log log = LogFactory.getLog(JobStatusMonitor.class);

    public JobStatusMonitor(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration) {
        sqs = new AmazonSQSClient(credentialsProvider, clientConfiguration);
        sns = new AmazonSNSClient(credentialsProvider, clientConfiguration);
        setupQueueAndTopic();
    }
View Full Code Here

        // prepare the credentials
        String accessKey = Constants.ACCESS_KEY;
        String secretKey = Constants.SECRET_KEY;

        // create the SNS service
        AmazonSNS snsService = new AmazonSNSClient(
            new BasicAWSCredentials(accessKey, secretKey));

        // XXX SET TO THE PREFERRED REGION
        // set the endpoint for us-east-1 region
        snsService.setEndpoint("https://sns.us-east-1.amazonaws.com");

        new SNSExamples().run(snsService);
   
    }
View Full Code Here

        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()) {
View Full Code Here

    private static final Log log = LogFactory.getLog(JobStatusMonitor.class);

  public JobStatusMonitor(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration) {
    sqs = new AmazonSQSClient(credentialsProvider, clientConfiguration);
    sns = new AmazonSNSClient(credentialsProvider, clientConfiguration);
    setupQueueAndTopic();
  }
View Full Code Here

    private static final Log log = LogFactory.getLog(JobStatusMonitor.class);

    public JobStatusMonitor(AWSCredentialsProvider credentialsProvider, ClientConfiguration clientConfiguration) {
        sqs = new AmazonSQSClient(credentialsProvider, clientConfiguration);
        sns = new AmazonSNSClient(credentialsProvider, clientConfiguration);
        setupQueueAndTopic();
    }
View Full Code Here

                Endpoints notificationEP = new Endpoints(
                    locationChoice);

                AmazonSQSClient dlSQS = new AmazonSQSClient(
                    dlCredentials);
                AmazonSNSClient dlSNS = new AmazonSNSClient(
                    dlCredentials);

                dlSQS.setEndpoint(notificationEP.sqsEndpoint());
                dlSNS.setEndpoint(notificationEP.snsEndpoint());

                // ArchiveTransferManager atm = new
                // ArchiveTransferManager(dlClient,
                // dlCredentials);
                ArchiveTransferManager atm = new ArchiveTransferManager(
View Full Code Here

TOP

Related Classes of com.amazonaws.services.sns.AmazonSNSClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.