Skip to content

Commit 5e0266b

Browse files
committed
Various updates: renaming methods, adding create method, adding AwsCrtSdkHttpService
1 parent 1f0942c commit 5e0266b

File tree

3 files changed

+79
-18
lines changed

3 files changed

+79
-18
lines changed

http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ public static Builder builder() {
161161
return new DefaultBuilder();
162162
}
163163

164+
/**
165+
* Create a {@link AwsCrtAsyncHttpClient} client with the default configuration
166+
*
167+
* @return an {@link SdkAsyncHttpClient}
168+
*/
169+
public static SdkAsyncHttpClient create() {
170+
return new DefaultBuilder().build();
171+
}
172+
164173
@Override
165174
public String clientName() {
166175
return AWS_COMMON_RUNTIME;
@@ -356,16 +365,14 @@ public interface Builder extends SdkAsyncHttpClient.Builder<AwsCrtAsyncHttpClien
356365
Builder tlsCipherPreference(TlsCipherPreference tlsCipherPreference);
357366

358367
/**
359-
* The AWS CRT WindowSize to use for this HttpClient.
360-
*
361-
* For an http/1.1 connection, this represents the number of unread bytes that can be buffered in the
362-
* ResponseBodyPublisher before we stop reading from the underlying TCP socket and wait for the Subscriber
368+
* Configures the number of unread bytes that can be buffered in the
369+
* client before we stop reading from the underlying TCP socket and wait for the Subscriber
363370
* to read more data.
364371
*
365-
* @param initialWindowSize The AWS Common Runtime WindowSize
372+
* @param readBufferSize The number of bytes that can be buffered
366373
* @return The builder of the method chaining.
367374
*/
368-
Builder initialWindowSize(int initialWindowSize);
375+
Builder readBufferSize(int readBufferSize);
369376

370377
/**
371378
* The AWS CRT EventLoopGroup to use for this Client.
@@ -389,24 +396,30 @@ public interface Builder extends SdkAsyncHttpClient.Builder<AwsCrtAsyncHttpClien
389396
Builder proxyConfiguration(ProxyConfiguration proxyConfiguration);
390397

391398
/**
392-
* Sets the http monitoring options for all connections established by this client.
399+
* Sets the http proxy configuration to use for this client.
400+
*
401+
* @param proxyConfigurationBuilderConsumer The consumer of the proxy configuration builder object.
402+
* @return the builder for method chaining.
403+
*/
404+
Builder proxyConfiguration(Consumer<ProxyConfiguration.Builder> proxyConfigurationBuilderConsumer);
405+
406+
/**
407+
* Configure the health checks for for all connections established by this client.
408+
*
409+
* <p>
410+
* eg: you can set a throughput threshold for the a connection to be considered healthy.
411+
* If the connection falls below this threshold for a configurable amount of time,
412+
* then the connection is considered unhealthy and will be shut down.
413+
*
393414
* @param monitoringOptions The http monitoring options to use
394415
* @return The builder of the method chaining.
395416
*/
396-
Builder monitoringOptions(HttpMonitoringOptions monitoringOptions);
417+
Builder connectionHealthChecksConfiguration(HttpMonitoringOptions monitoringOptions);
397418

398419
/**
399420
* Configure the maximum amount of time that a connection should be allowed to remain open while idle.
400421
*/
401422
Builder connectionMaxIdleTime(Duration connectionMaxIdleTime);
402-
403-
/**
404-
* Sets the http proxy configuration to use for this client.
405-
*
406-
* @param proxyConfigurationBuilderConsumer The consumer of the proxy configuration builder object.
407-
* @return the builder for method chaining.
408-
*/
409-
Builder proxyConfiguration(Consumer<ProxyConfiguration.Builder> proxyConfigurationBuilderConsumer);
410423
}
411424

412425
/**
@@ -455,7 +468,7 @@ public Builder tlsCipherPreference(TlsCipherPreference tlsCipherPreference) {
455468
}
456469

457470
@Override
458-
public Builder initialWindowSize(int initialWindowSize) {
471+
public Builder readBufferSize(int initialWindowSize) {
459472
Validate.isPositive(initialWindowSize, "initialWindowSize");
460473
this.initialWindowSize = initialWindowSize;
461474
return this;
@@ -480,7 +493,7 @@ public Builder proxyConfiguration(ProxyConfiguration proxyConfiguration) {
480493
}
481494

482495
@Override
483-
public Builder monitoringOptions(HttpMonitoringOptions monitoringOptions) {
496+
public Builder connectionHealthChecksConfiguration(HttpMonitoringOptions monitoringOptions) {
484497
this.monitoringOptions = monitoringOptions;
485498
return this;
486499
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.http.crt;
17+
18+
import software.amazon.awssdk.annotations.SdkPublicApi;
19+
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
20+
import software.amazon.awssdk.http.async.SdkAsyncHttpService;
21+
22+
/**
23+
* Service binding for the AWS common runtime HTTP client implementation. Allows SDK to pick this up automatically from the
24+
* classpath.
25+
*/
26+
@SdkPublicApi
27+
public class AwsCrtSdkHttpService implements SdkAsyncHttpService {
28+
@Override
29+
public SdkAsyncHttpClient.Builder createAsyncHttpClientFactory() {
30+
return AwsCrtAsyncHttpClient.builder();
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
software.amazon.awssdk.http.crt.AwsCrtSdkHttpService

0 commit comments

Comments
 (0)