Search in sources :

Example 21 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-zero by silentbalanceyh.

the class ZeroApiAgent method start.

@Override
public void start() {
    /**
     * 1.Call router hub to mount commont *
     */
    final Axis<Router> routerAxiser = Fn.poolThread(Pool.ROUTERS, () -> Instance.instance(RouterAxis.class));
    Fn.flingUp(() -> {
        // Set breaker for each server
        ZeroAtomic.API_OPTS.forEach((port, option) -> {
            /**
             * Mount to api hub *
             */
            final Axis<Router> axiser = Fn.poolThread(Pool.APIS, () -> Instance.instance(PointAxis.class, option, this.vertx));
            /**
             * Single server processing *
             */
            final HttpServer server = this.vertx.createHttpServer(option);
            /**
             * Router *
             */
            final Router router = Router.router(this.vertx);
            routerAxiser.mount(router);
            /**
             * Api Logical *
             */
            axiser.mount(router);
            /**
             * Listening *
             */
            server.requestHandler(router::accept).listen();
            {
                registryServer(option);
            }
        });
    }, LOGGER);
}
Also used : RouterAxis(io.vertx.up.rs.router.RouterAxis) HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router) PointAxis(io.vertx.up.rs.router.PointAxis)

Example 22 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class WebSessionVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    Future<HttpServer> future = Future.future();
    Router router = setupRouter();
    vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
    return future;
}
Also used : HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router)

Example 23 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class EventBusSenderVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    Future<HttpServer> future = Future.future();
    Router router = setupRouter();
    vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
    return future;
}
Also used : HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router)

Example 24 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class AsyncMapVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    Future<HttpServer> future = Future.future();
    Router router = setupRouter();
    vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
    return future;
}
Also used : HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router)

Example 25 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class CountersVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    Future<HttpServer> future = Future.future();
    Router router = setupRouter();
    vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
    return future;
}
Also used : HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router)

Aggregations

HttpServer (io.vertx.core.http.HttpServer)81 Router (io.vertx.ext.web.Router)37 HttpServerOptions (io.vertx.core.http.HttpServerOptions)33 Test (org.junit.Test)22 JsonObject (io.vertx.core.json.JsonObject)17 HttpClient (io.vertx.core.http.HttpClient)13 Future (io.vertx.core.Future)12 Vertx (io.vertx.core.Vertx)12 HttpServerResponse (io.vertx.core.http.HttpServerResponse)12 CountDownLatch (java.util.concurrent.CountDownLatch)12 Buffer (io.vertx.core.buffer.Buffer)11 HttpMethod (io.vertx.core.http.HttpMethod)10 Handler (io.vertx.core.Handler)9 VertxOptions (io.vertx.core.VertxOptions)9 AtomicReference (java.util.concurrent.atomic.AtomicReference)9 HttpClientOptions (io.vertx.core.http.HttpClientOptions)8 List (java.util.List)8 AbstractVerticle (io.vertx.core.AbstractVerticle)7 File (java.io.File)7 AsyncResult (io.vertx.core.AsyncResult)6