Search in sources :

Example 1 with VertxServerBuilder

use of io.vertx.grpc.VertxServerBuilder in project vertx-zero by silentbalanceyh.

the class ZeroRpcAgent method start.

@Override
public void start() {
    /**
     * 1. Iterate all the configuration *
     */
    Fn.itMap(ZeroAtomic.RPC_OPTS, (port, config) -> {
        /**
         * 2.Rcp server builder initialized *
         */
        final VertxServerBuilder builder = VertxServerBuilder.forAddress(this.vertx, config.getHost(), config.getPort());
        /**
         * 3.Service added.
         */
        {
            // UnityService add ( Envelop )
            final Tunnel tunnel = Instance.singleton(UnityTunnel.class);
            builder.addService(tunnel.init(this.vertx));
        }
        /**
         * 4.Server added.
         */
        final VertxServer server = builder.build();
        server.start(handler -> this.registryServer(handler, config));
    });
}
Also used : VertxServerBuilder(io.vertx.grpc.VertxServerBuilder) Tunnel(io.vertx.up.micro.ipc.server.Tunnel) UnityTunnel(io.vertx.up.micro.ipc.server.UnityTunnel) UnityTunnel(io.vertx.up.micro.ipc.server.UnityTunnel) VertxServer(io.vertx.grpc.VertxServer)

Aggregations

VertxServer (io.vertx.grpc.VertxServer)1 VertxServerBuilder (io.vertx.grpc.VertxServerBuilder)1 Tunnel (io.vertx.up.micro.ipc.server.Tunnel)1 UnityTunnel (io.vertx.up.micro.ipc.server.UnityTunnel)1