3 Event bus: The backbone of a Vert.x application

 

This chapter covers

  • What the event bus is
  • How to have point-to-point, request-reply, and publish/subscribe communications over the event bus
  • The distributed event bus for verticle-to-verticle communication across the network

The previous chapter introduced verticles. A Vert.x application is made up of one or more verticles, and each verticle forms a unit for processing asynchronous events. It is common to specialize verticles by functional and technical concerns, such as having one verticle for exposing an HTTP API and another for dealing with a data store. This design also encourages the deployment of several instances of a given verticle for scalability purposes.

What we have not covered yet is how verticles can communicate with each other. For example, an HTTP API verticle needs to talk to the data store verticle if the larger Vert.x application is to do anything useful.

Connecting verticles and making sure they can cooperate is the role of the event bus. This is important when building reactive applications--the event bus offers a way to transparently distribute event-processing work both inside a process and across several nodes over the network.

3.1 What is the event bus?

3.1.1 Is the event bus just another message broker?

3.1.2 Point-to-point messaging

3.1.3 Request-reply messaging

3.1.4 Publish/subscribe messaging

3.2 The event bus in an example

3.2.1 Heat sensor verticle

3.2.2 Listener verticle

3.2.3 Sensor data verticle

3.2.4 HTTP server verticle

3.2.5 Bootstrapping the application

3.3 Clustering and the distributed event bus

3.3.1 Clustering in Vert.x

3.3.2 From event bus to distributed event bus

Summary

sitemap