use of com.predic8.membrane.core.rules.ServiceProxy 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);
}
use of com.predic8.membrane.core.rules.ServiceProxy 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;
}
use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class EtcdPublisher method readConfig.
public void readConfig() {
nodesFromConfig.clear();
for (Rule rule : router.getRuleManager().getRules()) {
if (!(rule instanceof ServiceProxy))
continue;
ServiceProxy sp = (ServiceProxy) rule;
if (sp.getPath() == null)
continue;
nodesFromConfig.add(new EtcdNodeInformation(sp.getPath().getValue(), "/" + UUID.randomUUID().toString(), "localhost", Integer.toString(sp.getPort()), sp.getName()));
}
}
use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class UnavailableSoapProxyTest method setup.
@Before
public void setup() {
r = new Router();
HttpClientConfiguration httpClientConfig = new HttpClientConfiguration();
httpClientConfig.setMaxRetries(1);
r.setHttpClientConfig(httpClientConfig);
r.setHotDeploy(false);
r.setRetryInit(true);
sp = new SOAPProxy();
sp.setPort(2000);
sp.setWsdl("http://localhost:2001/axis2/services/BLZService?wsdl");
sp3 = new ServiceProxy();
sp3.setPort(2000);
sp3.setTarget(new AbstractServiceProxy.Target("localhost", 2001));
ValidatorInterceptor v = new ValidatorInterceptor();
v.setWsdl("http://localhost:2001/axis2/services/BLZService?wsdl");
sp3.getInterceptors().add(v);
SOAPProxy sp2 = new SOAPProxy();
sp2.setPort(2001);
sp2.setWsdl("http://www.thomas-bayer.com/axis2/services/BLZService?wsdl");
r2 = new Router();
r2.setHotDeploy(false);
r2.getRules().add(sp2);
// r2 will be started during the test
}
use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class ExceptionHandlingTest method setUp.
@Before
public void setUp() throws Exception {
router = new HttpRouter();
router.getTransport().setPrintStackTrace(printStackTrace);
ServiceProxy sp2 = new ServiceProxy(new ServiceProxyKey("*", "*", ".*", getPort()), "", -1);
sp2.getInterceptors().add(new AbstractInterceptor() {
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
throw new Exception("secret");
}
});
router.getRuleManager().addProxyAndOpenPortIfNew(sp2);
router.init();
}
Aggregations