com.amazonaws.services.sns.AmazonSNSAsyncClientBuilder Java Examples

The following examples show how to use com.amazonaws.services.sns.AmazonSNSAsyncClientBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnsConfiguration.java    From data-highway with Apache License 2.0 7 votes vote down vote up
@Bean
public AmazonSNSAsync snsClient(
    @Value("${notification.sns.region}") String region,
    @Value("${notification.sns.endpointUrl:disabled}") String snsEndpointUrl) {
  if ("disabled".equalsIgnoreCase(snsEndpointUrl)) {
    return null;
  }
  AmazonSNSAsync client = AmazonSNSAsyncClientBuilder
      .standard()
      .withClientConfiguration(
          new ClientConfiguration().withRetryPolicy(PredefinedRetryPolicies.getDefaultRetryPolicy()))
      .withExecutorFactory(() -> Executors.newSingleThreadScheduledExecutor())
      .withEndpointConfiguration(new EndpointConfiguration(snsEndpointUrl, region))
      .build();
  return client;
}
 
Example #2
Source File: AwsMetricsPublisher.java    From bazel-buildfarm with Apache License 2.0 6 votes vote down vote up
private AmazonSNSAsync initSnsClient() {
  logger.log(Level.INFO, "Initializing SNS Client.");
  return AmazonSNSAsyncClientBuilder.standard()
      .withRegion(region)
      .withClientConfiguration(
          new ClientConfiguration().withMaxConnections(snsClientMaxConnections))
      .withCredentials(
          new AWSStaticCredentialsProvider(
              new AWSCredentials() {
                @Override
                public String getAWSAccessKeyId() {
                  return awsAccessKeyId;
                }

                @Override
                public String getAWSSecretKey() {
                  return awsSecretKey;
                }
              }))
      .build();
}
 
Example #3
Source File: AmazonAsyncDockerClientsHolder.java    From spring-localstack with Apache License 2.0 5 votes vote down vote up
@Override
public AmazonSNSAsync amazonSNS() {
    return decorateWithConfigsAndBuild(
        AmazonSNSAsyncClientBuilder.standard(),
        LocalstackDocker::getEndpointSNS
    );
}
 
Example #4
Source File: Service.java    From act with GNU General Public License v3.0 5 votes vote down vote up
public void init() throws IOException {
  AWSCredentials credentials =
      new BasicAWSCredentials(this.serviceConfig.getAccessKeyId(), this.serviceConfig.getSecretAccessKey());
  AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
  ClientConfiguration config = new ClientConfiguration();
  snsClient = AmazonSNSAsyncClientBuilder.standard().
      withCredentials(credentialsProvider).
      withRegion(serviceConfig.getRegion()).build();
}