HTTP implementations
By default the AWS Java SDK uses netty under the hood to make the HTTP client calls. zio-aws
defines the http client
as a layer (HttpClient
) that has to be provided to the AWS configuration layer.
Currently the following implementations can be used:
zio-aws-netty
contains the default netty implementation packed as a layerzio-aws-akka-http
is based on Matthias LΓΌneberg's aws-spi-akka-http libraryzio-aws-http4s
is an implementation on top of http4s
Nettyβ
The default HTTP implementation in the AWS Java SDK is Netty. To use it with the default settings, use the netty.default
layer to provide the HttpClient
for the AwsConfig
layer. It is also possible to customize the NettyNioAsyncHttpClient
directly by manipulation it's Builder
, by using the netty.customized(customization)
layer.
The recommended way for configuration is to use the zio-config support:
def configured(
tlsKeyManagersProvider: Option[TlsKeyManagersProvider] = None,
tlsTrustManagersProvider: Option[TlsTrustManagersProvider] = None
): ZLayer[ZConfig[NettyClientConfig], Throwable, HttpClient]
Everything except the TLS key and trust managers are described by the zio-config provided NettyClientConfig
data structure.
See the following table for all the options:
Configuration Detailsβ
FieldName | Format | Description | Sources |
---|---|---|---|
all-of |
Field Descriptionsβ
FieldName | Format | Description | Sources |
---|---|---|---|
maxConcurrency | primitive | value of type int, default value: 50, Maximum number of allowed concurrent requests | |
maxPendingConnectionAcquires | primitive | value of type int, default value: 10000, The maximum number of pending acquires allowed | |
readTimeout | primitive | value of type duration, default value: PT30S, The amount of time to wait for a read on a socket | |
writeTimeout | primitive | value of type duration, default value: PT30S, The amount of time to wait for a write on a socket | |
connectionTimeout | primitive | value of type duration, default value: PT2S, The amount of time to wait when initially establishing a connection before giving up | |
connectionAcquisitionTimeout | primitive | value of type duration, default value: PT10S, The amount of time to wait when acquiring a connection from the pool before giving up | |
connectionTimeToLive | primitive | value of type duration, default value: PT0S, The maximum amount of time that a connection should be allowed to remain open, regardless of usage frequency | |
connectionMaxIdleTime | primitive | value of type duration, default value: PT5S, Maximum amount of time that a connection should be allowed to remain open while idle | |
useIdleConnectionReaper | primitive | value of type boolean, default value: true, If true, the idle connections in the pool should be closed | |
protocol | primitive | value of type string, default value: Dual, HTTP/1.1 or HTTP/2 or Dual | |
channelOptions | all-of | default value: NettyChannelOptions(Vector()), Custom Netty channel options | |
sslProvider | primitive | value of type string, optional value, The SSL provider to be used | |
proxy | all-of | optional value, Proxy configuration | |
http2 | all-of | optional value, HTTP/2 specific options |
channelOptionsβ
FieldName | Format | Description | Sources |
---|---|---|---|
SO_BROADCAST | primitive | value of type boolean, optional value, Allow transmission of broadcast datagrams | |
SO_KEEPALIVE | primitive | value of type boolean, optional value, Keep connection alive | |
SO_SNDBUF | primitive | value of type int, optional value, The size of the socket send buffer | |
SO_RCVBUF | primitive | value of type int, optional value, The size of the socket receive buffer | |
SO_REUSEADDR | primitive | value of type boolean, optional value, Re-use address | |
SO_LINGER | primitive | value of type int, optional value, Linger on close if data is present | |
IP_TOS | primitive | value of type int, optional value, The ToS octet in the IP header | |
IP_MULTICAST_IF | primitive | value of type string, optional value, The network interface's name for IP multicast datagrams | |
IP_MULTICAST_TTL | primitive | value of type int, optional value, The time-to-live for IP multicast datagrams | |
IP_MULTICAST_LOOP | primitive | value of type boolean, optional value, Loopback for IP multicast datagrams | |
TCP_NODELAY | primitive | value of type boolean, optional value, Disable the Nagle algorithm | |
CONNECT_TIMEOUT_MILLIS | primitive | value of type duration, optional value, Connect timeout | |
WRITE_SPIN_COUNT | primitive | value of type int, optional value, Write spin count | |
ALLOW_HALF_CLOSURE | primitive | value of type boolean, optional value, Allow half closure | |
AUTO_READ | primitive | value of type boolean, optional value, Auto read | |
AUTO_CLOSE | primitive | value of type boolean, optional value, Auto close | |
SINGLE_EVENTEXECUTOR_PER_GROUP | primitive | value of type boolean, optional value, Single event executor per group |
proxyβ
FieldName | Format | Description | Sources |
---|---|---|---|
scheme | primitive | value of type string, default value: Http, The proxy scheme | |
host | primitive | value of type string, Hostname of the proxy | |
port | primitive | value of type int, Port of the proxy | |
nonProxyHosts | list | value of type string, default value: Set(), Hosts that should not be proxied |
http2β
FieldName | Format | Description | Sources |
---|---|---|---|
maxStreams | primitive | value of type long, Max number of concurrent streams per connection | |
initialWindowSize | primitive | value of type int, Initial window size of a stream | |
healthCheckPingPeriod | primitive | value of type duration, default value: PT5S, The period that the Netty client will send PING frames to the remote endpoint |
Akka HTTPβ
The Akka HTTP implementation can be chosen by using the akkahttp.client()
layer for providing HttpClient
to AwsConfig
.
This implementation uses the standard akka-http settings from the application's Lightbend config,
it is not described with zio-config descriptors.
http4sβ
Another alternative is the http4s client. To use the default settings, provide the http4s.default
layer to AwsConfig
. Customization by manipulating the builder
is also possible by http4s.customized(customization)
. And similarly to the Netty client, configuration is also possible via zio-config:
Configuration Detailsβ
FieldName | Format | Description | Sources |
---|---|---|---|
all-of |
Field Descriptionsβ
FieldName | Format | Description | Sources |
---|---|---|---|
responseHeaderTimeout | primitive | value of type duration, default value: Duration.Inf, Timeout for receiving the header part of the response | |
idleTimeout | primitive | value of type duration, default value: 1 minute, Timeout for client connection staying idle | |
requestTimeout | primitive | value of type duration, default value: 45 seconds, Timeout for the whole request | |
connectTimeout | primitive | value of type duration, default value: 10 seconds, Timeout for connecting to the server | |
userAgent | primitive | value of type string, default value: User-Agent(http4s-blaze/3.0.2,List()), User-Agent header sent by the client | |
maxTotalConnections | primitive | value of type int, default value: 10, Maximum number of parallel connections | |
maxWaitQueueLimit | primitive | value of type int, default value: 256, Maximum number of requests in queue | |
checkEndpointIdentification | primitive | value of type boolean, default value: true, Check https identity | |
maxResponseLineSize | primitive | value of type int, default value: 4096, Maximum line length of headers in response | |
maxHeaderLength | primitive | value of type int, default value: 40960, Maximum total length of the response headers | |
maxChunkSize | primitive | value of type int, default value: 2147483647, Maximum chunk size | |
chunkBufferMaxSize | primitive | value of type int, default value: 1048576, Maximum size of the chunk buffer | |
parserMode | primitive | value of type string, default value: Strict, Parser mode, strict or lenient | |
bufferSize | primitive | value of type int, default value: 8192, Buffer size | |
channelOptions | all-of | default value: ChannelOptions(Vector(OptionValue(TCP_NODELAY,true))), Collection of socket options |
channelOptionsβ
FieldName | Format | Description | Sources |
---|---|---|---|
SO_BROADCAST | primitive | value of type boolean, optional value, Allow transmission of broadcast datagrams | |
SO_KEEPALIVE | primitive | value of type boolean, optional value, Keep connection alive | |
SO_SNDBUF | primitive | value of type int, optional value, The size of the socket send buffer | |
SO_RCVBUF | primitive | value of type int, optional value, The size of the socket receive buffer | |
SO_REUSEADDR | primitive | value of type boolean, optional value, Re-use address | |
SO_LINGER | primitive | value of type int, optional value, Linger on close if data is present | |
IP_TOS | primitive | value of type int, optional value, The ToS octet in the IP header | |
IP_MULTICAST_IF | primitive | value of type string, optional value, The network interface's name for IP multicast datagrams | |
IP_MULTICAST_TTL | primitive | value of type int, optional value, The time-to-live for IP multicast datagrams | |
IP_MULTICAST_LOOP | primitive | value of type boolean, optional value, Loopback for IP multicast datagrams | |
TCP_NODELAY | primitive | value of type boolean, optional value, Disable the Nagle algorithm |