Project Reactor: About Scannable interface

Simple to say, reactor.core.Scannable interface is for accessing internal attributes of flux instance for debugging purpose. Following is an example

Flux<Integer> f1 = Flux.just(1, 2, 3, 4);
Scannable s1 = Scannable.from(f1);
LOGGER.info("BUFFERED={}, RUN_STYLE={}", s1.scan(Scannable.Attr.BUFFERED), s1.scan(Scannable.Attr.RUN_STYLE));
Flux<Integer> f2 = f1.map(x -> x * 2);
Scannable s2 = Scannable.from(f2);
LOGGER.info("RUN_STYLE={}, PREFETCH={}, PARENT={}", s2.scan(Scannable.Attr.RUN_STYLE), s2.scan(Scannable.Attr.PREFETCH), s2.scan(Scannable.Attr.PARENT));
Enter fullscreen mode
Exit fullscreen mode

The output is

BUFFERED=4, RUN_STYLE=SYNC
RUN_STYLE=SYNC, PREFETCH=-1, PARENT=FluxArray
Enter fullscreen mode
Exit fullscreen mode

About the meaning of attribute please refer to here.


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
Account » digicodes® india's largest gaming & software store. We're sorry, your donation failed to process. Free 2025 jamb questions and answers cbt answers jamb / jamb 2025 answers cbt answers jamb.