SafeDK
Sign upAdd Your SDK

Relays are RxJava types which are both an Observable and a Consumer.

Basically: A Subject except without the ability to call onComplete or onError.

Subjects are useful to bridge the gap between non-Rx APIs. However, they are stateful in a damaging way: when they receive an onComplete or onError they no longer become usable for moving data. This is the observable contract and sometimes it is the desired behavior. Most times it is not.

Relays are simply Subjects without the aforementioned property. They allow you to bridge non-Rx APIs into Rx easily, and without the worry of accidentally triggering a terminal state.

As more of your code moves to reactive, the need for Subjects and Relays should diminish. In the transitional period, or for quickly adapting a non-Rx API, Relays provide the convenience of Subjects without the worry of the statefulness of terminal event behavior.

SDK for Android

Similar SDKs

MORE

Reviews

Rate Now
0
0
0
0
0
0

Start a new discussion about RxRelay

×
0
/1000

More from this Developer

MORE
Login