PublishRelay.create<Intent>() override fun apply(intent: Intent) { intents.accept(intent) } private val store: Observable<Model> = intents .doOnNext { println("Intent:\t\t${it.javaClass.simpleName}") } .map { it.reducer } .scan(Model("Bob", "L'Eponge", 0), { old, reducer -> reducer.invoke(old) }) .doOnNext { println("Model:\t\t${it.firstName}, ${it.lastName}: ${it.score} pts.") } .replay(1) .apply { storeDisposable = connect() } private lateinit var storeDisposable: Disposable override fun model(): Observable<Model> { return store } }