Search in sources :

Example 1 with Vertx

use of org.vertx.java.core.Vertx in project fabric8 by jboss-fuse.

the class FabricHTTPGateway method updateConfiguration.

private void updateConfiguration(Map<String, ?> configuration) throws Exception {
    configurer.configure(configuration, this);
    Vertx vertx = getVertx();
    handler = new HttpGatewayHandler(vertx, this);
    handler.setAddMissingTrailingSlashes(addMissingTrailingSlashes);
    handler.setConnectionTimeout(connectionTimeout);
    handler.setRequestTimeout(requestTimeout);
    websocketHandler.setPathPrefix(websocketGatewayPrefix);
    server = new HttpGatewayServer(vertx, handler, enableWebSocketGateway ? websocketHandler : null, port);
    server.init();
}
Also used : HttpGatewayServer(io.fabric8.gateway.handlers.http.HttpGatewayServer) HttpGatewayHandler(io.fabric8.gateway.handlers.http.HttpGatewayHandler) Vertx(org.vertx.java.core.Vertx)

Example 2 with Vertx

use of org.vertx.java.core.Vertx in project fabric8 by jboss-fuse.

the class FabricMQGateway method createListener.

protected GatewayServiceTreeCache createListener() {
    String zkPath = getZooKeeperPath();
    // TODO we should discover the broker group configuration here using the same
    // mq-create / mq-client profiles so that we only listen to a subset of the available brokers here?
    ServiceMap serviceMap = new ServiceMap();
    VertxService vertxService = getVertxService();
    Vertx vertx = vertxService.getVertx();
    CuratorFramework curator = getCurator();
    LoadBalancer pathLoadBalancer = LoadBalancers.createLoadBalancer(loadBalancerType, stickyLoadBalancerCacheSize);
    LoadBalancer serviceLoadBalancer = LoadBalancers.createLoadBalancer(loadBalancerType, stickyLoadBalancerCacheSize);
    LOG.info("activating MQ mapping ZooKeeper path: " + zkPath + " host: " + host + " with load balancer: " + pathLoadBalancer);
    List<TcpGateway> gateways = new ArrayList<TcpGateway>();
    addGateway(gateways, vertx, serviceMap, "tcp", isOpenWireEnabled(), getOpenWirePort(), pathLoadBalancer, serviceLoadBalancer);
    addGateway(gateways, vertx, serviceMap, "stomp", isStompEnabled(), getStompPort(), pathLoadBalancer, serviceLoadBalancer);
    addGateway(gateways, vertx, serviceMap, "amqp", isAmqpEnabled(), getAmqpPort(), pathLoadBalancer, serviceLoadBalancer);
    addGateway(gateways, vertx, serviceMap, "mqtt", isMqttEnabled(), getMqttPort(), pathLoadBalancer, serviceLoadBalancer);
    addGateway(gateways, vertx, serviceMap, "ws", isWebsocketEnabled(), getWebsocketPort(), pathLoadBalancer, serviceLoadBalancer);
    if (gateways.isEmpty()) {
        return null;
    }
    return new GatewayServiceTreeCache(curator, zkPath, serviceMap, gateways);
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) ServiceMap(io.fabric8.gateway.ServiceMap) TcpGateway(io.fabric8.gateway.handlers.tcp.TcpGateway) VertxService(io.fabric8.gateway.fabric.support.vertx.VertxService) ArrayList(java.util.ArrayList) LoadBalancer(io.fabric8.gateway.loadbalancer.LoadBalancer) Vertx(org.vertx.java.core.Vertx)

Aggregations

Vertx (org.vertx.java.core.Vertx)2 ServiceMap (io.fabric8.gateway.ServiceMap)1 VertxService (io.fabric8.gateway.fabric.support.vertx.VertxService)1 HttpGatewayHandler (io.fabric8.gateway.handlers.http.HttpGatewayHandler)1 HttpGatewayServer (io.fabric8.gateway.handlers.http.HttpGatewayServer)1 TcpGateway (io.fabric8.gateway.handlers.tcp.TcpGateway)1 LoadBalancer (io.fabric8.gateway.loadbalancer.LoadBalancer)1 ArrayList (java.util.ArrayList)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1