Microprofile 允许从 RestClient 定义 connectionPoolSize,如下所示:
io.smallrye.restclient.tests.proxy.HelloClient/property/resteasy.connectionPoolSize = 4
当我在我的项目中设置这个属性时,quarkus 会忽略它。我该如何定义它?
Microprofile 允许从 RestClient 定义 connectionPoolSize,如下所示:
io.smallrye.restclient.tests.proxy.HelloClient/property/resteasy.connectionPoolSize = 4
当我在我的项目中设置这个属性时,quarkus 会忽略它。我该如何定义它?
如果您配置的客户端是 @RegisterRestClient(configKey="myClient"),则要设置池大小,请使用:
quarkus.rest-client.myClient.connection-pool-size: 5
(...而不是 myClient/mp-rest/connectionPoolSize)
package org.myproject.config
public class MyRestClientBuilderListener implements RestClientBuilderListener {
static final Logger LOG = LoggerFactory.getLogger(MgiRestClientBuilderListener.class);
static final String CONNECTION_POOL_SIZE_PROP = "config.restclient.connectionPoolSize";
@Override
public void onNewBuilder(RestClientBuilder builder) {
Config cfg = ConfigProvider.getConfig();
Integer poolSizeConnection = cfg.getValue(CONNECTION_POOL_SIZE_PROP, Integer.class);
if(poolSizeConnection == null) {
poolSizeConnection = 50;//default
}
builder.property("resteasy.connectionPoolSize", poolSizeConnection);
}
}
org.myproject.config.MyRestClientBuilderListener