Created
May 30, 2018 13:46
-
-
Save teivah/58da2a2cfaaa5dcffa19d88b89766100 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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