Reactor in Java
https://projectreactor.io/docs/core/release/reference/#intro-reactive
- iterator is pull based; reactive streams is push based
- Publisher-subscriber: values are push to subscriber and subscriber are react to them
- Nth happen until someone subscribe
- Flux: 0..n items
- Mono: 0..1 items
- Subscriber’s onNext, onError, onComplete
- Subscriber can apply back pressure to upstream producer: by calling request method to notify the count
- request() default to unbound
- Async does not mean parallel
- By default, operator runs on the same threads as the previous operator; the source runs on the same thread as the subscribe calls
- Scheduler: define the threads the operators run
- ? as per the specification, onNext calls happen in sequence, so this uses up a single thread
- subdcribeOn() only affect the initial subscription process. PublishOn will affect the schedulers of all subsequent operators