Skip to content

Instantly share code, notes, and snippets.

@cbruegg
Last active February 19, 2019 09:10
Show Gist options
  • Save cbruegg/e4d11e542207c5c9aa3eeab03950afa3 to your computer and use it in GitHub Desktop.
Save cbruegg/e4d11e542207c5c9aa3eeab03950afa3 to your computer and use it in GitHub Desktop.
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