RxJava Tutorial

RxJava Tutorial

RxJava is a Java based extension of ReactiveX. ReactiveX is a project which aims to provide reactive programming concept to various programming languages. Reactive programming can most simply be defined as asynchronous programming with observable streams. It is a event based programming concept and events can propagate to registers observers. As per the Reactive, they have combined the best of Observer pattern, Iterator pattern and functional pattern. The Observer pattern done right. ReactiveX is a combination of the best ideas from the Observer pattern, the Iterator pattern, and functional programming

Examples of Reactive programming scenarios

  • User-Generated Events: Click events, swipe events, keyboard input, device rotations… these are just a few examples of events initiated by the user. If we consider each of these events across a timeline, we can see how they would form an ordered sequence of events–a dynamic and potentially infinite data stream.
  •  I/O Operations: Network requests, file reads and writes, database accesses… I/O operations are probably the most common type of data streams you will apply reactive principles to in practice. I/O operations are asynchronous since they take some significant and uncertain amount of time to complete. The response–whether it be JSON, a byte array, or some plain-old Java objects–can then be treated as a data stream.
  • External System Events: Push notifications from the server, GCM broadcasts, updates from device sensors… events generated from external producers are similar to user-generated events in their dynamic and potentially infinite nature
  • Just About Anything: Really. Just about anything can be modeled as a data stream–that’s the reactive mantra. A single, scalar value or a list of objects… static data or dynamic events… any of these can be made into a data stream in the reactive world