Created
April 23, 2015 07:06
-
-
Save beders/7849cce449098d7e2de2 to your computer and use it in GitHub Desktop.
Bridging event bus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.saffrontech.ws.vertx.problem; | |
import io.vertx.core.AbstractVerticle; | |
import io.vertx.core.DeploymentOptions; | |
import io.vertx.core.Vertx; | |
import io.vertx.ext.apex.Router; | |
import io.vertx.ext.apex.handler.sockjs.BridgeOptions; | |
import io.vertx.ext.apex.handler.sockjs.SockJSHandler; | |
// curl http://localhost:8888/eventbus/info | |
public class Server extends AbstractVerticle { | |
public static void main(String[] args) { | |
Vertx vertx = Vertx.vertx(); | |
vertx.deployVerticle(Server.class.getName(), new DeploymentOptions()); | |
} | |
@Override | |
public void start() throws Exception { | |
Router router = Router.router(vertx); | |
SockJSHandler sockJSHandler = SockJSHandler.create(vertx); | |
BridgeOptions options = new BridgeOptions(); | |
sockJSHandler.bridge(options); | |
router.route("/eventbus").handler(sockJSHandler); | |
vertx.createHttpServer().requestHandler(router::accept).listen(8888); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment