Examples of DetectingGateway


Examples of io.fabric8.gateway.handlers.detecting.DetectingGateway

        protocols.add(new MqttProtocol());
        protocols.add(new AmqpProtocol());
        protocols.add(new OpenwireProtocol());
        protocols.add(new HttpProtocol());
        protocols.add(new SslProtocol());
        DetectingGateway gateway = new DetectingGateway();
        gateway.setPort(0);
        gateway.setVertx(vertx);
        SslConfig sslConfig = new SslConfig(new File(basedir(), "src/test/resources/server.ks"), "password");
        sslConfig.setKeyPassword("password");
        gateway.setSslConfig(sslConfig);
        gateway.setServiceMap(serviceMap);
        gateway.setProtocols(protocols);
        gateway.setServiceLoadBalancer(serviceLoadBalancer);
        gateway.setDefaultVirtualHost("broker1");
        gateway.setConnectionTimeout(5000);
        if( httpGatewayServer!=null ) {
            gateway.setHttpGateway(new InetSocketAddress("localhost", httpGatewayServer.getPort()));
        }
        gateway.init();

        gateways.add(gateway);
        return gateway;
    }
View Full Code Here

Examples of io.fabric8.gateway.handlers.detecting.DetectingGateway

    @Test
    public void lotsOfClientLoad() throws Exception {

        startRestEndpoint();
        startHttpGateway();
        DetectingGateway gateway = startDetectingGateway();

        final ShutdownTracker tracker = new ShutdownTracker();

        // Run some concurrent load against the broker via the gateway...
        final StompJmsConnectionFactory factory = new StompJmsConnectionFactory();
        factory.setBrokerURI("tcp://localhost:"+gateway.getBoundPort());

        for(int client=0; client<10; client++) {
            new Thread("JMS Client: "+client) {
                @Override
                public void run() {
                    while(tracker.attemptRetain()) {
                        try {
                            Connection connection = factory.createConnection();
                            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                            MessageConsumer consumer = session.createConsumer(session.createTopic("FOO"));
                            MessageProducer producer = session.createProducer(session.createTopic("FOO"));
                            producer.send(session.createTextMessage("Hello"));
                            consumer.receive(1000);
                            connection.close();
                        } catch (JMSException e) {
                            e.printStackTrace();
                        } finally {
                            tracker.release();
                        }
                    }
                }
            }.start();
        }

        int httpPort = gateway.getBoundPort();
        final URL httpUrl = new URL("http://localhost:" + httpPort + "/hello/world");
        for(int client=0; client<10; client++) {
            new Thread("HTTP Client: "+client) {
                @Override
                public void run() {
View Full Code Here

Examples of io.fabric8.gateway.handlers.detecting.DetectingGateway

        }
        shutdownTacker.stop();
    }

    protected DetectingGateway createDetectingGateway() {
        DetectingGateway gateway = new DetectingGateway();
        ArrayList<Protocol> protocols = new ArrayList<Protocol>();
        if( isStompEnabled() ) {
            protocols.add(new StompProtocol());
        }
        if( isMqttEnabled() ) {
            protocols.add(new MqttProtocol());
        }
        if( isAmqpEnabled() ) {
            protocols.add(new AmqpProtocol());
        }
        if( isOpenWireEnabled() ) {
            protocols.add(new OpenwireProtocol());
        }
        if( isHttpEnabled() ) {
            protocols.add(new HttpProtocol());
        }
        if( isSslEnabled() ) {
            SslConfig sslConfig = new SslConfig();
            if( Strings.isNotBlank(sslAlgorithm) ) {
                sslConfig.setAlgorithm(sslAlgorithm);
            }
            if( Strings.isNotBlank(keyAlias) ) {
                sslConfig.setKeyAlias(keyAlias);
            }
            if( Strings.isNotBlank(keyPassword) ) {
                sslConfig.setKeyPassword(keyPassword);
            }
            if( Strings.isNotBlank(keyStorePassword) ) {
                sslConfig.setKeyStorePassword(keyStorePassword);
            }
            if( keyStoreURL!=null ) {
                sslConfig.setKeyStoreURL(keyStoreURL);
            }
            if( Strings.isNotBlank(sslProtocol) ) {
                sslConfig.setProtocol(sslProtocol);
            }
            if( Strings.isNotBlank(sslStoreType) ) {
                sslConfig.setStoreType(sslStoreType);
            }
            if( Strings.isNotBlank(trustStorePassword) ) {
                sslConfig.setTrustStorePassword(trustStorePassword);
            }
            if( trustStoreURL != null ) {
                sslConfig.setTrustStoreURL(trustStoreURL);
            }
            if( Strings.isNotBlank(enabledCipherSuites) ) {
                sslConfig.setEnabledCipherSuites(enabledCipherSuites);
            }
            if( Strings.isNotBlank(disabledCypherSuites) ) {
                sslConfig.setDisabledCypherSuites(disabledCypherSuites);
            }
            gateway.setSslConfig(sslConfig);
            protocols.add(new SslProtocol());
        }

        if (protocols.isEmpty()) {
            return null;
        }

        VertxService vertxService = getVertxService();
        LoadBalancer serviceLoadBalancer = LoadBalancers.createLoadBalancer(loadBalancerType, stickyLoadBalancerCacheSize);
        gateway.setVertx(vertxService.getVertx());
        gateway.setPort(port);
        gateway.setServiceMap(serviceMap);
        gateway.setProtocols(protocols);
        gateway.setShutdownTacker(shutdownTacker);
        gateway.setServiceLoadBalancer(serviceLoadBalancer);
        gateway.setDefaultVirtualHost(defaultVirtualHost);
        return gateway;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.