Created
May 30, 2018 13:42
-
-
Save teivah/b16c9aa20243fd2a61d1b07c66bed90b 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
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()); | |
//Enrich the customer object | |
JsonObject enrichedCustomer = enrichCustomer(json.body()); | |
//Publish (one-to-many) the enriched message on another endpoint | |
eventBus.publish("customer.completion", enrichedCustomer); | |
}); | |
startFuture.complete(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment