Functional and Reactive Programming using RxJava 2

Explore Concurrent, Asynchronous and Reactive Programming, APIs and Techniques in Java



3 Days

Course Overview

RxJava 2 is a complete rewrite of the RxJava API in 2014. RxJava has always been one of the front-runners of reactive programming. RxJava 2 is a complete implementation of the Reactive Streams specification, providing an even better interoperability between reactive libraries.

Functional and Reactive Programming using RxJava 2 is a comprehensive hands-on next-level Java training workshop geared for experienced developers who wish to explore concurrent, asynchronous and reactive programming APIs and techniques in Java. Throughout this three day course students will become familiar with Functional programming and procssing data stream. They will use the Java Concurrency API to implement asynchronous processeses, making use of the enhancements made to this API in Java 8. Students will then continue to develop both event produces and consumers using Java’s ReactiveX implementation (RxJava 2).

Course Objectives

This course focuses on providing an understanding of the fundamental principles and technologies that are used in reactive programming.  This understanding is critical to being able to diagnose, troubleshoot, tune, and perform other lifecycle activities.

Working in a hands-on learning environment, guided by our expert team, attendees will learn to:

  • Learn what functional programming means and what it brings to the table
  • Learn how Lambda expressions and functional interfaces can greatly enhance other aspects of Java
  • Use Lambda expressions and method references in the Collection API
  • Use the Stream constructs to work with Collections and Collectors
  • Work with the basic Thread class and Runnable interfaces
  • Deal with thread synchronization
  • Utilize the Java Concurrency API to configure Thread pools
  • Discover the Callable interface
  • Implement different lock strategies
  • Optimize multi-threading using the CompletableFuture introduced in Java 8
  • Understand the basics of Reactive Programming
  • Discuss the advantages and limitations of RxJava Observables
  • Write a client application capable of handling Reactive events
  • Develop unit tests to properly test Observable implementations (Using JUnit 5)
  • Apply operators to event streams to filter, modify and combine the objects emitted by event publishers
  • Select the appropriate type of Event Source (Single, Maybe, Completable, Observable and Flowable)
  • Implement event sources using one of the many factory methods of the RxJava 2 API
  • Use Subjects, acting as both event consumers and event source
  • Use both Cold and Hot Observables
  • Work with RxJava Scheduler instances to defines the thread pools on which event producers and consumers operate
  • Properly divide the functionality over multiple threads
  • Write test classes that deal with asynchronous RxJava implementations
  • Deal with backpressure problems in reactive programming
  • Solve the problem of with slow event consumers
  • Implement alternatives to event caching
  • Deal with exceptions in Reactive streams
  • Retry registration to event streams in Exceptional situations

Need different skills or topics?  If your team requires different topics or tools, additional skills or custom approach, this course may be further adjusted to accommodate.  We offer additional Java, JEE and Java for Web application development, design, testing, services, application security and other related topics that may be blended with this course for a track that best suits your needs. Our team will collaborate with you to understand your needs and will target the course to focus on your specific learning objectives and goals.

Course Prerequisites

This in an intermediate-level development course geared for experienced Java developers who wish to explore concurrent, asynchronous and reactive programming APIs and techniques in Java.

Follow-On Courses / Take After: Our intermediate and beyond level Java training courses provide students with a solid foundation for continued learning based on role, goals, or their areas of specialty.  Our Java developer learning paths offer a wide variety of follow-on courses such as:

  • Continued Java & JEE training: Intermediate to Advanced Java, JEE Essentials, Java for Web, Spring / Spring Boot, Microservices / Web Services / REST, Reactive Java Programming / RxJava, Tuning & Performance, Design Patterns & More
  • TDD / Test Driven Development, JUnit / Unit Testing, Agile development training
  • Secure Java Coding / Java Security and secure application development training
  • Mobile developer / Android training

Please see the Related Courses tab for specific Pre-Requisite courses, Related Courses or Follow On training options. Our team will be happy to help you with recommendations for next steps in your Learning Journey.

Course Agenda

Please note that this list of topics is based on our standard course offering, evolved from typical industry uses and trends. We’ll work with you to tune this course and level of coverage to target the skills you need most.

Session: Lambda Expressions; Collections and Streams

Lesson: Introduction to Lambda Expressions

  • Functional vs OO Programming
  • Anonymous Inner classes
  • Lambda Expression Syntax
  • Functional Interfaces
  • Method references
  • Constructor references

