In this chapter, you learn how to read from the journal and create views from it. To do this, Akka uses Akka Streams explicitly to read the journal—with the persistence-query module—and implicitly to create views—with the projections module.
NOTE
The source code for this chapter is available at www.manning.com/books/akka-in-action-second-edition or https://github.com/franciscolopezsancho/akka-topics/tree/main/chapter10a. You can find the contents of any snippet or listing in the .scala file with the same name as the class, object, or trait.
A stream is a sequence of data. It can be infinite, but it doesn’t have to be. Examples include the messages you send or receive via email, tweets posted each day, clicks on a website, and videos you watch. From the perspective of the application that processes all of these events, they sometimes involve a huge amount of interaction.
There are a few problems when interacting with live events or a constant flow of information. Sometimes the flow is infinite by definition, so you can’t wait until the process is finished to process its contents. Other flows, like audio, are not infinite, but you don’t want to wait until the whole song or video is transferred to play it.