Skip to content

Add checks for quarkus.elasticsearch.max-connections and quarkus.elasticsearch.max-connections-per-route values #35684

@rsvoboda

Description

@rsvoboda

Description

Add checks for quarkus.elasticsearch.max-connections and quarkus.elasticsearch.max-connections-per-route values.
quarkus.elasticsearch.io-thread-counts could be checked on Quarkus side too, some details a bit lower.

0 or negative is forbidden in Hibernate Search, it probably should be in this client as well

https://github.com/quarkusio/quarkus/blob/main/extensions/elasticsearch-rest-client/runtime/src/main/java/io/quarkus/elasticsearch/restclient/lowlevel/runtime/RestClientBuilderHelper.java#L75 passes the values to HttpAsyncClientBuilder

And it reflects only the values higher than 0 in public CloseableHttpAsyncClient build() method

                if (maxConnTotal > 0) {
                    poolingmgr.setMaxTotal(maxConnTotal);
                }
                if (maxConnPerRoute > 0) {
                    poolingmgr.setDefaultMaxPerRoute(maxConnPerRoute);
                }

quarkus.elasticsearch.io-thread-counts=0 throws exception in runtime when the client is used/injected for the first time.
The check is done outside Quarkus, quarkus.elasticsearch.io-thread-counts could be checked on Quarkus side too.

Caused by: java.lang.IllegalArgumentException: ioThreadCount may not be negative or zero
	at org.apache.http.util.Args.positive(Args.java:104)
	at org.apache.http.impl.nio.reactor.IOReactorConfig.<init>(IOReactorConfig.java:95)
	at org.apache.http.impl.nio.reactor.IOReactorConfig$Builder.build(IOReactorConfig.java:505)
	at io.quarkus.elasticsearch.restclient.lowlevel.runtime.RestClientBuilderHelper$2.customizeHttpClient(RestClientBuilderHelper.java:71)

Implementation ideas

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions