COURSE

Reactive Spring with Reactor, WebFlux & R2DBC

Advanced training for experienced Spring programmers seeking to move into reactive application development.

  • 2 Days
  • Advanced
  • In-person / Online
  • £ On Request

Your team will learn...

Understand the principles behind Reactive Design

Use Project Reactor, both inside and outside of Spring

Develop components using all the operations of the Flux / Mono API

Exchange data with clients via SSE, WebSockets and RSocket

Create WebFlux services via annotations and DSL's

Access Relational and NoSQL databases via R2DBC

Overview

Modern enterprise development is transitioning from an imperative / blocking style to a functional / reactive one. Developers increasingly write code using the operators of Functional Programming and exchange data via Reactive Streams. This is driven partially by the move to Cloud Computing, but mostly by the ever increasing demand to build applications which are scalable, resilient and compative with a wide range of clients and network conditions.

Within the Spring ecosystem this pressure has seen the birth of a new reactive programming library (Project Reactor) and also reactive versions of existing frameworks for creating microservices and accessing data stores (Webflux and Spring Data R2DBC). This 2 day delivery equips developers to make the transition to this new style, and exploit the opportunities it affords.

The course can be delivered in either Java or Kotlin. It can be combined with our Introduction to Kotlin programming course for teams seeking to simplify their transition to reactive development by adopting a more functional language. It is also possible to include modules from either the Spring Boot with Java course or Spring Boot with Kotlin course, if there are areas where delegates would like a refresher or update.

Outline

Introduction

  • Introducing Reactive Design and Reactive Streams
  • Revising the Iterator, Future and Option patterns
  • How Observable / Publisher is the missing pattern
  • Visualising stream operators using Marble Diagrams
  • Publishers, Subscribers, Events and back-pressure
  • Threading models supported by Reactive Streams
  • Using standard functional operators with streams
  • New operators specific to reactive programming

Working With Project Reactor

  • Overview of Project Reactor and how it relates to Spring
  • Configuring a project for Reactor via the BOM Pattern
  • Creating Fluxes and Monos from static and dynamic sources
  • Programming using all the operations of the Flux / Mono API
  • Differences between standard, connectable and parallel Fluxes
  • Strategies for handling errors during the processing of items
  • Verification using Projects Reactor's built-in test framework
  • Using Schedulers to map threads to Publishers and Subscribers
  • Using Schedulers to control threading within Parallel Fluxes
  • Adding state to Schedulers via Context and making use of Hooks

Using Spring WebFlux Via Annotations

  • Using the Initializr to create a WebFlux project
  • Creating Services as Annotated Controllers
  • Similarities and between WebFlux and Spring MVC
  • Associating controller beans with URL patterns
  • Receiving data and marshalling the response
  • Using the ResponseEntity type for error handling
  • Effectively returning data via reactive streams

Using Spring WebFlux Via DSLs

  • Creating a minimal project for functional WebFlux services
  • Writing handlers using the ServerRequest and ServerResponse types
  • Wiring functions to URL patterns via the WebFlux Routing DSL
  • Advantages of Kotlin over Java when using the WebFlux DSLs

Making Proper Use Of WebFlux

  • Ensuring handler methods are fully non-blocking
  • Writing tests to verify the use of reactive streams
  • Using WebSockets for bidirectional exchange of data
  • Using RSocket to simplify the use of WebSockets

Database Access With R2DBC

  • Limitations of existing libraries for RDBMS access
  • Existing support for reactive access in NoSQL DBs
  • Overview of the R2DBC specification and its API
  • How R2DBC is implemented for relational databases
  • Connection and transaction management in R2DBC
  • Using the R2dbcEntityTemplate and supporting types
  • Higher level coding using Spring Data R2DBC

Requirements

Delegates must be proficient in Java and/or Kotlin and have prior experience building Web Applications using Spring MVC and Spring Data.

COURSE

Reactive Spring with Reactor, WebFlux & R2DBC

Advanced training for experienced Spring programmers seeking to move into reactive application development.

  • 2 Days
  • Advanced
  • In-person / Online
  • £ On Request

Deloitte logo
Atlassian logo
Bose logo
Workday logo
BMW logo
Amex logo
McAfee logo
PWC logo

Related Courses