Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Learning RxJava
Learning RxJava

Learning RxJava: Build concurrent applications using reactive programming with the latest features of RxJava 3 , Second Edition

Arrow left icon
Profile Icon Nick Samoylov Profile Icon Thomas Nield
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (4 Ratings)
Paperback Feb 2020 412 pages 2nd Edition
eBook
€22.49 €24.99
Paperback
€30.99
Paperback + Subscription
€24.99 Monthly
Table of content icon View table of contents Preview book icon Preview Book

Learning RxJava

Thinking Reactively

We assume that you are fairly comfortable with Java and know how to use classes, interfaces, methods, properties, variables, static/non-static scopes, and collections. If you are not familiar with concurrency or multithreading, that is okay. RxJava makes these advanced topics much more accessible.

Have your favorite Java development environment ready, be it IntelliJ IDEA, Eclipse, NetBeans, or any other environment of your choosing. We will be using IntelliJ IDEA, although it should not matter or have an impact on the examples in this book. We recommend that you have a project building framework such as Gradle or Maven, which we will explain how to use shortly.

In this chapter, before diving deeper into RxJava, we will cover some core topics:

  • A brief history of Reactive Extensions and RxJava
  • Thinking reactively
  • Leveraging RxJava
  • Setting up your first RxJava project
  • Building your first reactive applications
  • The differences between RxJava 1.x, 2.x, and 3.0

A brief history of ReactiveX and RxJava

As developers, we tend to think in counterintuitive ways. Modeling our world with code has never been short of challenges. It was not long ago that object-oriented programming was seen as the silver bullet to solve this problem. Making blueprints of what we interact with in real life was a revolutionary idea, and this core concept of classes and objects still impacts how we code today. However, business and user demands continued to grow in complexity. As 2010 approached, it became clear that object-oriented programming solved only part of the problem.

Classes and objects do a great job of representing an entity with properties and methods, but they become messy when they need to interact with each other in increasingly complex and often unplanned ways. Decoupling patterns and paradigms emerged, but this yielded an unwanted side effect of growing amounts of boilerplate code. In response to these problems, functional programming began to make a comeback, not to replace object-oriented programming, but rather to complement it and address the challenges.

Reactive programming, a functional event-driven programming approach, began to receive special attention. A couple of reactive frameworks emerged, including Akka and Sodium. But at Microsoft, a computer scientist named Erik Meijer created a reactive programming framework for .NET called Reactive Extensions. In a matter of years, Reactive Extensions (also known as ReactiveX or Rx) was ported to several languages and platforms, including JavaScript, Python, C++, Swift, and Java, of course. Soon, ReactiveX became a cross-language standard of reactive programming.

RxJava, the ReactiveX port for Java, was created in large part by Ben Christensen from Netflix and David Karnok. RxJava 1.0 was released in November 2014, followed by RxJava 2.0 in November 2016. RxJava is the backbone for other ReactiveX JVM ports, such as RxScala, RxKotlin, and RxGroovy. It has become a core technology for Android development and has also found its way into Java backend development.

