Assume we depend on Reactor 3
(i.e in a Spring 5 application) and a text file my/file.txt
.
I need to subscribe to the text file lines (both existing ones and those that will appear in the future) and create a Flux<String>
. If you wish, neglect blocking IO reads concerns, let's just reveal the principle of building such subscription.
For simplicity assume that we print those lines to std output:
flowLinesFrom(Path.of("my/file.txt"))
.subscribe(System.out::println);
What is the proper way to implement Flux<String> flowLinesFrom(Path)
?