This chapter covers:
- exposing services on top of the event-bus,
- asynchronous testing of verticles and event-bus services.
The event-bus is a fundamental tool for articulating event processing in Vert.x, but there is more to it! Event-bus services are useful to expose typed interfaces rather than plain messaging, especially when multiple message types are expected at an event-bus destination. Testing is also an important concept, and we cover here what is different in testing asynchronous Vert.x code compared to traditional testing.
In this chapter we are going to revisit an earlier example, refactor it to an event-bus service, and show how to test it.
In chapter 3 we had used heat sensors as an example. We had a SensorData
verticle that kept the last observed values for each sensor, and that could compute their average using a request / reply communication on the event-bus. To recall the example, listing 6.1 has the code for computing the temperatures average.