Instantly share code, notes, and snippets.

Embed
What would you like to do?
Blog post snippet for implementing event bus
// 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;
}
}
@yashasvigirdhar

This comment has been minimized.

Copy link

yashasvigirdhar commented Mar 5, 2018

Hi Kaushik,

Thanks for the snippet.

Should't it be Subject<Object> _bus ?

@yashasvigirdhar

This comment has been minimized.

Copy link

yashasvigirdhar commented Mar 5, 2018

Also, SerializedSubject is not public anymore ( ref)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment