Search code examples
node.jsvert.xsockjs

Deprecated Vertx Bridge PermittedOptions


I already was able to expose the Vert.x EventBus through a socket regarding the official docs:

https://vertx.io/docs/vertx-sockjs-service-proxy/java/

The purpose is to interact with a NodeJS App. For initial tests, the messages are already working between normal Verticals and the Node App

However, I can see that the class io.vertx.ext.web.handler.sockjs.PermittedOptions is already Deprecated.

This is the snippet

import io.vertx.ext.web.Router;
import io.vertx.ext.web.handler.sockjs.BridgeOptions;
import io.vertx.ext.web.handler.sockjs.PermittedOptions;
import io.vertx.ext.web.handler.sockjs.SockJSHandler;

.
.
.

Router router = Router.router(vertx);

BridgeOptions opts = new BridgeOptions()
                          .addInboundPermitted(new PermittedOptions().setAddress("nodetest"))
                          .addOutboundPermitted(new PermittedOptions().setAddress("nodetest"));

router.mountSubRouter("/eventbus", SockJSHandler.create(vertx).bridge(opts));

vertx.createHttpServer().requestHandler(router).listen(3000, res -> {
      if (res.succeeded())
        promise.complete();
      else
        promise.fail(res.cause());
    });
.
.
.

¿What is the right way to proceed?


Solution

  • the class you mention is duplicated across 2 repositories, the "fix" is just to update the import statement to the right one:

    io.vertx.ext.bridge.PermittedOptions
    

    All the rest should work as expected.