software.amazon.awssdk.services.sqs.SqsAsyncClientBuilder Java Examples

The following examples show how to use software.amazon.awssdk.services.sqs.SqsAsyncClientBuilder. 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: AsyncSqsClientFactory.java    From dynein with Apache License 2.0 7 votes vote down vote up
private SqsAsyncClient getAsyncSQSClient(AsyncSqsClientConfiguration config) {
  if (config.getType().equals(AsyncSqsClientConfiguration.Type.PRODUCTION)) {
    SqsAsyncClientBuilder builder =
        SqsAsyncClient.builder()
            .region(Region.of(config.getRegion()))
            .endpointOverride(config.getEndpoint());

    OverrideConfiguration overrideConfig = config.getOverrideConfiguration();

    if (overrideConfig != null) {

      RetryPolicy retry = buildRetryPolicy(overrideConfig.getRetryPolicyConfiguration());
      ClientOverrideConfiguration clientOverrideConfiguration =
          ClientOverrideConfiguration.builder()
              .apiCallAttemptTimeout(Duration.ofMillis(overrideConfig.getApiCallAttemptTimeout()))
              .apiCallTimeout(Duration.ofMillis(overrideConfig.getApiCallTimeout()))
              .retryPolicy(retry)
              .build();

      builder = builder.overrideConfiguration(clientOverrideConfiguration);
    }
    return builder.build();
  } else {
    throw new IllegalArgumentException("Doesn't support this Type " + config.getType());
  }
}
 
Example #2
Source File: SqsClientFactory.java    From micronaut-aws with Apache License 2.0 5 votes vote down vote up
@Override
@Bean(preDestroy = "close")
@Singleton
@Requires(beans = SdkAsyncHttpClient.class)
public SqsAsyncClient asyncClient(SqsAsyncClientBuilder builder) {
    return super.asyncClient(builder);
}
 
Example #3
Source File: SqsRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<AwsClientBuilder> createAsyncBuilder(SqsConfig config,
        RuntimeValue<SdkAsyncHttpClient.Builder> transport) {

    SqsAsyncClientBuilder builder = SqsAsyncClient.builder();

    if (transport != null) {
        builder.httpClientBuilder(transport.getValue());
    }
    return new RuntimeValue<>(builder);
}
 
Example #4
Source File: SqsRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public RuntimeValue<SqsAsyncClient> buildAsyncClient(RuntimeValue<? extends AwsClientBuilder> builder,
        BeanContainer beanContainer,
        ShutdownContext shutdown) {
    SqsClientProducer producer = beanContainer.instance(SqsClientProducer.class);
    producer.setAsyncConfiguredBuilder((SqsAsyncClientBuilder) builder.getValue());
    shutdown.addShutdownTask(producer::destroy);
    return new RuntimeValue<>(producer.asyncClient());
}
 
Example #5
Source File: SqsClientFactory.java    From micronaut-aws with Apache License 2.0 4 votes vote down vote up
@Override
protected SqsAsyncClientBuilder createAsyncBuilder() {
    return SqsAsyncClient.builder();
}
 
Example #6
Source File: SqsClientFactory.java    From micronaut-aws with Apache License 2.0 4 votes vote down vote up
@Override
@Singleton
@Requires(beans = SdkAsyncHttpClient.class)
public SqsAsyncClientBuilder asyncBuilder(SdkAsyncHttpClient httpClient) {
    return super.asyncBuilder(httpClient);
}
 
Example #7
Source File: SqsClientProducer.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public void setAsyncConfiguredBuilder(SqsAsyncClientBuilder asyncConfiguredBuilder) {
    this.asyncConfiguredBuilder = asyncConfiguredBuilder;
}