ReadJournal is the Akka Persistence Query interface for reading event-sourced entity events and projecting them into stores optimized for queries. Results arrive as Akka Streams streams, which remain open because new events may appear at any time. section 10.2
Choose a query according to the event identity and starting point:
- Use eventsByTag or currentEventsByTag with a tag and offset; Offset.noOffset starts reading from the beginning. section 10.2
- Select standard queries for historical events and current queries for events arriving after query execution. section 10.2
Printing stored persistence IDs
val readJournal = PersistenceQuery(system).readJournalFor[JdbcReadJournal](JdbcReadJournal.Identifier) val source = readJournal.persistenceIds source.runForeach(println) The read journal is obtained from the configured JDBC implementation, then its source is materialized to print each identifier.
ReadJournal requires a plugin implementation, such as Cassandra, Couchbase, or JDBC. A JDBC setup can use PostgreSQL for journal events and snapshots. Akka projections commonly consume eventsByTag, manage offsets, and write transformed data to another store. section 10.2 section 10.3
