Processor

Processors are the counterparts for Subjects in Flowable. Every type of Subject has its counterpart as processor with backpressure support.

In the previous chapter (Chapter 3Observables, Observers, and Subjects), we started exploring Subject, with the PublishSubject; so, let's do the same here. Let's get started with PublishProcessor.

The following is an example of PublishProcessor:

    fun main(args: Array<String>) { 
      val flowable = listOf("String 1","String 2","String 3", "String 4","String 5").toFlowable()//(1) val processor = PublishProcessor.create<String>()//(2) processor.//(3) subscribe({ println("Subscription 1: $it") runBlocking { delay(1000) } println("Subscription 1 delay") }) processor//(4) .subscribe({ println("Subscription ...

Get Reactive Programming in Kotlin 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.