Event streams

In this section, we study the basic data-type that drives most computations in the Reactors framework: an event stream. Event streams represent special program values that can occasionally produce events. Event streams are represented by the Event[T] type.

Semantically, an event stream is very similar to the Observable type, which we saw in Chapter 6, Concurrent Programming with Reactive Extensions. As we will see, the main difference between Observable and Events is that an Observable object can generally be used from different threads, and even emit events across different threads when the observeOn method is used. An Events object, by contrast, can only be used inside the reactor that owns that event stream.

Tip

Never share an event ...

Get Learning Concurrent Programming in Scala - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.