Lesson: Java 8 Collection Updates

  • Introduce the ConcurrentHashMap
  • Lambda expressions and Collections

Lesson: Streams

  • Processing Collections of data
  • The Stream interface
  • Reduction and Parallelism
  • Filtering collection data
  • Sorting Collection data
  • Map collection data
  • Find elements in Stream
  • Numeric Streams
  • Create infinite Streams
  • Sources for using Streams

Lesson: Collectors

  • Creating Collections from a Stream
  • Group elements in the Stream
  • Multi-level grouping of elements
  • Partitioning Streams

Session: Multithreading and Concurrency

Lesson: Java 8 Concurrency Updates

  • The common thread pool
  • Atomic variables
  • LongAdder and LongAccumulator
  • CompletableFuture
  • Non-blocking asynchronous tasks

Session: Introduction to RXJava2

Lesson: Introduction

  • Introduce ReactiveX and RxJava 2
  • The Observer and Iterator pattern and functional programming
  • Introduce the RxJava 2 Building blocks
  • Discuss hot and cold observables
  • Registering operators
  • Subscribing to an Observable

Lesson: Testing Event Sources (Introduction)

  • Introduce the TestObserver and TestSubscriber
  • Testing Observable implementations
  • Introduce some commonly used assertions

Lesson: Operators

  • Introduce RxJava 2 Operators
  • Show the use of RxMarbles (marble diagrams)
  • Explain some commonly used operators
  • Callback operators

Lesson: Creating the event publisher

  • Implementing the event source
  • Introduce the different types of event publishers
  • Convenience methods for creation of publishers
  • Creating an event source using an Emitter
  • Pre-defined observables
  • The defer operator
  • ConnectableObservable

Session: Working with RxJava2

Lesson: Subjects

  • RxJava subjects
  • Enable multicasting using Subjects
  • Introduce most commonly used Subject implementations

Lesson: RxJava Schedulers (Multithreading)

  • Thread usage of Observable, Operator and Observer
  • Using the subscribeOn method
  • Introduce the Scheduler implementations
  • Using the observeOn method

Lesson: Testing (multi-threaded) Event Sources

  • Testing Asynchronous code
  • Discuss strategies for testing event sources
  • Waiting for source to complete (await methods)
  • Use RxJava extension mechanism to Scheduler instances used during test
  • The JUnit 5 @ExtendsWith and @RegisterExtension annotations
  • Using the TestScheduler to advance time during test

Lesson: Backpressure

  • Strategies for dealing with Backpressure
  • Reactive Streams
  • Flowable and Processor
  • “reactive pull” backpressure

Lesson: Exception Handling

  • Handling errors in onError
  • Exception handling strategies
  • Using onErrorReturn or onErrorNext operators
  • Using the retry operators
  • The Global Error Handler


Course Materials

Course Materials: Each participant will receive a Student Guide with course notes, code samples, software tutorials, step-by-step written lab instructions, diagrams and related reference materials and resource links. Students will also receive the project files (or code, if applicable) and solutions required for the hands-on work.

Hands-On Setup Made Simple! Our dedicated tech team will work with you to ensure our ‘easy-access’ cloud-based course environment is accessible, fully-tested and verified as ready to go well in advance of the course start date, ensuring a smooth start to class and effective learning experience for all participants. Please inquire for details and options.

Raise the bar for advancing technology skills

Attend a Class!

Live scheduled classes are listed below or browse our full course catalog anytime

Special Offers

We regulary offer discounts for individuals, groups and corporate teams. Contact us

Custom Team Training

Check out custom training solutions planned around your unique needs and skills.

EveryCourse Extras

Exclusive materials, ongoing support and a free live course refresh with every class.

Learning is Twice as Nice!
Buy One Get One Free!

Enroll by February 28 in any TWO public classes in 2023 for the price of ONE! 

Click for Details & Additional Offers

Learn. Explore. Advance!

Extend your training investment! Recorded sessions, free re-sits and after course support included with Every Course
Trivera MiniCamps
Gain the skills you need with less time in the classroom with our short course, live-online hands-on events
Trivera QuickSkills: Free Courses and Webinars
Training on us! Keep your skills current with free live events, courses & webinars
Trivera AfterCourse: Coaching and Support
Expert level after-training support to help organizations put new training skills into practice on the job

The voices of our customers speak volumes

Special Offers
Limited Offer for most courses.

SAVE 50%

Learn More