com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder Java Examples

The following examples show how to use com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder. 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: SQSFactoryImpl.java    From aws-codecommit-trigger-plugin with Apache License 2.0 6 votes vote down vote up
private AmazonSQSAsyncClientBuilder createStandardAsyncClientBuilder(SQSQueue queue, AWSCredentialsProvider credentials) {
    ClientConfiguration clientConfiguration = this.getClientConfiguration(queue);
    AmazonSQSAsyncClientBuilder builder = AmazonSQSAsyncClientBuilder.standard()
        .withClientConfiguration(clientConfiguration)
        .withCredentials(credentials)
        .withExecutorFactory(this.SQSExecutorFactory);

    if (queue != null) {
        Regions region = queue.getRegion();
        if (region != null) {
            builder.withRegion(region);
        }
    }

    return builder;
}
 
Example #2
Source File: SqsConsumer.java    From datacollector with Apache License 2.0 6 votes vote down vote up
private AmazonSQSAsync buildAsyncClient() {
  final AmazonSQSAsyncClientBuilder builder = AmazonSQSAsyncClientBuilder.standard();
  if(conf.region == AwsRegion.OTHER) {
    builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(conf.endpoint, null));
  } else {
    builder.withRegion(conf.region.getId());
  }
  builder.setCredentials(credentials);
  builder.setClientConfiguration(clientConfiguration);

  return builder.build();
}
 
Example #3
Source File: AmazonAsyncDockerClientsHolder.java    From spring-localstack with Apache License 2.0 5 votes vote down vote up
@Override
public AmazonSQSAsync amazonSQS() {
    return decorateWithConfigsAndBuild(
        AmazonSQSAsyncClientBuilder.standard(),
        LocalstackDocker::getEndpointSQS
    );
}
 
Example #4
Source File: AwsTestConfig.java    From blog-tutorials with MIT License 5 votes vote down vote up
@Bean
public AmazonSQSAsync amazonSQS() {
  return AmazonSQSAsyncClientBuilder.standard()
    .withCredentials(localStack.getDefaultCredentialsProvider())
    .withEndpointConfiguration(localStack.getEndpointConfiguration(SQS))
    .build();
}
 
Example #5
Source File: SQSFactoryImpl.java    From aws-codecommit-trigger-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public AmazonSQS createSQSAsync(final SQSQueue queue) {
    AWSCredentialsProvider credentials = queue.hasCredentials() ? queue.lookupAwsCredentials() : DefaultAWSCredentialsProviderChain.getInstance();
    AmazonSQSAsyncClientBuilder sqsAsyncBuilder = createStandardAsyncClientBuilder(queue, credentials);
    final QueueBufferConfig queueBufferConfig = this.getQueueBufferConfig(queue);
    final AmazonSQSBufferedAsyncClient sqsBufferedAsync = new AmazonSQSBufferedAsyncClient(sqsAsyncBuilder.build(), queueBufferConfig);
    return sqsBufferedAsync;
}
 
Example #6
Source File: SQSFactoryImpl.java    From aws-codecommit-trigger-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public AmazonSQS createSQSAsync(String accessKey, String secretKey) {
    AmazonSQSAsyncClientBuilder sqsAsyncBuilder = createStandardAsyncClientBuilder(null, new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)));
    final QueueBufferConfig queueBufferConfig = this.getQueueBufferConfig(null);
    final AmazonSQSBufferedAsyncClient sqsBufferedAsync = new AmazonSQSBufferedAsyncClient(sqsAsyncBuilder.build(), queueBufferConfig);
    return sqsBufferedAsync;
}
 
Example #7
Source File: SQSFactoryImpl.java    From aws-codecommit-trigger-plugin with Apache License 2.0 5 votes vote down vote up
public AmazonSQS createSQSAsync(String accessKey, String secretKey, String region) {//TODO check region is Enum?
    AmazonSQSAsyncClientBuilder sqsAsyncBuilder = createStandardAsyncClientBuilder(null, new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)));
    if (StringUtils.isNotBlank(region)) {
        sqsAsyncBuilder.withRegion(Regions.valueOf(region));
    }
    final QueueBufferConfig queueBufferConfig = this.getQueueBufferConfig(null);
    final AmazonSQSBufferedAsyncClient sqsBufferedAsync = new AmazonSQSBufferedAsyncClient(sqsAsyncBuilder.build(), queueBufferConfig);
    return sqsBufferedAsync;
}
 
Example #8
Source File: SQSSender.java    From zipkin-aws with Apache License 2.0 5 votes vote down vote up
AmazonSQSAsync get() {
  if (asyncClient == null) {
    synchronized (this) {
      if (asyncClient == null) {
        asyncClient = AmazonSQSAsyncClientBuilder.standard()
            .withCredentials(credentialsProvider)
            .withEndpointConfiguration(endpointConfiguration).build();
      }
    }
  }
  return asyncClient;
}
 
Example #9
Source File: MockQueueGenerator.java    From spring-boot-aws-mock with MIT License 4 votes vote down vote up
public static AmazonSQSAsync getSqsClient(String sqsEndPoint) {
    return AmazonSQSAsyncClientBuilder.standard()
                .withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
                .withEndpointConfiguration(new EndpointConfiguration(sqsEndPoint, ""))
                .build();
}