How it works...
In this recipe, we created a small stream that could read a list of filenames and emit each element through the stream. It maps these filenames to the files, filters out non-existent or empty files, and finally prints out the absolute path of non-empty files. Since the only non-empty file is testfile3.txt, we saw Absolute path: /code/chapter8/testfile3.txt in the output.
In order to be able to run a stream, an ActorMaterializer is required. ActorMaterializer is responsible for creating the underlying actors with the specific functionality you define in your stream. Since ActorMaterializer creates actors, it also needs an ActorSystem. This is the reason why we implicitly defined one in our sample code.
It's also good to mention ...
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