4 Asynchronous data and event streams

This chapter covers

  • Why streams are a useful abstraction on top of eventing
  • What back-pressure is, and why it is fundamental for asynchronous producers and consumers
  • How to parse protocol data from streams

So far we have been processing events using callbacks, and from various sources such as HTTP or TCP servers. Callbacks allow us to reason about events one at a time.

Processing an incoming data buffer from a TCP connection, from a file, or from an HTTP request is not very different: you need to declare a callback handler that reacts to each event and allows custom processing.

That being said, most events need to be processed as a series rather than as isolated events. Processing the body of an HTTP ...

Get Vert.x in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.