Java 类com.amazonaws.services.sns.AmazonSNSAsyncClient 实例源码

项目:adeptj-modules    文件:AwsSnsService.java   
@Activate
protected void start(SmsConfig smsConfig) {
    this.smsAttributes = new HashMap<>();
    this.smsAttributes.put("AWS.SNS.SMS.SenderID", new MessageAttributeValue()
            .withStringValue(smsConfig.senderId())
            .withDataType("String"));
    this.smsAttributes.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue()
            .withStringValue(smsConfig.smsType())
            .withDataType("String"));
    try {
        this.asyncSNS = AmazonSNSAsyncClient.asyncBuilder()
                .withEndpointConfiguration(AwsUtil.getEndpointConfig(smsConfig.serviceEndpoint(),
                        smsConfig.signingRegion()))
                .withCredentials(AwsUtil.getCredentialsProvider(smsConfig.accessKey(), smsConfig.secretKey()))
                .build();
    } catch (Exception ex) {
        LOGGER.error("Exception while starting SmsService!!", ex);
        throw new AwsException(ex.getMessage(), ex);
    }
}
项目:circus-train    文件:SnsListener.java   
SnsListener(AmazonSNSAsyncClient sns, ListenerConfig config, Clock clock) {
  this.clock = clock;
  LOG.info("Starting listener, topics: start={}, success={}, fail={}", config.getStartTopic(),
      config.getSuccessTopic(), config.getFailTopic());
  this.sns = sns;
  this.config = config;
  ObjectMapper mapper = new ObjectMapper();
  mapper.setSerializationInclusion(Include.NON_NULL);
  startWriter = mapper.writer();
}
项目:circus-train    文件:SnsConfiguration.java   
@Bean
AmazonSNSAsyncClient amazonSNS(ListenerConfig config, AWSCredentialsProvider awsCredentialsProvider) {
  AmazonSNSAsyncClient client = new AmazonSNSAsyncClient(awsCredentialsProvider,
      new ClientConfiguration().withRetryPolicy(PredefinedRetryPolicies.getDefaultRetryPolicy()),
      Executors.newSingleThreadScheduledExecutor());
  client.setRegion(Region.getRegion(Regions.fromName(config.getRegion())));
  return client;
}
项目:metacat    文件:SNSNotificationsConfig.java   
/**
 * If SNS notifications are desired and no existing client has been created elsewhere
 * in the application create a default client here.
 * @param config       The system configuration abstraction to use
 * @param registry     registry for spectator
 * @return The configured SNS client
 */
//TODO: See what spring-cloud-aws would provide automatically...
@Bean
@ConditionalOnMissingBean(AmazonSNSAsync.class)
public AmazonSNSAsync amazonSNS(final Config config, final Registry registry) {
    final ExecutorService executor = Executors.newFixedThreadPool(config.getSNSClientThreadCount(),
        new ThreadFactoryBuilder().setNameFormat("metacat-sns-pool-%d").build());
    RegistryUtil.registerThreadPool(registry, "metacat-sns-pool", (ThreadPoolExecutor) executor);
    return new AmazonSNSAsyncClient(DefaultAWSCredentialsProviderChain.getInstance(), executor);
}
项目:logback-ext    文件:SnsAppender.java   
@Override
protected void doStart() {
    sns = new AmazonSNSAsyncClient(
            getCredentials(),
            getClientConfiguration(),
            Executors.newFixedThreadPool(getThreadPoolSize())
    );
    sns.setRegion(RegionUtils.getRegion(region));
}
项目:izettle-toolbox    文件:AmazonSNSClientFactory.java   
/**
 * Creates Amazon SNS client for given endpoint using the provided credentials.
 *
 * @param awsCredentials AWS credentials with access to the endpoint, or null to use default aws credentials.
 * @return Amazon SNS client.
 */
private static AmazonSNSAsync createInstance(AWSCredentials awsCredentials) {
    if (awsCredentials == null) {
        return new AmazonSNSAsyncClient();
    } else {
        return new AmazonSNSAsyncClient(awsCredentials);
    }
}
项目:NBS3Sync    文件:S3Publisher.java   
public S3Publisher(Config config,  FileManager fileManager) {
    this.config = config;
    this.fileManager = fileManager;
    client = new AmazonSNSAsyncClient(config.getAWSCredentials());
    topic = "S3Sync_" + config.getBucketName() + "_topic";
    createTopic();
}
项目:circus-train    文件:SnsListener.java   
@Autowired
public SnsListener(AmazonSNSAsyncClient sns, ListenerConfig config) {
  this(sns, config, Clock.DEFAULT);
}
项目:usergrid    文件:SNSQueueManagerImpl.java   
/**
 * The Asynchronous SNS client is used for publishing events to SNS.
 */

private AmazonSNSAsyncClient createAsyncSNSClient( final Region region, final ExecutorService executor ) {

    final UsergridAwsCredentialsProvider ugProvider = new UsergridAwsCredentialsProvider();
    final AmazonSNSAsyncClient sns =
        new AmazonSNSAsyncClient( ugProvider.getCredentials(), clientConfiguration, executor );

    sns.setRegion( region );

    return sns;
}