Skip to content

Instantly share code, notes, and snippets.

@jstrachan
Forked from purplefox/gist:5135685
Last active December 14, 2015 19:19
Show Gist options
  • Save jstrachan/5135696 to your computer and use it in GitHub Desktop.
Save jstrachan/5135696 to your computer and use it in GitHub Desktop.
// Clearly this won't actually work since obs2 would need to be final but then you can't assign it inside the handler
MyEventBus eb = new MyEventBus();
Observable obs1 = eb.send("foo", "msg1");
Observable obs2 = obs1.mapMany(new Func1<String, String>() {
@Override
public void call(String str) {
System.out.println("Got result: " + str);
return eb.send("foo", str);
}
});
obs2.subscribe(new Action1<String>() {
@Override
public void call(String str) {
System.out.println("Got result: " + str);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment