What you'll learn:
- What is Reactive Programming?
- When to use Reactive Programming ?
- Write Reactive Code using Project Reactor
- Different Operators that are part of Project Reactor
- Reactive Streams Specification
- Build Non Blocking Rest Clients using Spring WebClient
- Unit Test the Reactive Code using JUnit5
- Reactive Types Flux/Mono
Reactive Programming is a new programming paradigm that's well suited for applications that are required to perform better under heavy load.
Reactive Programming is built on the foundation of reactive streams specification. Project Reactor is an implementation of Reactive Streams Specification.
Code that's written using Reactive programming has these qualities:
Fundamentally Asynchronous
Non Blocking
Functional Programming Style of code
Backpressure support
This course is designed to provide both theoretical and practical knowledge about reactive programming using Project Reactor. This is a pure hands-on oriented course and all the concepts are explained by writing code.
Course Curriculum:
Section 1: Getting Started With the Course
This section covers the course objectives and the prerequisites that are needed to make the most out of this course.
Section 2: Introduction to Reactive Programming
In this section, I will introduce you to reactive programming and its related concepts. The following topics are covered in this section
Why Reactive Programming?
What is Reactive Programming?
Introduction to Reactive Streams
Section 3: Getting Started with Project Reactor
In this section, I will introduce you to the reactive library project reactor, and the reactive types Flux and Mono that forms the foundation for Project Reactor
Introduction to Project Reactor
Reactor Reactive Types - Flux and Mono
Section 4: Setting up the Project for this course
In this section, I will set up the base project that will be used for the rest of this course.
Section 5: Functional Programming in Modern Java
In this section, I will explain Functional Programming and the benefits that are tied with this programming style
Imperative Style vs Functional Style
Section 6: Let's create our very first Flux and Mono
In this section, I will code and explain the reactor types Flux and Mono using simple examples
The following topics are covered as part of this lecture:
Let's write our very first Flux
Let's write our very first Mono
Reactive Stream Events
Testing Flux using JUnit5
Section 7: Transforming Flux and Mono
In this section, I will code and explain different operators that can be used to transform data from one form to another using project reactor
The following topics are covered as part of this section:
Transforming Data Using Operators in Project Reactor
Transform using map() Operator
Reactive Streams are Immutable
Filter using filter() Operator
Advanced transform using the flatMap() Operator
Asynchronous Operations using flatMap() Operator
Advanced transform using the concatMap() Operator
flatMap( ) operator in Mono
flatMapMany( ) operator in Mono
Transform using the transform() Operator
Handling empty data using defaultIfEmpty and switchIfEmpty() Operators
Section 8: Combining Flux and Mono
In this section, I will code and explain different operators that can be used to combine the reactive streams using project reactor
The following topics are covered as part of this section:
Introduction to Combining Reactive Streams
Combining Reactive Streams using merge() and mergeWith() Operators
Combining Reactive Streams using mergeSequential() Operators
Combining Reactive Streams using zip and zipWith() Operators
Section 9: Build Movie ReactiveService using Project Reactor
In this section, we will build the Reactive MovieService using all the skills that we have acquired so far
Overview of this MovieService
Retrieve all of the MovieInfo
Retrieve MovieInfo by movieId
Section 10: doOn* CallBacks - Peeking into a Sequence
In this section, I will code and explain the techniques to peek into the individual events that's emitted by the publisher
Section 11: Exception/Error Handling in Flux and Mono
In this section, I will cover the different exception handling strategies that are part of the Project reactor
The following topics are covered as part of this section:
Exceptions in Reactive Streams
Introduction to Exception Handling Operators
onErrorReturn() : Exception Handling Operator
onErrorResume() : Exception Handling Operator
onErrorContinue() : Exception Handling Operator
onErrorMap() : Exception Handling Operator
doOnError() : Catching Exceptions and Throw the error
Error Handling Operators in Mono
Section 12: Implement Exception Handling in Movies Reactive Service
In this section, I will implement the exception handling in the MoviesReactiveService.
Exception Handling in MoviesReactiveService using onErrorMap
Test Exception in MoviesReactiveService using Mockito
Section 13 : Retry, Repeat using retry(), retryWhen(), repeat()
In this section, I will code and implement different techniques to retry the exceptions in the Reactive Streams using Project Reactor
The following topics are covered as part of this section:
Retry Exceptions using retry() and retry(n)
Retry Specific Exceptions using retryWhen()
Repeat a Sequence using repeat() and repeat(n)
Repeat a Sequence repeatWhen()
Section 14: Reactors Execution Model - Schedulers, Threads, and Threadpool
In this section, I will explain the threads and the execution model behind the project reactor
The following topics are covered as part of this section:
Reactor Execution Model
Switching Threads using publishOn()
Switching Threads using subscribeOn()
Section 15: Making Blocking Calls in MovieReactiveService
In this section, we will add an enhancement to the MoviesReactive Service by adding a blocking call in to the pipeline.
Making Blocking calls in MovieReactiveService
In this lecture, we will code and learn about how to make blocking calls using project reactor
Section 16: BackPressure
In this section, I will explain the concept of backpressure in reactive programming
The following topics are covered as part of this section:
Introduction to BackPressure
Let's implement BackPressure
Write a JUnit test for BackPressure
Handling Backpressure using onBackpressureDrop()
Handling Backpressure using onBackpressureBuffer()
Handling Backpressure using onBackpressureError()
Section 17: Explore Data Parallelism in Project Reactor
In this section, I will explain about introducing parallelism into the reactive pipeline
The following topics are covered as part of this section:
Parallelism using parallel() and runOn() operators
Parallelism using flatmap() operator
Parallelism using flatMapSequential() operator
Section 18: Cold & Hot Streams
In this section, I will explain about cold and hot streams in Reactive Programming
The following topics are covered as part of this section:
Cold & Hot Streams
Cold Streams
Hot Streams - ConnectableFlux and different options
Section 19: JUnit Testing using VirtualTimeScheduler
In this section, I will explain the use of VirtualTimer to decrease the execution time of test cases.
StepVerifier using VirtualTimeScheduler
Section 20: Build NonBlocking RestClient using WebClient
In this section, we will write a nonblocking rest client using Spring WebClient
The following topics are covered as part of this section:
Overview of the Reactive Movie API
Build the non-blocking MovieInfoService RestClient
Build the non-blocking Review RestClient
Build getAllMovies non-blocking MovieReactiveService Client
Build getMovieById non-blocking MovieReactiveService Client
Integrate WireMock for Integration Tests
Section 21: Programmatically Creating a Flux
In this section, I will code and explain the techniques that are available to create a flux programmatically.
The following topics are covered as part of this section:
Create a Flux using create()
Create a Flux using push()
Section 22: Debugging in Project Reactor
In this section, I will demonstrate different approaches that are available when it comes to debugging reactor error messages.
The following topics are covered as part of this section:
Debug Exceptions using "checkpoint" operators
Debug Exceptions using Hooks.onOperatorDebug()
Production-ready Global Debugging using "ReactorDebugAgent"
By the end of this course, you will have a complete understanding of Reactive Programming, write code using the Reactive Programming Principles, and when to use them in your project.