OnBackpressure

Reactor also provides operators to alter the overflow strategy configured with the publisher. There are various OnBackpressureXXX() operators that cater to each of the strategies available with Reactor. These are quite useful in scenarios in which none of the preceding strategies can be applied to the publisher.

A publisher is sometimes configured with an IGNORE strategy. In such cases, backpressure is configured using operators while subscribing to the publisher.

Let's work with our test case and apply backpressure operators to it:

@Test    public  void testBackPressureOps() throws  Exception{        Flux<Integer> numberGenerator = Flux.create(x -> {            System.out.println("Requested Events :"+x.requestedFromDownstream()); int number = 1; ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.