Search in sources :

Example 1 with HttpClientPoolFactory

use of org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory in project incubator-servicecomb-java-chassis by apache.

the class AbstractClientPool method create.

public void create() {
    // 这里面是同步接口,且好像直接在事件线程中用,保险起见,先使用独立的vertx实例
    VertxOptions vertxOptions = new VertxOptions();
    vertxOptions.setAddressResolverOptions(AddressResolverConfig.getAddressResover(SSL_KEY));
    Vertx vertx = VertxUtils.getOrCreateVertxByName("registry", vertxOptions);
    HttpClientOptions httpClientOptions = createHttpClientOptions();
    clientMgr = new ClientPoolManager<>(vertx, new HttpClientPoolFactory(httpClientOptions));
    DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(this.clientMgr, ServiceRegistryConfig.INSTANCE.getWorkerPoolSize());
    try {
        VertxUtils.blockDeploy(vertx, ClientVerticle.class, deployOptions);
    } catch (InterruptedException e) {
        LOGGER.error("deploy a registry verticle failed, {}", e.getMessage());
    }
}
Also used : HttpClientPoolFactory(org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory) DeploymentOptions(io.vertx.core.DeploymentOptions) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) HttpClientOptions(io.vertx.core.http.HttpClientOptions)

Example 2 with HttpClientPoolFactory

use of org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory in project incubator-servicecomb-java-chassis by apache.

the class RestTransportClient method init.

public void init(Vertx vertx) throws Exception {
    HttpClientOptions httpClientOptions = createHttpClientOptions();
    clientMgr = new ClientPoolManager<>(vertx, new HttpClientPoolFactory(httpClientOptions));
    DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientMgr, TransportClientConfig.getThreadCount());
    VertxUtils.blockDeploy(vertx, ClientVerticle.class, deployOptions);
}
Also used : HttpClientPoolFactory(org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory) DeploymentOptions(io.vertx.core.DeploymentOptions) HttpClientOptions(io.vertx.core.http.HttpClientOptions)

Example 3 with HttpClientPoolFactory

use of org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory in project incubator-servicecomb-java-chassis by apache.

the class ConfigCenterClient method deployConfigClient.

private void deployConfigClient() throws InterruptedException {
    VertxOptions vertxOptions = new VertxOptions();
    vertxOptions.setAddressResolverOptions(AddressResolverConfig.getAddressResover(SSL_KEY, ConfigCenterConfig.INSTANCE.getConcurrentCompositeConfiguration()));
    Vertx vertx = VertxUtils.getOrCreateVertxByName("config-center", vertxOptions);
    HttpClientOptions httpClientOptions = createHttpClientOptions();
    clientMgr = new ClientPoolManager<>(vertx, new HttpClientPoolFactory(httpClientOptions));
    DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientMgr, 1);
    VertxUtils.blockDeploy(vertx, ClientVerticle.class, deployOptions);
}
Also used : HttpClientPoolFactory(org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory) DeploymentOptions(io.vertx.core.DeploymentOptions) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) HttpClientOptions(io.vertx.core.http.HttpClientOptions)

Example 4 with HttpClientPoolFactory

use of org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory in project java-chassis by ServiceComb.

the class DefaultMonitorDataPublisher method deployMonitorClient.

private void deployMonitorClient() throws InterruptedException {
    VertxOptions vertxOptions = new VertxOptions();
    vertxOptions.setAddressResolverOptions(AddressResolverConfig.getAddressResover(SSL_KEY));
    Vertx vertx = VertxUtils.getOrCreateVertxByName("monitor-center", vertxOptions);
    HttpClientOptions httpClientOptions = createHttpClientOptions();
    httpClientOptions.setMaxWaitQueueSize(MAX_WAIT_QUEUE_SIZE);
    clientMgr = new ClientPoolManager<>(vertx, new HttpClientPoolFactory(httpClientOptions));
    DeploymentOptions deploymentOptions = VertxUtils.createClientDeployOptions(clientMgr, 1);
    VertxUtils.blockDeploy(vertx, ClientVerticle.class, deploymentOptions);
}
Also used : HttpClientPoolFactory(org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory) DeploymentOptions(io.vertx.core.DeploymentOptions) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) HttpClientOptions(io.vertx.core.http.HttpClientOptions)

Aggregations

DeploymentOptions (io.vertx.core.DeploymentOptions)4 HttpClientOptions (io.vertx.core.http.HttpClientOptions)4 HttpClientPoolFactory (org.apache.servicecomb.foundation.vertx.client.http.HttpClientPoolFactory)4 Vertx (io.vertx.core.Vertx)3 VertxOptions (io.vertx.core.VertxOptions)3