Checkpoint operator

The Debug hook discussed in the previous section has a global impact, instrumenting all Flux/Mono instances. Consequently, the impact of the debug hook is application-wide. Alternatively, Reactor also provides a checkpoint operator, which can only alter a particular Flux stream. The checkpoint operator instruments a Reactor Streams after the operator invocation. We can alter our previous test case as follows:

@Testpublic void testPublisherStub() throws Exception {  Flux<Long> fibonacciGenerator =     getFibonacciGenerator().checkpoint();    StringWriter out = new StringWriter();  new PrintService().printEventNumbers(fibonacciGenerator,   new PrintWriter(out));  assertTrue(out.getBuffer().length() >0);}

In the preceding code, ...

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.