/** * Set the maximum pool size for connections * * @param maxPoolSize the maximum pool size * @return a reference to this, so the API can be used fluently */ @Override public ConsulClientOptions setMaxPoolSize(int maxPoolSize) { return (ConsulClientOptions) super.setMaxPoolSize(maxPoolSize); }
@Bean public WebClient webClient() { WebClientOptions options = new WebClientOptions() .setConnectTimeout(Integer.valueOf(properties.getProperty("oidc.http.connectionTimeout", DEFAULT_CONNECTION_TIMEOUT)) * 1000) .setMaxPoolSize(Integer.valueOf(properties.getProperty("oidc.http.pool.maxTotalConnection", DEFAULT_MAX_TOTAL_CONNECTION))) .setTrustAll(Boolean.valueOf(properties.getProperty("oidc.http.client.trustAll", "true"))); return WebClient.create(vertx,options); } }
@Bean public WebClient httpClient() { WebClientOptions httpClientOptions = new WebClientOptions(); httpClientOptions .setUserAgent(DEFAULT_USER_AGENT) .setConnectTimeout(Integer.valueOf(properties.getProperty("identities.oauth2.http.connectionTimeout", DEFAULT_CONNECTION_TIMEOUT)) * 1000) .setMaxPoolSize(Integer.valueOf(properties.getProperty("identities.oauth2.http.pool.maxTotalConnection", DEFAULT_MAX_TOTAL_CONNECTION))); return WebClient.create(vertx, httpClientOptions); } }
@Bean public WebClient httpClient() { WebClientOptions httpClientOptions = new WebClientOptions(); httpClientOptions .setUserAgent(DEFAULT_USER_AGENT) .setConnectTimeout(Integer.valueOf(properties.getProperty("identities.oauth2.http.connectionTimeout", DEFAULT_CONNECTION_TIMEOUT)) * 1000) .setMaxPoolSize(Integer.valueOf(properties.getProperty("identities.oauth2.http.pool.maxTotalConnection", DEFAULT_MAX_TOTAL_CONNECTION))); return WebClient.create(vertx, httpClientOptions); } }
@Bean public WebClient httpClient() { WebClientOptions httpClientOptions = new WebClientOptions(); httpClientOptions .setUserAgent(DEFAULT_USER_AGENT) .setConnectTimeout(Integer.valueOf(properties.getProperty("identities.github.http.connectionTimeout", DEFAULT_CONNECTION_TIMEOUT)) * 1000) .setMaxPoolSize(Integer.valueOf(properties.getProperty("identities.github.http.pool.maxTotalConnection", DEFAULT_MAX_TOTAL_CONNECTION))); return WebClient.create(vertx, httpClientOptions); } }
@Bean public WebClient httpClient() { WebClientOptions httpClientOptions = new WebClientOptions(); httpClientOptions .setUserAgent(DEFAULT_USER_AGENT) .setConnectTimeout(Integer.valueOf(properties.getProperty("identities.github.http.connectionTimeout", DEFAULT_CONNECTION_TIMEOUT)) * 1000) .setMaxPoolSize(Integer.valueOf(properties.getProperty("identities.github.http.pool.maxTotalConnection", DEFAULT_MAX_TOTAL_CONNECTION))); return WebClient.create(vertx, httpClientOptions); } }
@Test public void testToJson() { WebClientOptions options = new WebClientOptions() .setDefaultPort(4848) .setMaxPoolSize(50) .setUserAgentEnabled(false); JsonObject json = options.toJson(); assertEquals(4848, (int) json.getInteger("defaultPort")); assertEquals(50, (int) json.getInteger("maxPoolSize")); assertEquals(false, json.getBoolean("userAgentEnabled")); } }