Last active
March 26, 2019 21:53
-
-
Save josuf107/10a20de85490593e232cd985ca07e699 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final Subject<CurrentJob, CurrentJob> jobSubject = PublishSubject.create(); | |
private final Observable<CurrentJob> jobObservable = jobSubject | |
.flatMap(job -> api call etc...) | |
.doOnNext(job -> job.toReadEvents().forEach(this::processJobReadEvent)); | |
... | |
startDocument() { | |
jobObservable.subscribe(); | |
} | |
endJob() { | |
jobSubject.onNext(currentJob); | |
} | |
endDocument() { | |
jobSubject.onComplete(); | |
jobObservable.??? // wait for the observable to complete. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment