Search in sources :

Example 1 with ServiceBinder

use of io.vertx.serviceproxy.ServiceBinder in project knotx by Cognifide.

the class RequestProcessorKnotVerticle method start.

@Override
public void start() throws Exception {
    LOGGER.info("Starting <{}>", this.getClass().getSimpleName());
    serviceBinder = new ServiceBinder(getVertx());
    consumer = serviceBinder.setAddress(configuration.getAddress()).register(KnotProxy.class, new RequestProcessorKnotProxyImpl());
}
Also used : ServiceBinder(io.vertx.serviceproxy.ServiceBinder) KnotProxy(io.knotx.proxy.KnotProxy) RequestProcessorKnotProxyImpl(io.knotx.gateway.impl.RequestProcessorKnotProxyImpl)

Example 2 with ServiceBinder

use of io.vertx.serviceproxy.ServiceBinder in project knotx by Cognifide.

the class ResponseProviderKnotVerticle method start.

@Override
public void start() throws Exception {
    LOGGER.info("Starting <{}>", this.getClass().getSimpleName());
    serviceBinder = new ServiceBinder(getVertx());
    consumer = serviceBinder.setAddress(configuration.getAddress()).register(KnotProxy.class, new ResponseProviderKnotProxyImpl());
}
Also used : ResponseProviderKnotProxyImpl(io.knotx.gateway.impl.ResponseProviderKnotProxyImpl) ServiceBinder(io.vertx.serviceproxy.ServiceBinder) KnotProxy(io.knotx.proxy.KnotProxy)

Example 3 with ServiceBinder

use of io.vertx.serviceproxy.ServiceBinder in project knotx by Cognifide.

the class HttpServiceAdapterVerticle method start.

@Override
public void start() throws Exception {
    LOGGER.info("Starting <{}>", this.getClass().getSimpleName());
    // register the service proxy on event bus
    serviceBinder = new ServiceBinder(getVertx());
    consumer = serviceBinder.setAddress(configuration.getAddress()).register(AdapterProxy.class, new HttpServiceAdapterProxyImpl(vertx, configuration));
}
Also used : HttpServiceAdapterProxyImpl(io.knotx.adapter.service.http.impl.HttpServiceAdapterProxyImpl) ServiceBinder(io.vertx.serviceproxy.ServiceBinder) AdapterProxy(io.knotx.proxy.AdapterProxy)

Example 4 with ServiceBinder

use of io.vertx.serviceproxy.ServiceBinder in project knotx by Cognifide.

the class ActionKnotProxyVerticleTest method createMockAdapter.

private void createMockAdapter(String address, String addToBody, String signal, Map<String, List<String>> headers) {
    Func1<AdapterRequest, AdapterResponse> adapter = adapterRequest -> {
        ClientResponse response = new ClientResponse();
        response.setStatusCode(HttpResponseStatus.OK.code());
        response.setBody(Buffer.buffer().appendString(addToBody));
        response.setHeaders(headers.keySet().stream().collect(MultiMapCollector.toMultiMap(o -> o, headers::get)));
        return new AdapterResponse().setResponse(response).setSignal(signal);
    };
    new ServiceBinder(vertx.vertx()).setAddress(address).register(AdapterProxy.class, new MockAdapterImpl(adapter));
}
Also used : TestContext(io.vertx.ext.unit.TestContext) Async(io.vertx.ext.unit.Async) Arrays(java.util.Arrays) KnotContext(io.knotx.dataobjects.KnotContext) Fragment(io.knotx.dataobjects.Fragment) AdapterProxy(io.knotx.proxy.AdapterProxy) ServiceBinder(io.vertx.serviceproxy.ServiceBinder) RunWith(org.junit.runner.RunWith) MultiMapCollector(io.knotx.http.MultiMapCollector) Logback(io.knotx.junit.rule.Logback) Action1(rx.functions.Action1) Parser(org.jsoup.parser.Parser) ClientResponse(io.knotx.dataobjects.ClientResponse) Vertx(io.vertx.reactivex.core.Vertx) Func1(rx.functions.Func1) Lists(com.google.common.collect.Lists) AdapterRequest(io.knotx.dataobjects.AdapterRequest) FileReader(io.knotx.junit.util.FileReader) Map(java.util.Map) AsyncResult(io.vertx.core.AsyncResult) KnotxConfiguration(io.knotx.junit.rule.KnotxConfiguration) TestVertxDeployer(io.knotx.junit.rule.TestVertxDeployer) KnotProxy(io.knotx.reactivex.proxy.KnotProxy) KnotContextFactory(io.knotx.junit.util.KnotContextFactory) HttpResponseStatus(io.netty.handler.codec.http.HttpResponseStatus) Test(org.junit.Test) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) Consumer(io.reactivex.functions.Consumer) Future(io.vertx.core.Future) RuleChain(org.junit.rules.RuleChain) MultiMap(io.vertx.reactivex.core.MultiMap) List(java.util.List) Rule(org.junit.Rule) AdapterResponse(io.knotx.dataobjects.AdapterResponse) Buffer(io.vertx.core.buffer.Buffer) HttpMethod(io.vertx.core.http.HttpMethod) Document(org.jsoup.nodes.Document) Optional(java.util.Optional) Entities(org.jsoup.nodes.Entities) Jsoup(org.jsoup.Jsoup) Handler(io.vertx.core.Handler) RunTestOnContext(io.vertx.ext.unit.junit.RunTestOnContext) Collections(java.util.Collections) ClientResponse(io.knotx.dataobjects.ClientResponse) AdapterRequest(io.knotx.dataobjects.AdapterRequest) ServiceBinder(io.vertx.serviceproxy.ServiceBinder) AdapterResponse(io.knotx.dataobjects.AdapterResponse)

