Java源码示例:com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder

示例1
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;
}
 
示例2
@Override
public AmazonSQSAsync amazonSQS() {
    return decorateWithConfigsAndBuild(
        AmazonSQSAsyncClientBuilder.standard(),
        LocalstackDocker::getEndpointSQS
    );
}
 
示例3
@Bean
public AmazonSQSAsync amazonSQS() {
  return AmazonSQSAsyncClientBuilder.standard()
    .withCredentials(localStack.getDefaultCredentialsProvider())
    .withEndpointConfiguration(localStack.getEndpointConfiguration(SQS))
    .build();
}
 
示例4
@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;
}
 
示例5
@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;
}
 
示例6
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;
}
 
示例7
AmazonSQSAsync get() {
  if (asyncClient == null) {
    synchronized (this) {
      if (asyncClient == null) {
        asyncClient = AmazonSQSAsyncClientBuilder.standard()
            .withCredentials(credentialsProvider)
            .withEndpointConfiguration(endpointConfiguration).build();
      }
    }
  }
  return asyncClient;
}
 
示例8
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();
}
 
示例9
public static AmazonSQSAsync getSqsClient(String sqsEndPoint) {
    return AmazonSQSAsyncClientBuilder.standard()
                .withCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()))
                .withEndpointConfiguration(new EndpointConfiguration(sqsEndPoint, ""))
                .build();
}