Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backports to 1.x #742

Merged
merged 4 commits into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions common/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Collections;
import java.util.HashSet;

import io.quarkus.amazon.common.runtime.NettyHttpClientConfig.SslProviderType;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
import software.amazon.awssdk.http.TlsTrustManagersProvider;
Expand Down Expand Up @@ -33,7 +34,7 @@ public RuntimeValue<SdkAsyncHttpClient.Builder> configureAsync(String clientName
builder.readTimeout(asyncConfig.readTimeout);
builder.writeTimeout(asyncConfig.writeTimeout);
builder.tcpKeepAlive(asyncConfig.tcpKeepAlive);
asyncConfig.sslProvider.ifPresent(builder::sslProvider);
asyncConfig.sslProvider.map(SslProviderType::create).ifPresent(builder::sslProvider);
builder.useIdleConnectionReaper(asyncConfig.useIdleConnectionReaper);

if (asyncConfig.http2.initialWindowSize.isPresent() || asyncConfig.http2.maxStreams.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class NettyHttpClientConfig {
/**
* The maximum number of allowed concurrent requests.
* <p>
* For HTTP/1.1 this is the same as max connections. For HTTP/2 the number of connections that will be used depends on the
* For HTTP/1.1 this is the same as max connections. For HTTP/2 the number of
* connections that will be used depends on the
* max streams allowed per connection.
*/
@ConfigItem(defaultValue = "50")
Expand All @@ -32,51 +33,59 @@ public class NettyHttpClientConfig {
public int maxPendingConnectionAcquires;

/**
* The amount of time to wait for a read on a socket before an exception is thrown.
* The amount of time to wait for a read on a socket before an exception is
* thrown.
* <p>
* Specify `0` to disable.
*/
@ConfigItem(defaultValue = "30S")
public Duration readTimeout;

/**
* The amount of time to wait for a write on a socket before an exception is thrown.
* The amount of time to wait for a write on a socket before an exception is
* thrown.
* <p>
* Specify `0` to disable.
*/
@ConfigItem(defaultValue = "30S")
public Duration writeTimeout;

/**
* The amount of time to wait when initially establishing a connection before giving up and timing out.
* The amount of time to wait when initially establishing a connection before
* giving up and timing out.
*/
@ConfigItem(defaultValue = "10S")
public Duration connectionTimeout;

/**
* The amount of time to wait when acquiring a connection from the pool before giving up and timing out.
* The amount of time to wait when acquiring a connection from the pool before
* giving up and timing out.
*/
@ConfigItem(defaultValue = "2S")
public Duration connectionAcquisitionTimeout;

/**
* The maximum amount of time that a connection should be allowed to remain open, regardless of usage frequency.
* The maximum amount of time that a connection should be allowed to remain
* open, regardless of usage frequency.
*/
@ConfigItem
public Optional<Duration> connectionTimeToLive;

/**
* The maximum amount of time that a connection should be allowed to remain open while idle.
* The maximum amount of time that a connection should be allowed to remain open
* while idle.
* <p>
* Currently has no effect if `quarkus.<amazon-service>.async-client.use-idle-connection-reaper` is false.
* Currently has no effect if
* `quarkus.<amazon-service>.async-client.use-idle-connection-reaper` is false.
*/
@ConfigItem(defaultValue = "5S")
public Duration connectionMaxIdleTime;

/**
* Whether the idle connections in the connection pool should be closed.
* <p>
* When enabled, connections left idling for longer than `quarkus.<amazon-service>.async-client.connection-max-idle-time`
* When enabled, connections left idling for longer than
* `quarkus.<amazon-service>.async-client.connection-max-idle-time`
* will be closed. This will not close connections currently in use.
*/
@ConfigItem(defaultValue = "true")
Expand All @@ -100,7 +109,7 @@ public class NettyHttpClientConfig {
* Default is `OPENSSL` if available, `JDK` otherwise.
*/
@ConfigItem
public Optional<SslProvider> sslProvider;
public Optional<SslProviderType> sslProvider;

/**
* HTTP/2 specific configuration
Expand Down Expand Up @@ -159,7 +168,8 @@ public static class Http2Config {
public OptionalInt initialWindowSize;

/**
* Sets the period that the Netty client will send {@code PING} frames to the remote endpoint to check the
* Sets the period that the Netty client will send {@code PING} frames to the
* remote endpoint to check the
* health of the connection. To disable this feature, set a duration of 0.
* <p>
* This setting is only respected when the HTTP/2 protocol is used.
Expand All @@ -181,16 +191,19 @@ public static class SdkEventLoopGroupConfig {
/**
* Number of threads to use for the event loop group.
* <p>
* If not set, the default Netty thread count is used (which is double the number of available processors unless the
* If not set, the default Netty thread count is used (which is double the
* number of available processors unless the
* `io.netty.eventLoopThreads` system property is set.
*/
@ConfigItem
public OptionalInt numberOfThreads;

/**
* The thread name prefix for threads created by this thread factory used by event loop group.
* The thread name prefix for threads created by this thread factory used by
* event loop group.
* <p>
* The prefix will be appended with a number unique to the thread factory and a number unique to the thread.
* The prefix will be appended with a number unique to the thread factory and a
* number unique to the thread.
* <p>
* If not specified it defaults to `aws-java-sdk-NettyEventLoop`
*/
Expand All @@ -210,14 +223,16 @@ public static class NettyProxyConfiguration {
/**
* The endpoint of the proxy server that the SDK should connect through.
* <p>
* Currently, the endpoint is limited to a host and port. Any other URI components will result in an exception being
* Currently, the endpoint is limited to a host and port. Any other URI
* components will result in an exception being
* raised.
*/
@ConfigItem
public Optional<URI> endpoint;

/**
* The hosts that the client is allowed to access without going through the proxy.
* The hosts that the client is allowed to access without going through the
* proxy.
*/
@ConfigItem
public Optional<List<String>> nonProxyHosts;
Expand All @@ -227,14 +242,42 @@ public static class NettyProxyConfiguration {
public static class Advanced {

/**
* Whether the default thread pool should be used to complete the futures returned from the HTTP client request.
* Whether the default thread pool should be used to complete the futures
* returned from the HTTP client request.
* <p>
* When disabled, futures will be completed on the Netty event loop thread.
*/
@ConfigItem(defaultValue = "true")
public boolean useFutureCompletionThreadPool;
}

//TODO: additionalChannelOptions
//additionalChannelOptions;
// TODO: additionalChannelOptions
// additionalChannelOptions;

/**
* An enumeration of SSL/TLS protocol providers.
*/
public enum SslProviderType {

JDK {
@Override
SslProvider create() {
return io.netty.handler.ssl.SslProvider.JDK;
}
},
OPENSSL {
@Override
SslProvider create() {
return io.netty.handler.ssl.SslProvider.OPENSSL;
}
},
OPENSSL_REFCNT {
@Override
SslProvider create() {
return io.netty.handler.ssl.SslProvider.OPENSSL_REFCNT;
}
};

abstract SslProvider create();
}
}
7 changes: 6 additions & 1 deletion iam/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion kms/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>2.16.8.Final</quarkus.version>
<awssdk.version>2.20.65</awssdk.version>
<awscrt.version>0.21.15</awscrt.version>
<awssdk.version>2.20.98</awssdk.version>
<awscrt.version>0.22.2</awscrt.version>
<!-- required by testcontainer localstack to run but not used
https://github.com/testcontainers/testcontainers-java/issues/4279
-->
Expand Down
6 changes: 6 additions & 0 deletions s3/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down
7 changes: 6 additions & 1 deletion secretsmanager/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion ses/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions sns/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down
6 changes: 6 additions & 0 deletions sqs/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down
7 changes: 6 additions & 1 deletion ssm/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion sts/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
Expand Down