June 2018
Intermediate to advanced
310 pages
6h 32m
English
To solve communication problems, Vert.x uses EventBus. It's an implementation of the Observable design pattern we discussed in Chapter 4, Getting Familiar with Behavioral Patterns. Any verticle can send a message over the event bus, choosing between these two modes:
No matter which method is used to send the message, you subscribe to it using the consumer() method on the EventBus:
const val CATS = "cats:get"class CatVerticle : CoroutineVerticle() { override suspend fun start() { val db = getDbClient() vertx.eventBus().consumer<JsonObject>(CATS) { req -> ... } }}
The type specifies which object we expect to receive our message. In ...
Read now
Unlock full access