Created
June 26, 2016 05:36
-
-
Save kaushikgopal/66d5b3d1a8f630811371910150dca43d to your computer and use it in GitHub Desktop.
Blog post snippet for implementing event bus
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
// this is the middleman object | |
public class RxBus { | |
private final Subject<Object, Object> _bus = new SerializedSubject<>(PublishSubject.create()); | |
public void send(Object o) { | |
_bus.onNext(o); | |
} | |
public Observable<Object> toObserverable() { | |
return _bus; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Kaushik,
Thanks for the snippet.
Should't it be
Subject<Object> _bus
?