Example 5 with ServiceBinder

use of io.vertx.serviceproxy.ServiceBinder in project knotx by Cognifide.

the class FilesystemRepositoryConnectorVerticle method start.

@Override
public void start() throws Exception {
    LOGGER.info("Starting <{}>", this.getClass().getSimpleName());
    // register the service proxy on event bus
    serviceBinder = new ServiceBinder(getVertx());
    consumer = serviceBinder.setAddress(address).register(RepositoryConnectorProxy.class, new FilesystemRepositoryConnectorProxyImpl(vertx, config()));
}
Also used : ServiceBinder(io.vertx.serviceproxy.ServiceBinder) RepositoryConnectorProxy(io.knotx.proxy.RepositoryConnectorProxy) FilesystemRepositoryConnectorProxyImpl(io.knotx.repository.impl.FilesystemRepositoryConnectorProxyImpl)

Aggregations

ServiceBinder (io.vertx.serviceproxy.ServiceBinder)15 KnotProxy (io.knotx.proxy.KnotProxy)8 AdapterProxy (io.knotx.proxy.AdapterProxy)3 RepositoryConnectorProxy (io.knotx.proxy.RepositoryConnectorProxy)2 DatabaseService (com.bob.vertx.webapi.service.DatabaseService)1 Lists (com.google.common.collect.Lists)1 HttpActionAdapterProxyImpl (io.knotx.adapter.action.http.impl.HttpActionAdapterProxyImpl)1 HttpServiceAdapterProxyImpl (io.knotx.adapter.service.http.impl.HttpServiceAdapterProxyImpl)1 AdapterRequest (io.knotx.dataobjects.AdapterRequest)1 AdapterResponse (io.knotx.dataobjects.AdapterResponse)1 ClientResponse (io.knotx.dataobjects.ClientResponse)1 Fragment (io.knotx.dataobjects.Fragment)1 KnotContext (io.knotx.dataobjects.KnotContext)1 GatewayKnotProxyImpl (io.knotx.gateway.impl.GatewayKnotProxyImpl)1 RequestProcessorKnotProxyImpl (io.knotx.gateway.impl.RequestProcessorKnotProxyImpl)1 ResponseProviderKnotProxyImpl (io.knotx.gateway.impl.ResponseProviderKnotProxyImpl)1 MultiMapCollector (io.knotx.http.MultiMapCollector)1 KnotxConfiguration (io.knotx.junit.rule.KnotxConfiguration)1 Logback (io.knotx.junit.rule.Logback)1 TestVertxDeployer (io.knotx.junit.rule.TestVertxDeployer)1