Search in sources :

Example 36 with DeploymentOptions

use of io.vertx.core.DeploymentOptions in project java-chassis by ServiceComb.

the class AbstractClientPool method create.

public void create() {
    // 这里面是同步接口,且好像直接在事件线程中用,保险起见,先使用独立的vertx实例
    Vertx vertx = VertxUtils.getOrCreateVertxByName("registry", null);
    HttpClientOptions httpClientOptions = createHttpClientOptions();
    DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(this.clientMgr, ServiceRegistryConfig.INSTANCE.getWorkerPoolSize(), 1, httpClientOptions);
    try {
        VertxUtils.blockDeploy(vertx, HttpClientVerticle.class, deployOptions);
    } catch (InterruptedException e) {
        LOGGER.error("deploy a registry verticle failed, {}", e.getMessage());
    }
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) Vertx(io.vertx.core.Vertx) HttpClientOptions(io.vertx.core.http.HttpClientOptions)

Example 37 with DeploymentOptions

use of io.vertx.core.DeploymentOptions in project java-chassis by ServiceComb.

the class RestTransportClient method init.

public void init(Vertx vertx) throws Exception {
    HttpClientOptions httpClientOptions = createHttpClientOptions();
    DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientMgr, TransportClientConfig.getThreadCount(), TransportClientConfig.getConnectionPoolPerThread(), httpClientOptions);
    VertxUtils.blockDeploy(vertx, HttpClientVerticle.class, deployOptions);
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) HttpClientOptions(io.vertx.core.http.HttpClientOptions)

Example 38 with DeploymentOptions

use of io.vertx.core.DeploymentOptions in project java-chassis by ServiceComb.

the class GrpcTransport method init.

public boolean init() throws Exception {
    GrpcCodec.setGrpcTransport(this);
    HttpClientOptions httpClientOptions = createHttpClientOptions();
    DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientMgr, GrpcConfig.getThreadCount(), GrpcConfig.getConnectionPoolPerThread(), httpClientOptions);
    setListenAddressWithoutSchema(GrpcConfig.getAddress());
    // config already initialized by createClientDeployOptions
    deployOptions.getConfig().put(ENDPOINT_KEY, getEndpoint().getEndpoint());
    return VertxUtils.blockDeploy(transportVertx, GrpcVerticle.class, deployOptions);
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) HttpClientOptions(io.vertx.core.http.HttpClientOptions)

Aggregations

DeploymentOptions (io.vertx.core.DeploymentOptions)38 Test (org.junit.Test)25 CountDownLatch (java.util.concurrent.CountDownLatch)17 AbstractVerticle (io.vertx.core.AbstractVerticle)15 JsonObject (io.vertx.core.json.JsonObject)10 Context (io.vertx.core.Context)8 Vertx (io.vertx.core.Vertx)7 VertxInternal (io.vertx.core.impl.VertxInternal)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 AtomicReference (java.util.concurrent.atomic.AtomicReference)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 Future (io.vertx.core.Future)4 HttpClientOptions (io.vertx.core.http.HttpClientOptions)4 CompletableFuture (java.util.concurrent.CompletableFuture)4 Verticle (io.vertx.core.Verticle)3 VertxException (io.vertx.core.VertxException)3 Buffer (io.vertx.core.buffer.Buffer)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 Collections (java.util.Collections)3 TimeUnit (java.util.concurrent.TimeUnit)3