Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Rxpermissions | 10,253 | 2 years ago | 1 | March 13, 2020 | 92 | apache-2.0 | Java | |||
Android runtime permissions powered by RxJava2 | ||||||||||
Rxkotlin | 6,925 | 911 | 56 | 4 months ago | 11 | July 28, 2019 | 30 | apache-2.0 | Kotlin | |
RxJava bindings for Kotlin | ||||||||||
Rxjava2 Android Samples | 4,977 | 4 months ago | 18 | apache-2.0 | Java | |||||
RxJava 2 Android Examples - How to use RxJava 2 in Android | ||||||||||
Awesome Rxjava | 4,834 | 2 years ago | 5 | |||||||
RxJava resources | ||||||||||
Rxdocs | 3,709 | 5 years ago | 1 | |||||||
Rx和RxJava文档中文翻译项目 | ||||||||||
Rxjava2examples | 2,763 | 4 years ago | 5 | Java | ||||||
:fire:RxJava2 Examples —— 这可能是从 RxJava1 跳到 RxJava2(学习 RxJava2 )最好的例子 Demo:https://github.com/nanchen2251/RxJava2Examples | ||||||||||
Reactivenetwork | 2,508 | 75 | 6 months ago | 28 | September 17, 2019 | 36 | apache-2.0 | Java | ||
Android library listening network connection state and Internet connectivity with RxJava Observables | ||||||||||
Rxrelay | 2,436 | 269 | 17 | 2 years ago | 3 | August 23, 2019 | apache-2.0 | Java | ||
RxJava types that are both an Observable and a Consumer. | ||||||||||
Android Reactivelocation | 2,117 | 117 | 1 | 3 years ago | 11 | September 29, 2017 | 32 | Java | ||
Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum. | ||||||||||
Frodo | 1,494 | 5 years ago | 14 | Java | ||||||
Android Library for Logging RxJava Observables and Subscribers. |
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.
BehaviorRelay
Relay that emits the most recent item it has observed and all subsequent observed items to each
subscribed Observer
.
// observer will receive all events.
BehaviorRelay<Object> relay = BehaviorRelay.createDefault("default");
relay.subscribe(observer);
relay.accept("one");
relay.accept("two");
relay.accept("three");
// observer will receive the "one", "two" and "three" events, but not "zero"
BehaviorRelay<Object> relay = BehaviorRelay.createDefault("default");
relay.accept("zero");
relay.accept("one");
relay.subscribe(observer);
relay.accept("two");
relay.accept("three");
PublishRelay
Relay that, once an Observer
has subscribed, emits all subsequently observed items to the
subscriber.
PublishRelay<Object> relay = PublishRelay.create();
// observer1 will receive all events
relay.subscribe(observer1);
relay.accept("one");
relay.accept("two");
// observer2 will only receive "three"
relay.subscribe(observer2);
relay.accept("three");
ReplayRelay
Relay that buffers all items it observes and replays them to any Observer
that subscribes.
ReplayRelay<Object> relay = ReplayRelay.create();
relay.accept("one");
relay.accept("two");
relay.accept("three");
// both of the following will get the events from above
relay.subscribe(observer1);
relay.subscribe(observer2);
All relays use the Relay
base class which also allows custom implementations.
See the Javadoc for more information.
(There is no AsyncRelay
since relays have no terminal events to support its behavior.)
Gradle:
implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1'
Maven:
<dependency>
<groupId>com.jakewharton.rxrelay3</groupId>
<artifactId>rxrelay</artifactId>
<version>3.0.1</version>
</dependency>
Snapshots of the development version are available in Sonatype's snapshots
repository.
Copyright 2014 Netflix, Inc.
Copyright 2015 Jake Wharton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.