Client configuration
In 1.x, SDK client configuration was modified by setting a
ClientConfiguration
instance on the client or client builder. In version
2.x, the client configuration is split into separate configuration classes. With the
separate configuration classes, you can configure different HTTP clients for async versus
synchronous clients but still use the same ClientOverrideConfiguration
class.
Example of client configuration in version 1.x
AmazonDynamoDBClientBuilder.standard() .withClientConfiguration(clientConfiguration) .build()
Example of synchronous client configuration in version 2.x
ProxyConfiguration.Builder proxyConfig = ProxyConfiguration.builder(); ApacheHttpClient.Builder httpClientBuilder = ApacheHttpClient.builder() .proxyConfiguration(proxyConfig.build()); ClientOverrideConfiguration.Builder overrideConfig = ClientOverrideConfiguration.builder(); DynamoDbClient client = DynamoDbClient.builder() .httpClientBuilder(httpClientBuilder) .overrideConfiguration(overrideConfig.build()) .build();
Example of asynchronous client configuration in version 2.x
NettyNioAsyncHttpClient.Builder httpClientBuilder = NettyNioAsyncHttpClient.builder(); ClientOverrideConfiguration.Builder overrideConfig = ClientOverrideConfiguration.builder(); ClientAsyncConfiguration.Builder asyncConfig = ClientAsyncConfiguration.builder(); DynamoDbAsyncClient client = DynamoDbAsyncClient.builder() .httpClientBuilder(httpClientBuilder) .overrideConfiguration(overrideConfig.build()) .asyncConfiguration(asyncConfig.build()) .build();
HTTP clients
Notable changes
-
In version 2.x, you can change which HTTP client to use at runtime by specifying an implementation using
clientBuilder.httpClientBuilder
. -
When you pass an HTTP client by using
clientBuilder.httpClient
to a service client builder, the HTTP client is not closed by default if the service client closes. This allows you to share HTTP clients between service clients. -
Asynchronous HTTP clients now use non-blocking IO.
-
Some operations now use HTTP/2 for improved performance.
Settings changes
Setting | 1.x | 2.x Sync, Apache | 2.x Async, Netty |
---|---|---|---|
|
|
|
|
Max connections |
|
|
|
Connection timeout |
|
|
|
Socket timeout |
|
|
|
Connection TTL |
|
|
|
Connection max idle |
|
|
|
Validate after inactivity |
|
Not supported (Request
Feature |
Not supported (Request
Feature |
Local address |
|
|
Not
supported |
Expect-continue enabled |
|
|
Not supported (Request
Feature |
Connection reaper |
|
|
|
|
|
|
HTTP client proxies
Settings | 1.x | 2.x Sync, Apache | 2.x Async, Netty |
---|---|---|---|
|
|
|
|
Proxy host |
|
|
|
Proxy port |
|
Proxy
port is embedded in |
|
Proxy username |
|
|
|
Proxy password |
|
|
|
Proxy domain |
|
|
Not Supported (Request
Feature |
Proxy workstation |
|
|
Not Supported (Request
Feature |
Proxy authentication methods |
|
Not Supported (Request
Feature |
|
Preemptive basic proxy authentication |
|
|
Not Supported (Request
Feature |
Non-proxy hosts |
|
|
|
Disable socket proxy |
|
Not Supported (Request
Feature |
Not Supported (Request
Feature |
|
|
|
Client overrides
Setting | 1.x | 2.x |
---|---|---|
|
|
|
User agent prefix |
|
|
User agent suffix |
|
|
Signer |
|
|
Additional headers |
|
|
Request timeout |
|
|
Client execution timeout |
|
|
Use Gzip |
|
Not Supported (Request
Feature |
Socket buffer size hint |
|
Not Supported (Request
Feature |
Cache response metadata |
|
Not Supported (Request
Feature |
Response metadata cache size |
|
Not Supported (Request
Feature |
DNS resolver |
|
Not Supported (Request
Feature |
TCP keepalive |
|
This option is now in the HTTP Client configuration
|
Secure random |
|
Not Supported (Request
Feature |
|
|
Client override retries
Setting | 1.x | 2.x |
---|---|---|
|
|
|
Max error retry |
|
|
Use throttled retries |
|
Not
supported |
Max consecutive retries before throttling |
|
Not
supported |
|
|
Asynchronous clients
Setting | 1.x | 2.x |
---|---|---|
|
||
Executor |
|
|
|
Other client changes
The following ClientConfiguration
option from 1.x has changed in 2.x of
the SDK and doesn't have a direct equivalent.
Setting | 1.x | 2.x equivalent |
---|---|---|
Protocol |
|
The protocol setting is HTTPS by default. To modify the setting, specify the protocol setting an HTTP endpoint on the client builder:
|