Is there a way to split an `Observable` by a filte...
# rx
l
Is there a way to split an
Observable
by a filter without subscribing more than once? I have a sealed class that represents an
Event
, but I need to filter the results to various handlers. My naive method was:
Copy code
val eventStream: Observable<Event> = getEventStream() // Observable representing long running operation

eventStream
    .filter { it is Event.Success }
    .subscribe { 
        // Handle success
    }

eventStream
    .filter { it is Event.Failure }
    .subscribe {
        // Handle failure 
    }
There are more cases, but the problem is described in these. I don't want to kick off the long running operation twice, which this seems like it would do.