Contextual Logging with Reactor Context and MDC

In this post, we’ll look at how to combine the MDC feature of current logging framework with Reactor's own Context, in order to make contextualized logging possible within a reactive application.

File Reading in Reactor

File reading, line by line in Java… It’s never been a breeze, and until Java 8 the only high level option you had was to read the lines into a List<String> 😓

Then Java 8 came along, with its Stream interface, and a Files.lines(Path) method that returns a Stream<String>. Turns out, this stream will lazily read the lines from the file, without ever having to hold the whole content of the file in memory 😍

Let’s see how we can use that with Reactor!