Last active
February 19, 2019 09:10
-
-
Save cbruegg/e4d11e542207c5c9aa3eeab03950afa3 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
interface SootEvent { } | |
class SomeSootEvent implements SootEvent { ... } | |
class Foo { | |
PublishSubject<SootEvent> eventSubject = PublishSubject.create(); | |
void modifyState() { | |
// ... modify some state ... | |
eventSubject.onNext(new SomeSootEvent(...)); | |
} | |
} | |
class EventHandler { | |
void handleEventsOf(PublishSubject<SootEvent> eventSubject) { | |
eventSubject.parallel() | |
.runOn(Schedulers.computation()) | |
.map(event -> someTransformation(event)) | |
.subscribe(transformedEvent -> doSomethingWith(transformedEvent)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment