Search in sources :

Example 1 with ProcessorServiceImpl

use of io.vertx.examples.service.impl.ProcessorServiceImpl in project vertx-examples by vert-x3.

the class ProcessorServiceVerticle method start.

@Override
public void start() throws Exception {
    // Create the client object
    service = new ProcessorServiceImpl();
    // Register the handler
    ProxyHelper.registerService(ProcessorService.class, vertx, service, "vertx.processor");
    // 
    Router router = Router.router(vertx);
    // Allow events for the designated addresses in/out of the event bus bridge
    BridgeOptions opts = new BridgeOptions().addInboundPermitted(new PermittedOptions().setAddress("vertx.processor")).addOutboundPermitted(new PermittedOptions().setAddress("vertx.processor"));
    // Create the event bus bridge and add it to the router.
    SockJSHandler ebHandler = SockJSHandler.create(vertx).bridge(opts);
    router.route("/eventbus/*").handler(ebHandler);
    // 
    router.route().handler(StaticHandler.create());
    // 
    vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
Also used : ProcessorServiceImpl(io.vertx.examples.service.impl.ProcessorServiceImpl) Router(io.vertx.ext.web.Router) BridgeOptions(io.vertx.ext.web.handler.sockjs.BridgeOptions) PermittedOptions(io.vertx.ext.web.handler.sockjs.PermittedOptions) SockJSHandler(io.vertx.ext.web.handler.sockjs.SockJSHandler)

Aggregations

ProcessorServiceImpl (io.vertx.examples.service.impl.ProcessorServiceImpl)1 Router (io.vertx.ext.web.Router)1 BridgeOptions (io.vertx.ext.web.handler.sockjs.BridgeOptions)1 PermittedOptions (io.vertx.ext.web.handler.sockjs.PermittedOptions)1 SockJSHandler (io.vertx.ext.web.handler.sockjs.SockJSHandler)1