Skip to content

Instantly share code, notes, and snippets.

@teivah
Created May 30, 2018 13:46
Show Gist options
  • Save teivah/58da2a2cfaaa5dcffa19d88b89766100 to your computer and use it in GitHub Desktop.
Save teivah/58da2a2cfaaa5dcffa19d88b89766100 to your computer and use it in GitHub Desktop.
vertx.deployVerticle("org.enterpriseintegration.MTWorker",
// Instantiate a DeploymentOptions by setting an explicit number
// of instances and enabling worker code, multiThreaded mode but
// without having to set the number of instances
new DeploymentOptions().setWorker(true).setMultiThreaded(true), res -> {
if (res.succeeded()) {
System.out.println("Multi-threaded Worker verticle deployed");
// Send messages on the event bus
EventBus eventBus = vertx.eventBus();
eventBus.publish("event", "event01");
eventBus.send("event", "event02");
eventBus.send("event", "event03");
} else {
System.out.println("Error while deploying a verticle: " + res.cause().getMessage());
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment