Introducing ReactiveBus

Introducing ReactiveBus

Mar 11, 2018
java, rxjava, android

Today, I’ve released my another tiny project. It’s a very simple implementation of Event Bus with RxJava 2 under the hood. This library is compatible with Java 1.7 or higher. I didn’t use Java 1.8 or 1.9 because I wanted to make it compatible with Android apps.

You can use it as follows:

Bus bus = ReactiveBus.create();

Disposable observer = bus.receive().subscribe(new Consumer<Event>() {
    @Override public void accept(Event event) {
      // handle event here

Once, we created Event Bus object and our observer (or more precisely: disposable subscriber), we can start sending events:

bus.send("my event").build());

We can also send some serializable data:

bus.send("my another event with data").data(serializableObject).build());

All events, will be received by the consumer in subscribe(...) method.

If we want to stop propagation of the events, we can just dispose observer like any RxJava subscription:


Actually, most of the work is done by RxJava itself. In this project, I just put a few pieces together and played around with them in unit tests.

With such kind of Event Bus implementation, we can create fluent, functional, reactive piplines of data flow in our apps.

You can include this tiny library in your project via Maven:


or via Gradle:

implementation 'com.github.pwittchen:reactivebus:0.0.5'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'

For more details, visit project repository on GitHub:

References #