Skip to content

Commit

Permalink
Peer Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniodvr committed Jun 6, 2021
1 parent 39a27b8 commit fdcde21
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,35 +78,33 @@ public static RedisOptions buildOptions(RedisConfiguration redisConfig) {

private static NetClientOptions toNetClientOptions(RedisConfiguration redisConfig) {
NetClientOptions netClientOptions = new NetClientOptions()
.setTcpKeepAlive(true)
.setTcpNoDelay(true);
.setTcpKeepAlive(redisConfig.tcpKeepAlive)
.setTcpNoDelay(redisConfig.tcpNoDelay);

if (redisConfig.ssl.isPresent()) {
SslConfig sslConfig = redisConfig.ssl.get();
SslConfig sslConfig = redisConfig.ssl;

netClientOptions
.setSsl(sslConfig.enabled)
.setTrustAll(sslConfig.trustAll);
netClientOptions
.setSsl(sslConfig.enabled)
.setTrustAll(sslConfig.trustAll);

configurePemTrustOptions(netClientOptions, sslConfig.trustCertificatePem);
configureJksTrustOptions(netClientOptions, sslConfig.trustCertificateJks);
configurePfxTrustOptions(netClientOptions, sslConfig.trustCertificatePfx);
configurePemTrustOptions(netClientOptions, sslConfig.trustCertificatePem);
configureJksTrustOptions(netClientOptions, sslConfig.trustCertificateJks);
configurePfxTrustOptions(netClientOptions, sslConfig.trustCertificatePfx);

configurePemKeyCertOptions(netClientOptions, sslConfig.keyCertificatePem);
configureJksKeyCertOptions(netClientOptions, sslConfig.keyCertificateJks);
configurePfxKeyCertOptions(netClientOptions, sslConfig.keyCertificatePfx);
configurePemKeyCertOptions(netClientOptions, sslConfig.keyCertificatePem);
configureJksKeyCertOptions(netClientOptions, sslConfig.keyCertificateJks);
configurePfxKeyCertOptions(netClientOptions, sslConfig.keyCertificatePfx);

netClientOptions.setReconnectAttempts(redisConfig.reconnectAttempts);
netClientOptions.setReconnectInterval(redisConfig.reconnectInterval.toMillis());
netClientOptions.setReconnectAttempts(redisConfig.reconnectAttempts);
netClientOptions.setReconnectInterval(redisConfig.reconnectInterval.toMillis());

if (redisConfig.idleTimeout.isPresent()) {
netClientOptions.setIdleTimeout(redisConfig.idleTimeout.get());
}
if (redisConfig.idleTimeout.isPresent()) {
netClientOptions.setIdleTimeout(redisConfig.idleTimeout.get());
}

if (sslConfig.hostnameVerificationAlgorithm.isPresent()) {
netClientOptions.setHostnameVerificationAlgorithm(
sslConfig.hostnameVerificationAlgorithm.get());
}
if (sslConfig.hostnameVerificationAlgorithm.isPresent()) {
netClientOptions.setHostnameVerificationAlgorithm(
sslConfig.hostnameVerificationAlgorithm.get());
}

return netClientOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import io.quarkus.redis.client.RedisClient;
import io.quarkus.redis.client.RedisClientName;
import io.quarkus.runtime.annotations.ConfigDocSection;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
Expand Down Expand Up @@ -168,7 +169,7 @@ public static class RedisConfiguration {
/**
* The interval between reconnection attempts when a pooled connection cannot be established on first try.
*/
@ConfigItem(defaultValue = "PT1S")
@ConfigItem(defaultValue = "1")
public Duration reconnectInterval;

/**
Expand All @@ -177,12 +178,24 @@ public static class RedisConfiguration {
@ConfigItem(defaultValueDocumentation = "no timeout")
public Optional<Integer> idleTimeout;

/**
* Whether TCP keep alive is enabled
*/
@ConfigItem(defaultValue = "true")
public boolean tcpKeepAlive;

/**
* Whether TCP no delay is enabled
*/
@ConfigItem(defaultValue = "true")
public boolean tcpNoDelay;

/**
* SSL/TLS config.
*/
@ConfigItem
@ConfigDocSection
public SslConfig> ssl;
public SslConfig ssl;

}
}

0 comments on commit fdcde21

Please sign in to comment.