Java Code Examples for com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder#build()

The following examples show how to use com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder#build() . 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: 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 2
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 3
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 4
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;
}