Building blocks of RxScala
RXScala has three major building blocks or components to perform asynchronous stream programming—Observable, Subscription, and Observer:

Here, we can observe the following things:
- Observable works as a producer; that means it emits the data
- Observer works as a consumer; that means it consumes the data
- Subscription works as a channel between Observable and Observer to emit and consume data through this channel
The following diagram shows the relationship between RxScala components and how they work with each other:

There are two more components to perform the asynchronous data stream processing:
- Subscriber
- Scheduler
Understanding the Observable
It is the Observable
interface that implements the Reactive pattern. It has the subscribe()
method to subscribe the Observer
or Subscriber
to send items and notifications to them:
observable.subscribe(observer) // To subscribe an Observer observable.subscribe(subscriber) // To subscribe an Subscriber
An Observable[T]
instance is...