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

Add use layer 7 proxy for reactive pg client #36704

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import io.quarkus.runtime.annotations.ConfigDocDefault;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.smallrye.config.WithDefault;
import io.vertx.pgclient.SslMode;

@ConfigGroup
Expand All @@ -23,4 +24,13 @@ public interface DataSourceReactivePostgreSQLConfig {
*/
@ConfigDocDefault("disable")
Optional<SslMode> sslMode();

/**
* Level 7 proxies can load balance queries on several connections to the actual database.
* When it happens, the client can be confused by the lack of session affinity and unwanted errors can happen like
* ERROR: unnamed prepared statement does not exist (26000).
* See <a href="https://vertx.io/docs/vertx-pg-client/java/#_using_a_level_7_proxy">Using a level 7 proxy</a>
*/
@WithDefault("false")
boolean useLayer7Proxy();
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ private List<PgConnectOptions> toPgConnectOptions(String dataSourceName, DataSou
}
}

pgConnectOptions.setUseLayer7Proxy(dataSourceReactivePostgreSQLConfig.useLayer7Proxy());

pgConnectOptions.setTrustAll(dataSourceReactiveRuntimeConfig.trustAll());

configurePemTrustOptions(pgConnectOptions, dataSourceReactiveRuntimeConfig.trustCertificatePem());
Expand Down