How it works...
This word count scenario brings with it a few new concepts and stages. To begin with, we used a different Source for our stream. FileIO is a Source stage provided in the Akka Streams library, where you can provide a path to consume a file and emit it through the stream in the ByteString format.
After that, we uncompressed the file to read the contents. To do so, we used the helper Flow, namely Compression.gunzip(). This Flow object is provided as an intermediate processing stage using the method Via . Via expects a Flow and allows you to modularize your streams. You can instantiate the Flow somewhere else and just reference it there. Next, we mapped ByteStrings to UTF8 uppercase strings. We did this using the map method. This ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access