https://github.com/pwittchen/reactivebus
🚍 Reactive Event Bus for JVM (1.7+) and Android apps built with RxJava 2
https://github.com/pwittchen/reactivebus
bus event eventbus rxandroid rxandroid2 rxjava rxjava2
Last synced: 5 months ago
JSON representation
🚍 Reactive Event Bus for JVM (1.7+) and Android apps built with RxJava 2
- Host: GitHub
- URL: https://github.com/pwittchen/reactivebus
- Owner: pwittchen
- License: apache-2.0
- Created: 2017-07-22T11:16:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-03-16T11:20:57.000Z (almost 6 years ago)
- Last Synced: 2025-04-13T12:40:04.788Z (11 months ago)
- Topics: bus, event, eventbus, rxandroid, rxandroid2, rxjava, rxjava2
- Language: Java
- Homepage:
- Size: 148 KB
- Stars: 18
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ReactiveBus [](https://travis-ci.org/pwittchen/ReactiveBus) [](https://codecov.io/gh/pwittchen/ReactiveBus)  [](https://android-arsenal.com/details/1/6838)
🚍 Simple Reactive Event Bus for JVM (1.7+) and Android apps built with RxJava 2
Usage
-----
```java
Bus bus = ReactiveBus.create(); // creating thread safe instance of event bus
Disposable observer = bus.receive().subscribe(new Consumer() {
@Override public void accept(Event event) {
// handle event here
}
});
// send a message only (with random id)
bus.send(Event.name("my event 1").build());
// send some data (with random id)
bus.send(Event.name("my event 2").data(serializableObject).build());
// send id, name and some data
bus.send(Event.id("myId").name("my event 3").data(serializableObject).build());
observer.dispose(); // after disposal, observer will stop receiving new events
```
Download
--------
You can depend on the library through Maven:
```xml
com.github.pwittchen
reactivebus
0.0.5
io.reactivex.rxjava2
rxjava
2.1.10
```
or through Gradle:
```groovy
implementation 'com.github.pwittchen:reactivebus:0.0.5'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
```
Code style
----------
Code style used in the project is called Square from Java Code Styles repository by `Square`
available at: https://github.com/square/java-code-styles.
Building, tests and static code analysis
--------------------
To build project, type:
```
./gradlew build
```
To run tests, type:
```
./gradlew test
```
To run static code analysis, type:
```
./gradlew check
```
References
----------
- **Articles**:
- [Understanding RxJava Subject — Publish, Replay, Behavior and Async Subject](https://blog.mindorks.com/understanding-rxjava-subject-publish-replay-behavior-and-async-subject-224d663d452f)
- [What's different in RxJava 2.0?](https://github.com/ReactiveX/RxJava/wiki/What%27s-different-in-2.0)
- [Implementing an Event Bus with RxJava 1](https://blog.kaush.co/2014/12/24/implementing-an-event-bus-with-rxjava-rxbus/)
- **Other Event Bus implementations**:
- [Otto](https://github.com/square/otto)
- [Event Bus in Guava](https://github.com/google/guava/wiki/EventBusExplained)
- [GreenRobot's Event Bus](https://github.com/greenrobot/EventBus)
License
-------
Copyright 2018 Piotr Wittchen
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.