I am confused about the difference between EventBus and RxJava in android. I need to implement one of them for my issue about notifying some components when some changes have been done, so that they can update their state.
Also, I read that EventsBus has became deprecated over RxJava and I don't know if this information is true or not.
EventBus
and RxJava
are different in their nature.
EventBus
is just a bus
as the name suggest - it provides the mechanism to subscribe and publish events to the "bus", without you caring how the wiring is done, what this "bus" actually is, etc. In the context of Android, the EventBus
is just an easier way to deal with sending and receiving Broadcast
messages with less boilerplate.
RxJava
on the other hand is much much more powerful than that. Yes, you can subscribe and publish events, but you have far more control over the process - frequency, on which thread everything happens, etc. The main power of RxJava
(in my opinion) is that you can manipulate the data being published very easy, using some of its tons of operators
.
To sum up - if you only care about publishing some events and performing some actions when received - you'd probably be better off using the simplest of the two, namely some kind of Bus
, or even plain old BroadcastReceiver
s. If you will also benefit of transforming the data, handling threading or simplified error handling - go for the RxJava
approach. Just keep in mind that RxJava
generally has a steep learning curve, so it takes some time to get used to its concept.