Search in sources :

Example 16 with Port

use of com.predic8.wsdl.Port in project service-proxy by membrane.

the class LBNotificationClient method run.

public void run(String[] args) throws Exception {
    CommandLine cl = new DefaultParser().parse(getOptions(), args, false);
    if (cl.hasOption('h') || args.length < 2) {
        printUsage();
        return;
    }
    parseArguments(cl);
    logArguments();
    Response res = notifiyClusterManager();
    if (res.getStatusCode() != 204) {
        throw new Exception("Got StatusCode: " + res.getStatusCode());
    }
    log.info("Sent " + cmd + " message to " + host + ":" + port + (skeySpec != null ? " encrypted" : ""));
}
Also used : Response(com.predic8.membrane.core.http.Response)

Example 17 with Port

use of com.predic8.wsdl.Port in project service-proxy by membrane.

the class EtcdBasedConfigurator method shutdownRunningClusterNode.

private void shutdownRunningClusterNode(EtcdNodeInformation node) {
    log.info("Destroying " + node);
    ServiceProxy sp = runningServiceProxyForModule.get(node.getModule());
    LoadBalancingInterceptor lbi = (LoadBalancingInterceptor) sp.getInterceptors().get(0);
    lbi.getClusterManager().removeNode(Balancer.DEFAULT_NAME, baseUrl, port);
    runningNodesForModule.get(node.getModule()).remove(node);
}
Also used : LoadBalancingInterceptor(com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor) ServiceProxy(com.predic8.membrane.core.rules.ServiceProxy)

Example 18 with Port

use of com.predic8.wsdl.Port in project service-proxy by membrane.

the class EtcdBasedConfigurator method setUpModuleServiceProxy.

private ServiceProxy setUpModuleServiceProxy(String name, int port, String path) {
    log.info("Creating serviceProxy for module: " + path);
    ServiceProxyKey key = new ServiceProxyKey("*", "*", path, port);
    key.setUsePathPattern(true);
    key.setPathRegExp(false);
    ServiceProxy sp = new ServiceProxy(key, null, 0);
    sp.getInterceptors().add(new LoadBalancingInterceptor());
    try {
        sp.init(router);
        router.add(sp);
        runningServiceProxyForModule.put(path, sp);
    } catch (Exception ignored) {
    }
    return sp;
}
Also used : LoadBalancingInterceptor(com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor) ServiceProxyKey(com.predic8.membrane.core.rules.ServiceProxyKey) ServiceProxy(com.predic8.membrane.core.rules.ServiceProxy) BeansException(org.springframework.beans.BeansException)

Example 19 with Port

use of com.predic8.wsdl.Port in project service-proxy by membrane.

the class MultipleLoadBalancersTest method createBalancingInterceptor.

private LoadBalancingInterceptor createBalancingInterceptor(int port, String name) throws Exception {
    ServiceProxy sp3 = new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", port), "thomas-bayer.com", 80);
    LoadBalancingInterceptor balancingInterceptor1 = new LoadBalancingInterceptor();
    balancingInterceptor1.setName(name);
    sp3.getInterceptors().add(balancingInterceptor1);
    balancer.getRuleManager().addProxyAndOpenPortIfNew(sp3);
    balancer.init();
    return balancingInterceptor1;
}
Also used : LoadBalancingInterceptor(com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor) ServiceProxyKey(com.predic8.membrane.core.rules.ServiceProxyKey) ServiceProxy(com.predic8.membrane.core.rules.ServiceProxy)

Example 20 with Port

use of com.predic8.wsdl.Port in project service-proxy by membrane.

the class WSDLPublisherTest method before.

@Before
public void before() throws Exception {
    router = new HttpRouter();
    ServiceProxy sp2 = new ServiceProxy(new ServiceProxyKey("*", "*", ".*", port), "", -1);
    WSDLPublisherInterceptor wi = new WSDLPublisherInterceptor();
    wi.setWsdl(wsdlLocation);
    wi.init(router);
    sp2.getInterceptors().add(wi);
    router.getRuleManager().addProxyAndOpenPortIfNew(sp2);
    router.init();
}
Also used : ServiceProxyKey(com.predic8.membrane.core.rules.ServiceProxyKey) ServiceProxy(com.predic8.membrane.core.rules.ServiceProxy) HttpRouter(com.predic8.membrane.core.HttpRouter) Before(org.junit.Before)

Aggregations

ServiceProxy (com.predic8.membrane.core.rules.ServiceProxy)9 Test (org.junit.Test)7 ServiceProxyKey (com.predic8.membrane.core.rules.ServiceProxyKey)6 StringWriter (java.io.StringWriter)6 Exchange (com.predic8.membrane.core.exchange.Exchange)5 Rule (com.predic8.membrane.core.rules.Rule)5 Process2 (com.predic8.membrane.examples.Process2)5 File (java.io.File)5 ProxyRule (com.predic8.membrane.core.rules.ProxyRule)4 HttpRouter (com.predic8.membrane.core.HttpRouter)3 Request (com.predic8.membrane.core.http.Request)3 Response (com.predic8.membrane.core.http.Response)3 LoadBalancingInterceptor (com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor)3 Node (com.predic8.membrane.core.interceptor.balancer.Node)3 Definitions (com.predic8.wsdl.Definitions)3 Port (com.predic8.wsdl.Port)3 ArrayList (java.util.ArrayList)3 EtcdNodeInformation (com.predic8.membrane.core.cloud.etcd.EtcdNodeInformation)2 IPortChangeListener (com.predic8.membrane.core.model.IPortChangeListener)2 AbstractServiceProxy (com.predic8.membrane.core.rules.AbstractServiceProxy)2