Reactor Addons

Project Reactor is a versatile and feature-rich library. However, it cannot hold all of the useful reactive utilities. So, there are a handful of projects that extend the Reactor's capabilities in a few areas. The official Reactor Addons project (https://github.com/reactor/reactor-addons) holds a couple of modules for the Reactor project. At the time of writing, Reactor Addons consists of the following modules—reactor-adapter, reactor-logback, and reactor-extra.

The reactor-adapter module brings bridges to RxJava 2 reactive types and schedulers. Also, the module allows integration with Akka.

The reactor-logback module provides high-speed, asynchronous logging. It is based on Logback's AsyncAppender and LMAX Disruptor's RingBuffer via Reactor's Processor.

The reactor-extra module contains additional utilities for advanced needs. For example, the module contains the TupleUtils class, which simplifies code around the Tuple class. We explain how to use this class in Chapter 7Reactive Database Access. Also, the module has the MathFlux class, which can compute, sum, and average minimum or maximum values from numerical sources. The ForkJoinPoolScheduler class adapts Java's ForkJoinPool to Reactor's Scheduler. We can add the module to our Gradle project with the following imports:

compile 'io.projectreactor.addons:reactor-extra:3.2.RELEASE'

Also, the Project Reactor ecosystem has reactive drivers for popular asynchronous frameworks and message brokers.

The Reactor RabbitMQ module (https://github.com/reactor/reactor-rabbitmq) provides a reactive Java client for RabbitMQ with a familiar Reactor API. The module enables asynchronous non-blocking messaging with backpressure support. Also, the module allows our application to use RabbitMQ as a message bus by using the Flux and Mono types. The Reactor Kafka module (https://github.com/reactor/reactor-kafka) provides similar capabilities for the Kafka message broker.

One more popular Reactor extension is called Reactor Netty (https://github.com/reactor/reactor-netty). It adapts Netty's TCP/HTTP/UDP client and server with Reactor's reactive types. The Spring WebFlux module uses Reactor Netty internally for non-blocking web applications. Chapter 6WebFlux Async Non-blocking Communication, covers this topic in more detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.147.193