Many RxJava-supporting libraries, such as RxAndroid (https://github.com/ReactiveX/RxAndroid), RxJava-JDBC (https://github.com/davidmoten/rxjava-jdbc), RxNetty (https://github.com/ReactiveX/RxNetty), and RxJavaFX (https://github.com/ReactiveX/RxJavaFX) adapted several Java frameworks to become reactive and work with RxJava out of the box. This all shows that RxJava is more than a library. It is part of a greater ReactiveX ecosystem that represents an entire approach to programming. The fundamental idea behind ReactiveX is that events are data and data are events. This is a powerful concept that we will explore later in this chapter, but first, let's step back and look at the world through the reactive lens.

Thinking reactively

Suspend everything you know about Java (and programming in general) for a moment, and let's make some observations about our world. These may sound like obvious statements, but as developers, we can easily overlook them. Try to become aware of the fact that everything is in motion. Traffic, weather, people, conversations, financial transactions, and so on are constantly changing or moving through stages.

Technically, even something as stationary as a rock is in motion, as its spatial location changes constantly due to the earth's rotation and orbiting through space. When you consider the possibility that everything can be modeled as being in motion, you may find it a bit overwhelming as a developer.

Another observation to note is that these different events are happening concurrently. Multiple activities are happening at the same time. Sometimes, they act independently, but at other times, they can converge and interact. For instance, a car can drive with no impact on a person jogging. They are two separate streams of events. However, they may converge at some point and the car will stop when it encounters the jogger.

If this is how our world works, why do we not model our code this way? Why do we not model code as multiple concurrent streams of events or data? It is not uncommon for developers to spend more time managing the states of objects and doing this in an imperative and sequential manner. You may structure your code to execute two independent processes, Process 1 and Process 2, and then Process 3, which depends on Process 1 and Process 2. Why not kick off Process 1 and Process 2 simultaneously, and then kick off Process 3 after the completion of these two processes? Of course, you can use callbacks and Java concurrency tools, but RxJava makes this much easier and safer to express.

Let's make one last observation. A book or music CD is static. A book is an unchanging sequence of words and a CD is a collection of tracks. There is nothing dynamic about them. However, when we read a book, we read one word at a time. Those words are effectively put in motion as a stream being consumed by our eyes. It is no different with a music track on a CD, where each track is put in motion as sound waves and your ears consume each track. Static items can, in fact, be put in motion too. This is an abstract but powerful idea because we create from each of these static items a series of events. When we level the playing field between data and events by treating them both the same, we unleash the power of functional programming and unlock abilities we previously might have thought impractical.

The fundamental idea behind reactive programming is that events are data and data are events. This may not seem intuitive, but it really does not take long to grasp when you consider our real-world examples. The runner and car both have properties and states, but they are also in motion. The book and CD are put in motion when they are consumed. Merging the event and data allows the code to feel organic and represent the world we are modeling.

Why should I learn RxJava?

ReactiveX and RxJava address many problems that programmers face daily, allowing them to express business logic and spend less time engineering code. Have you ever struggled with concurrency, event handling, obsolete data states, and exception recovery? What about making your code more maintainable, reusable, and evolvable so it can keep up with your business? It might be presumptuous to call reactive programming a silver bullet that eliminates these problems, but it certainly is a progressive leap toward addressing them.

There is also a growing user demand to make applications responsive in real time. Reactive programming allows you to quickly analyze and work with live data sources such as Twitter feeds or stock prices. It can also cancel and redirect work, scale with concurrency, and cope with rapidly emitting data. Composing events and data as streams that can be mixed, merged, filtered, split, and transformed opens up radically effective ways to compose and evolve the code.

In summary, reactive programming makes many hard programming tasks easy, enabling you to add value in ways you might have thought impractical earlier. If you have a process written reactively and you discover that you need to run part of it on a different thread, you can implement this change in a matter of seconds. If you find network connectivity issues crashing your application intermittently, you can gracefully use reactive recovery strategies that wait and try again. If you need to inject another operation in the middle of your process, it is as simple as inserting a new operator.

Reactive programming models data/event processing as a modular chain of links that can be added or removed quickly. Such a chain is also called a processing chain or processing pipeline. In essence, RxJava allows applications to be tactical and evolvable while maintaining stability in production.

What will you learn in this book?

As stated earlier, RxJava is the ReactiveX port for Java. In this book, we will focus primarily on RxJava 3.0, but we will highlight the significant differences between RxJava 1.x, 2.x, and 3.0 where they exist. We will place a priority on learning to think reactively and leverage the practical features of RxJava. Starting with a high-level understanding, we will gradually move deeper into how RxJava works. Along the way, you will learn about reactive patterns and tricks to solve common problems that programmers encounter.

We will cover core Rx concepts and the three core entities of RxJava: Observable, Observer, and Operator. You will start writing reactive programs immediately and will acquire a solid foundation to build upon throughout the rest of the book. Then, we will explore more of the nuances of RxJava and how to effectively leverage concurrency. You will also learn the different ways to deal with reactive streams that produce data/events faster than they can be consumed.

Finally, we will touch on several miscellaneous but essential topics, including custom operators, as well as how to use RxJava with testing frameworks, Android, and the Kotlin language.

Setting up

Currently, there are three co-existing versions of RxJava: 1.x, 2.x, and 3.0. We will go through some of the major differences later in the section entitled RxJava 1.x, 2.x, 3.0 – which one do I use? and discuss which version you should use.

RxJava 3.0 is a fairly lightweight library and comes in at fewer than 4 megabytes (MBs) in size. This makes it practical for Android and other projects that require a low dependency overhead. RxJava 3.0 has only one dependency, called Reactive Streams ( http://www.reactive-streams.org/), which is a core library (made by the creators of RxJava) that sets a standard for asynchronous stream implementations, one of which is RxJava 3.0.

RxJava 2x is even smaller—closer to 2 MB—and has only one dependency on Reactive Streams too.

It may be used in other libraries beyond RxJava and is a critical effort in the standardization of reactive programming on the Java platform. Note that RxJava 1.x does not have any dependencies, including Reactive Streams, which was realized after 1.0.

If you are starting a project from scratch, try to use RxJava 3.0. This is the version we will cover in this book, but we will point out significant differences between versions 1.x and 2.x. While RxJava 1.x and 2.x will be supported for a good while due to the countless projects using it, innovation will likely only continue onward in RxJava 3.0. RxJava 1.x reached end-of-life on March 31, 2018, and RxJava 2.x will only be maintained by fixing bugs until February 28, 2021.

All RxJava versions can run on Java 1.6+. In this book, we will use Java 8, and it is recommended that you use a minimum of Java 8 so that you can use lambdas out of the box. For Android, there are ways to leverage lambdas in earlier Java versions that will be addressed later. But due to the fact that Android Nougat uses Java 8 and Java 8 has been out since 2014, we hope that you will not have to do any workarounds to leverage lambdas.

Navigating the central repository

To bring in RxJava as a dependency, you have a number of options. The best place to start is to go to the Maven central repository, called The Central Repository (http://search.maven.org) and search for rxjava. You should see RxJava 3.0, 2.x, and 1.x as separate repositories at the top of the search results, as shown in the following screenshot:

You can also use classic search, if you're already used to its look and feel, and get the same results as shown in the following screenshot:

At the time of writing, RxJava 3.0.0 is the latest version of RxJava 3.x, RxJava 2.2.17 is the latest version of RxJava 2.x, and RxJava 1.3.8 is the latest version of RxJava 1.x. You can download the latest JAR file by clicking the link on the far right under the Download column and then configuring your project using the downloaded JAR file.

Alternatively, you can use Gradle or Maven to automatically import these libraries into your project. This way, you can easily share and store your project (through Git or other version control systems) without having to download and configure RxJava manually each time. To view the latest configurations for Maven, Gradle, and several other build automation systems, click on the Latest Version link and copy the dependency description provided into the pom.xml file (for Maven) or build.gradle file (for Gradle) of your project.

In the next two subsections, we will walk you through how to do it.

Using Gradle

There are several automated build systems available, but the two most popular ones are Gradle and Maven. Gradle is somewhat of a successor to Maven and used mostly for Android development. If you are not familiar with Gradle and would like to learn how to use it, check out the Gradle Getting Started guide (https://gradle.org/getting-started-gradle-java/).

There are also several books that cover Gradle in varying degrees of depth that you can find at https://gradle.org/books/. The following is the fragment of the above screenshot that contains Maven and Gradle configurations:

In your build.gradle script, ensure that you have declared mavenCentral() as one of your repositories. Type in or paste this dependency line, compile 'io.reactivex.rxjava2:rxjava:x.y.z', where x.y.z is the version number you want to use, as shown in the following code snippet:

apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'io.reactivex.rxjava2:rxjava:x.y.z'
}

Build your Gradle project and you should be good to go! You will then have RxJava and its types available for use in your project.

Using Maven

You also have the option to use Maven, and you can view the appropriate configuration in The Central Repository by selecting the Apache Maven configuration information, as shown in the following screenshot:

You can then copy and paste the <dependency> block containing the RxJava configuration and paste it inside a <dependencies> block in your pom.xml file. Rebuild your project, and you should now have RxJava set up as a dependency. The x.y.z version number corresponds to the desired RxJava version that you want to use:

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.nield</groupId>
<artifactId>mavenrxtest</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>io.reactivex.rxjava2</groupId>
<artifactId>rxjava</artifactId>
<version>x.y.z</version>
</dependency>
</dependencies>
</project>

A brief exposure to RxJava

Before we dive deep into the reactive world of RxJava, here is a quick immersion to get your feet wet first. In ReactiveX, the core type you will work with is the Observable class. We will be learning more about the Observable class throughout the rest of this book. But essentially, an Observable pushes things. A given Observable<T> pushes things of type T through a series of operators until it arrives at an Observer object that consumes the items.

For instance, create a new Ch1_1.java file in your project and put in the following code:

import io.reactivex.rxjava3.core.Observable;
public class Ch1_1 {
public static void main(String[] args) {
Observable<String> myStrings =
Observable.just("Alpha", "Beta", "Gamma");
}
}

In our main() method, we have an Observable<String> that will push three string objects. An Observable can push data or events from virtually any source, whether it is a database query or live Twitter feeds. In this case, we are quickly creating an Observable using Observable.just(), which will emit a fixed set of items.

In RxJava 1.x, the types are contained in the rx package. In RxJava 2.x, most types you will use are contained in the io.reactivex package. In RxJava 3.0, most types you will use are contained in the io.reactivex.rxjava3 package.

However, running this main() method is not going to do anything other than declare Observable<String>. To make this Observable actually push (or emit) these three strings, we need an Observer object to subscribe to it and receive the items. We can quickly create and connect an Observer object by passing a lambda expression that specifies what to do with each value it receives:

import io.reactivex.rxjava3.core.Observable;
public class Ch1_1 {
public static void main(String[] args) {
Observable<String> myStrings =
Observable.just("Alpha", "Beta", "Gamma");
myStrings.subscribe(s -> System.out.println(s));
}
}

When we run this code, we should get the following output:

Alpha 
Beta
Gamma

What happened here is that our Observable<String> pushed each string object one at a time to our Observer object, which we shorthanded using the s -> System.out.println(s) lambda expression. We passed each string through the (arbitrarily named) s parameter and instructed it to print each one. Lambda expressions are essentially mini-functions that allow us to quickly pass instructions on what action to take with each incoming item. Everything to the left of the arrow (->) are arguments (which, in this case, is a string we named s), and everything to the right is the action (which is System.out.println(s)).

If you are unfamiliar with lambda expressions, turn to Appendix A, Introducing Lambda Expressions, to learn more about how they work. If you want to invest extra time in understanding lambda expressions, I highly recommend that you read at least the first few chapters of Java 8 Lambdas (O'Reilly) (http://shop.oreilly.com/product/0636920030713.do), by Richard Warburton. Lambda expressions are a critical topic in modern programming and have become especially relevant to Java developers since their adoption in Java 8. We will be using lambdas constantly in this book, so definitely take some time to get comfortable with them.

We can also use several operators in the pipeline between Observable and Observer to transform each pushed item or manipulate it in some way. Each such operator applies the transformation and returns a new Observable that emits the transformed item. For example, we can use map() to turn each string emission into its length(), and each length integer will then be pushed to Observer, as shown in the following code snippet:

import io.reactivex.rxjava3.core.Observable;
public class Ch1_2 {
public static void main(String[] args) {
Observable<String> myStrings =
Observable.just("Alpha", "Beta", "Gamma");
myStrings.map(s -> s.length())
.subscribe(s -> System.out.println(s));
}
}

When we run this code, we should get the following output:

5
4
5

If you have used Java 8 streams or Kotlin sequences, you might be wondering how Observable is any different. The key difference is that Observable pushes the items, while the streams and sequences pull the items. This may seem subtle, but the impact of a push-based iteration is far more powerful than a pull-based one. As we saw earlier, you can push not only data but also events. For instance, Observable.interval() will push a consecutive Long at each specified time interval, as shown in the following code snippet. This Long emission is not only data but also an event! Let's take a look:

import io.reactivex.rxjava3.core.Observable;
import java.util.concurrent.TimeUnit;
public class Ch1_3 {
public static void main(String[] args) {
Observable<Long> secondIntervals =
Observable.interval(1, TimeUnit.SECONDS);
secondIntervals.subscribe(s -> System.out.println(s));
/* Hold main thread for 5 seconds
so Observable above has chance to fire */
sleep(5000);
}
public static void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

When we run this code, we should get the following output:

0 
1
2
3
4

Notice that a consecutive emission fires every second. This application runs for about 5 seconds before it quits, and you likely see emissions 0 to 4 fired, each separated by a just a second-long gap. This simple idea that data is a series of events over time unlocks new possibilities in programming.

As a side note, we will get more into concurrency later, but we had to create a sleep() method because this Observable fires emissions on a computation thread when the Observable is subscribed to. The main thread used to launch our application is not going to wait on this Observable since it fires on a computation thread, not the main thread. Therefore, we use sleep() to pause the main thread for 5,000 milliseconds and then allow it to reach the end of the main() method (which will cause the application to terminate). This gives Observable.interval() a chance to fire for the 5-second window before the application quits.

Throughout this book, we will uncover many mysteries about Observable and the powerful abstractions it takes care of for us. If you've conceptually understood what's been going on here so far, congrats! You are already becoming familiar with how reactive code works. To emphasize again, emissions are pushed one at a time, all the way to Observer. Emissions represent both data and an event, which can be emitted over time. Of course, beyond map(), there are hundreds of operators in RxJava, and we will learn about the key ones in this book. Learning which operators to use for a situation and how to combine them is the key to mastering RxJava. In the next chapter, we will cover Observable and Observer much more comprehensively. We will also demystify how events and data are being represented in Observable a bit more.

RxJava 1.x, 2.x, or 3.0 – which one do I use?

As stated earlier, you are encouraged to use RxJava 3.0 if you can. This version will continue to grow and receive new features, while RxJava 1.x has not been developed further since March 21, 2018, and 2.x will be maintained for bug fixes only until February 28, 2021. However, there are other considerations that may lead you to use RxJava 1.x or 2.x.

If you inherit a project that is already using RxJava 1.x or 2.x, you will likely continue using it until it becomes feasible to migrate to RxJava 3.0. You can also check out David Karnok's RxJava2Interop project (https://github.com/akarnokd/RxJava2Interop), which converts Rx types from RxJava 1.x to RxJava 2.x and vice versa. After you finish this book, you may consider using this library to leverage RxJava 2.x even if you have the RxJava 1.x legacy code.

Migration to RxJava 3.0 requires mostly a change of import statements only. However, a few methods were dropped between RxJava 2.x and 3.0, some methods renamed, and new methods added (refer to the details at https://github.com/ReactiveX/RxJava/wiki/What's-different-in-3.0). The compiler will guide you and, for a typical, not overly large application, migration to RxJava 3.0 should be pretty straightforward, unless, of course, your application uses very particular version-specific features. In such a case, a rewrite would be the only way to proceed.

In RxJava, there are multiple libraries that can be used to make several Java APIs reactive and plug into RxJava seamlessly. To name just a few, these libraries include RxJava-JDBC, RxAndroid, RxJava-Extras, RxNetty, and RxJavaFX. At the time of writing, only RxAndroid and RxJavaFX have been fully ported to RxJava 2.x, and many other libraries will follow. By the time you are reading this, all major RxJava extension libraries will hopefully be ported to RxJava 2.x and some to RxJava 3.0, too.

You may prefer RxJava 3.0 because it was built on much of the hindsight and wisdom gained from RxJava 1.x and 2x. It has better performance, simpler APIs, a cleaner approach to backpressure, and is a bit safer when it comes to putting together your own operators.

When to use RxJava

A common question ReactiveX newcomers ask is: What circumstances warrant a reactive approach? Do we always want to use RxJava? As someone who has been living and breathing reactive programming for a while, I have learned that there are two answers to this question.

The first answer, when you first start out, is yes! You always want to take a reactive approach. The only way to truly become a master of reactive programming is to build reactive applications from the ground up. Think of everything as Observable and always model your program in terms of data and event flows. When you do this, you will leverage everything reactive programming has to offer and see the quality of your applications go up significantly.

The second answer is that as you become experienced in RxJava, you will find cases where RxJava may not be appropriate. There will occasionally be times where a reactive approach may not be optimal, but usually, this exception applies only to a part of your code. Your entire project itself should be reactive. There may be parts that are not reactive for good reason. These exceptions only stand out to a trained Rx veteran who sees that returning List<String> is perhaps better than returning Observable<String>.

Rx greenhorns should not worry about when something should be reactive versus not reactive. Over time, they will start to see cases where the benefits of Rx are marginalized, and this is something that only comes with experience.

So for now, no compromises. Go reactive all the way!

Summary

In this chapter, you have learned how to look at the world in a reactive way. As a developer, you may have to retrain yourself from a traditional imperative mindset and develop a "reactive" view. If you have done imperative, object-oriented programming for a long time, this may not be easy to accomplish, but the return on investment will be significant as your applications will become more maintainable, scalable, and evolvable. You will also have a faster turnaround and more readable code.

We also have covered how to configure an RxJava project using Gradle or Maven, and what decisions should drive whether you should choose RxJava 3.0, 2.x, or 1.x. We also got a brief introduction to reactive code and how Observable works through push-based iteration.

By the time you finish this book, you will hopefully find reactive programming intuitive and easy to work with. We hope you find that RxJava not only makes you more productive, but also helps you take on tasks you hesitated to do earlier. So let's continue!

In the next chapter, you will learn about the Observable and how it works together with the Observer. We will discuss how to create an Observable and how to use its operators. This will create a foundation that allows us to move on to more complex topics later.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore a variety of tools and techniques used to solve problems in implementing concurrency and parallelization
  • Learn about core operators in RxJava that enable you to express your code logic productively
  • Apply RxJava with Kotlin to create responsive Android apps with better user experience

Description

RxJava is not just a popular library for building asynchronous and event-based applications; it also enables you to create a cleaner and more readable code base. In this book, you’ll cover the core fundamentals of reactive programming and learn how to design and implement reactive libraries and applications. Learning RxJava will help you understand how reactive programming works and guide you in writing your first example in reactive code. You’ll get to grips with the workings of Observable and Subscriber, and see how they are used in different contexts using real-world use cases. The book will also take you through multicasting and caching to help prevent redundant work with multiple Observers. You’ll then learn how to create your own RxJava operators by reusing reactive logic. As you advance, you’ll explore effective tools and libraries to test and debug RxJava code. Finally, you’ll delve into RxAndroid extensions and use Kotlin features to streamline your Android apps. By the end of this book, you'll become proficient in writing reactive code in Java and Kotlin to build concurrent applications, including Android applications.

Who is this book for?

This book is for Java developers who want to leverage reactive programming to develop more resilient and concurrent applications. If you're an RxJava user looking to get to grips with the latest features and updates in RxJava 3, this book is for you. Fundamental knowledge of core Java features and object-oriented programming will assist you in understanding the key concepts covered in this book.

What you will learn

  • Discover different ways to create Observables, Observers, and Subscribers
  • Multicast in order to push data to multiple destinations and cache and replay them
  • Express RxJava idiomatically with the help of Kotlin features such as extension functions and data classes
  • Become familiar with various operators available in RxJava to perform common transformations and tasks
  • Explore RxJava's reactive types, including Flowable, Single, Maybe, and Completable
  • Demystify Observables and how they express data and events as sequences

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 28, 2020
Length: 412 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789950151
Category :
Languages :
Tools :

Product Details

Publication date : Feb 28, 2020
Length: 412 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789950151
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 113.97
The Complete Coding Interview Guide in Java
€38.99
Learning RxJava
€30.99
Java Coding Problems
€43.99
Total 113.97 Stars icon

Table of Contents

16 Chapters
Section 1: Foundations of Reactive Programming in Java Chevron down icon Chevron up icon
Thinking Reactively Chevron down icon Chevron up icon
Observable and Observer Chevron down icon Chevron up icon
Basic Operators Chevron down icon Chevron up icon
Section 2: Reactive Operators Chevron down icon Chevron up icon
Combining Observables Chevron down icon Chevron up icon
Multicasting, Replaying, and Caching Chevron down icon Chevron up icon
Concurrency and Parallelization Chevron down icon Chevron up icon
Switching, Throttling, Windowing, and Buffering Chevron down icon Chevron up icon
Flowable and Backpressure Chevron down icon Chevron up icon
Transformers and Custom Operators Chevron down icon Chevron up icon
Section 3: Integration of RxJava applications Chevron down icon Chevron up icon
Testing and Debugging Chevron down icon Chevron up icon
RxJava on Android Chevron down icon Chevron up icon
Using RxJava for Kotlin Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(4 Ratings)
5 star 75%
4 star 25%
3 star 0%
2 star 0%
1 star 0%
Jonas Okwara Aug 05, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Although am still studying the book so far am impressed with its content and how the subject matter is treated.
Amazon Verified review Amazon
Ken Siprell Apr 10, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is a great introduction to RxJava. It is written in a clear and logical manner. The code examples are easy to comprehend and lend understanding to their topic. Unlike many Packt publications this book is free of grammar and spelling errors, making it a pleasure to read. I highly recommend it!
Amazon Verified review Amazon
Abhishek Shukla May 16, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book covers all the important topics at depth and touches on the peripheral topics as well.Examples and operators were well explained!
Amazon Verified review Amazon
kitasanblack May 10, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
分かりやすい英語で内容を理解しやすい。サンプルコードも省略されず記されているので、動作確認がしやすい。
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.

Modal Close icon
Modal Close icon