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
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
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.
Never share an event stream between two reactors. An event stream can only be used by the reactor that owns the corresponding channel.
In the following, we show an example event stream called
myEvents, which produces events of type
val myEvents: Events[String...