dnvriend / akka-persistence-jdbc-query

akka-persistence-query API extensions for akka-persistence-jdbc

GitHub

akka-persistence-jdbc-query

Akka-persistence-jdbc-query extends the akka-persistence-query API with two new interfaces for akka-persistence-jdbc.

Service Status Description
License License Apache 2.0
Bintray Download Latest Version on Bintray

EventsByPersistenceIdAndTag and CurrentEventsByPersistenceIdAndTag

eventsByPersistenceIdAndTag and currentEventsByPersistenceIdAndTag is used for retrieving specific events identified by a specific tag for a specific PersistentActor identified by persistenceId. These two queries basically are convenience operations that optimize the lookup of events because the database can efficiently filter out the initial persistenceId/tag combination.

import akka.actor.ActorSystem
import akka.stream.{Materializer, ActorMaterializer}
import akka.stream.scaladsl.Source
import akka.persistence.query.{ PersistenceQuery, EventEnvelope }
import akka.persistence.jdbc.query.journal.scaladsl.JdbcReadJournal

implicit val system: ActorSystem = ActorSystem()
implicit val mat: Materializer = ActorMaterializer()(system)
val readJournal: JdbcReadJournal = PersistenceQuery(system).readJournalFor[JdbcReadJournal](JdbcReadJournal.Identifier)

val willNotCompleteTheStream: Source[EventEnvelope, NotUsed] = readJournal.eventsByPersistenceIdAndTag("fruitbasket", "apple", 0L)

val willCompleteTheStream: Source[EventEnvelope, NotUsed] = readJournal.currentEventsByPersistenceIdAndTag("fruitbasket", "apple", 0L)

What's new?

For the full list of what's new see this wiki page.

1.0.0 (2016-02-08)

  • First release