RxJava(Reactive Extensions for the JVM) is a library for event-based programs. It allows composing asynchronous easily. Publisher and Consumer are main components. Literally, Publisher will emit events and Consumer will do some actions based on received events. Here is an example in Android:
This is a typical example of RxJava. However, I believe this is an anti-pattern. Your app could crash due to this code. When you have events or no event, it works fine. The problem occurs when Publisher emits errors. Without specifying an error consumer, the default, OnErrorMissingConsumer will be set.
For errors, OnErrorMissingConsumer makes a OnErrorNotImplementedException. This is RuntimeException and the app would crash unless you handled it. If you get the event or data from the network or database, there is a chance that you will get errors. It could be an internet connectivity problem or database locking. Although this makes the app crash, it could be hard to know this while developing. We usually don’t test those error scenarios.
This issue can be easily gone by specifying an error consumer. Thus, I suggest you to set the error consumer to avoid the app crash. With the error consumer, you can guide users some actions or show proper messages.