Skip to content

Instantly share code, notes, and snippets.

View teivah's full-sized avatar
Building my newsletter: The Coder Cafe

Teiva Harsanyi teivah

Building my newsletter: The Coder Cafe
View GitHub Profile
public void start(Future<Void> startFuture) {
//Retrieve the EventBus object form the vertx one
EventBus eventBus = vertx.eventBus();
//Create a EventBus consumer and instantiate a JsonObject type message consumer
MessageConsumer<JsonObject> createConsumer = eventBus.consumer("customer.create");
//Handle new messages on customer.create endpoint
createConsumer.handler(json -> {
System.out.println("Received new customer: " + json.body());
EventBus eventBus = vertx.eventBus();
public void start(Future<Void> startFuture) {
//Retrieve the EventBus object form the vertx one
EventBus eventBus = vertx.eventBus();
//Create a EventBus consumer and instantiate a JsonObject type message consumer
MessageConsumer<JsonObject> createConsumer = eventBus.consumer("customer.create");
//Handle new messages on customer.create endpoint
createConsumer.handler(json -> {
System.out.println("Received new customer: " + json.body());
MessageConsumer<JsonObject> createConsumer = eventBus.consumer("customer.create");
createConsumer.handler(json -> {
});
eventBus.publish("customer.completion", enrichedCustomer);
vertx.deployVerticle("org.enterpriseintegration.Standard",
// Instantiate a DeploymentOptions by setting an explicit number
// of instances and referencing a JSON configuration
new DeploymentOptions().setInstances(instances).setConfig(config), res -> {
if (res.succeeded()) {
System.out.println("Standard verticle deployed");
// Send messages on the event bus
EventBus eventBus = vertx.eventBus();
eventBus.publish("event", "event01");
vertx.deployVerticle("org.enterpriseintegration.Worker",
// Instantiate a DeploymentOptions by setting an explicit number
// of instances and enabling worker code
new DeploymentOptions().setInstances(instances).setWorker(true), res -> {
if (res.succeeded()) {
System.out.println("Worker verticle deployed");
// Send messages on the event bus
EventBus eventBus = vertx.eventBus();
eventBus.publish("event", "event01");
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();
gosiris.InitActorSystem(gosiris.SystemOptions{
ActorSystemName: "ActorSystem",
})
defer gosiris.CloseActorSystem()