R2dbcReadJournal

akka.persistence.r2dbc.query.javadsl.R2dbcReadJournal
See theR2dbcReadJournal companion object
final class R2dbcReadJournal(delegate: R2dbcReadJournal) extends ReadJournal with CurrentEventsBySliceQuery with EventsBySliceQuery with CurrentEventsBySliceStartingFromSnapshotsQuery with EventsBySliceStartingFromSnapshotsQuery with EventTimestampQuery with LoadEventQuery with CurrentEventsByPersistenceIdQuery with CurrentEventsByPersistenceIdTypedQuery with EventsByPersistenceIdQuery with EventsByPersistenceIdTypedQuery with CurrentPersistenceIdsQuery with PagedPersistenceIdsQuery with EventsByPersistenceIdStartingFromSnapshotQuery with CurrentEventsByPersistenceIdStartingFromSnapshotQuery

Attributes

Companion:
object
Graph
Supertypes
trait CurrentEventsByPersistenceIdStartingFromSnapshotQuery
trait EventsByPersistenceIdStartingFromSnapshotQuery
trait PagedPersistenceIdsQuery
trait CurrentPersistenceIdsQuery
trait EventsByPersistenceIdTypedQuery
trait EventsByPersistenceIdQuery
trait CurrentEventsByPersistenceIdTypedQuery
trait CurrentEventsByPersistenceIdQuery
trait LoadEventQuery
trait EventTimestampQuery
trait EventsBySliceStartingFromSnapshotsQuery
trait CurrentEventsBySliceStartingFromSnapshotsQuery
trait EventsBySliceQuery
trait CurrentEventsBySliceQuery
trait ReadJournal
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

override def currentEventsByPersistenceId(persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long): Source[EventEnvelope, NotUsed]

Same type of query as EventsByPersistenceIdQuery#eventsByPersistenceId but the event stream is completed immediately when it reaches the end of the "result set". Events that are stored after the query is completed are not included in the event stream.

Same type of query as EventsByPersistenceIdQuery#eventsByPersistenceId but the event stream is completed immediately when it reaches the end of the "result set". Events that are stored after the query is completed are not included in the event stream.

Attributes

Definition Classes
CurrentEventsByPersistenceIdQuery
override def currentEventsByPersistenceIdStartingFromSnapshot[Snapshot, Event](persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long, transformSnapshot: Function[Snapshot, Event]): Source[EventEnvelope[Event], NotUsed]

Same as CurrentEventsByPersistenceIdTypedQuery but with the purpose to use snapshot as starting point and thereby reducing number of events that have to be loaded.

Same as CurrentEventsByPersistenceIdTypedQuery but with the purpose to use snapshot as starting point and thereby reducing number of events that have to be loaded.

Attributes

Definition Classes
CurrentEventsByPersistenceIdStartingFromSnapshotQuery
override def currentEventsByPersistenceIdTyped[Event](persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long): Source[EventEnvelope[Event], NotUsed]

Same type of query as EventsByPersistenceIdTypedQuery#eventsByPersistenceIdTyped but the event stream is completed immediately when it reaches the end of the "result set". Events that are stored after the query is completed are not included in the event stream.

Same type of query as EventsByPersistenceIdTypedQuery#eventsByPersistenceIdTyped but the event stream is completed immediately when it reaches the end of the "result set". Events that are stored after the query is completed are not included in the event stream.

This is a new version of the akka.persistence.query.javadsl.EventsByPersistenceIdQuery#currentEventsByPersistenceId using a new envelope type akka.persistence.query.typed.EventEnvelope.

Attributes

Event

the type of the event payload

Definition Classes
CurrentEventsByPersistenceIdTypedQuery
override def currentEventsBySlices[Event](entityType: String, minSlice: Int, maxSlice: Int, offset: Offset): Source[EventEnvelope[Event], NotUsed]

Same type of query as EventsBySliceQuery.eventsBySlices but the event stream is completed immediately when it reaches the end of the "result set". Depending on journal implementation, this may mean all events up to when the query is started, or it may include events that are persisted while the query is still streaming results. For eventually consistent stores, it may only include all events up to some point before the query is started.

Same type of query as EventsBySliceQuery.eventsBySlices but the event stream is completed immediately when it reaches the end of the "result set". Depending on journal implementation, this may mean all events up to when the query is started, or it may include events that are persisted while the query is still streaming results. For eventually consistent stores, it may only include all events up to some point before the query is started.

Attributes

Definition Classes
CurrentEventsBySliceQuery
override def currentEventsBySlicesStartingFromSnapshots[Snapshot, Event](entityType: String, minSlice: Int, maxSlice: Int, offset: Offset, transformSnapshot: Function[Snapshot, Event]): Source[EventEnvelope[Event], NotUsed]

Same as currentEventsBySlices but with the purpose to use snapshots as starting points and thereby reducing number of events that have to be loaded. This can be useful if the consumer start from zero without any previously processed offset or if it has been disconnected for a long while and its offset is far behind.

Same as currentEventsBySlices but with the purpose to use snapshots as starting points and thereby reducing number of events that have to be loaded. This can be useful if the consumer start from zero without any previously processed offset or if it has been disconnected for a long while and its offset is far behind.

First it loads all snapshots with timestamps greater than or equal to the offset timestamp. There is at most one snapshot per persistenceId. The snapshots are transformed to events with the given transformSnapshot function.

After emitting the snapshot events the ordinary events with sequence numbers after the snapshots are emitted.

To use currentEventsBySlicesStartingFromSnapshots you must enable configuration akka.persistence.r2dbc.query.start-from-snapshot.enabled and follow instructions in migration guide https://doc.akka.io/docs/akka-persistence-r2dbc/current/migration-guide.html#eventsBySlicesStartingFromSnapshots

Attributes

Definition Classes
CurrentEventsBySliceStartingFromSnapshotsQuery
override def currentPersistenceIds(): Source[String, NotUsed]

Same type of query as PersistenceIdsQuery#persistenceIds but the stream is completed immediately when it reaches the end of the "result set". Persistent actors that are created after the query is completed are not included in the stream.

Same type of query as PersistenceIdsQuery#persistenceIds but the stream is completed immediately when it reaches the end of the "result set". Persistent actors that are created after the query is completed are not included in the stream.

Attributes

Definition Classes
CurrentPersistenceIdsQuery
override def currentPersistenceIds(afterId: Optional[String], limit: Long): Source[String, NotUsed]

Get the current persistence ids.

Get the current persistence ids.

Not all plugins may support in database paging, and may simply use drop/take Akka streams operators to manipulate the result set according to the paging parameters.

Attributes

afterId

The ID to start returning results from, or empty to return all ids. This should be an id returned from a previous invocation of this command. Callers should not assume that ids are returned in sorted order.

limit

The maximum results to return. Use Long.MAX_VALUE to return all results. Must be greater than zero.

Returns:

A source containing all the persistence ids, limited as specified.

Definition Classes
PagedPersistenceIdsQuery
def currentPersistenceIds(entityType: String, afterId: Option[String], limit: Long): Source[String, NotUsed]

Get the current persistence ids.

Get the current persistence ids.

Note: to reuse existing index, the actual query filters entity types based on persistence_id column and sql LIKE operator. Hence the persistenceId must start with an entity type followed by default separator ("|") from akka.persistence.typed.PersistenceId.

Attributes

afterId

The ID to start returning results from, or empty to return all ids. This should be an id returned from a previous invocation of this command. Callers should not assume that ids are returned in sorted order.

entityType

The entity type name.

limit

The maximum results to return. Use Long.MAX_VALUE to return all results. Must be greater than zero.

Returns:

A source containing all the persistence ids, limited as specified.

override def eventsByPersistenceId(persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long): Source[EventEnvelope, NotUsed]

Query events for a specific PersistentActor identified by persistenceId.

Query events for a specific PersistentActor identified by persistenceId.

You can retrieve a subset of all events by specifying fromSequenceNr and toSequenceNr or use 0L and Long.MAX_VALUE respectively to retrieve all events. The query will return all the events inclusive of the fromSequenceNr and toSequenceNr values.

The returned event stream should be ordered by sequence number.

The stream is not completed when it reaches the end of the currently stored events, but it continues to push new events when new events are persisted. Corresponding query that is completed when it reaches the end of the currently stored events is provided by CurrentEventsByPersistenceIdQuery#currentEventsByPersistenceId.

Attributes

Definition Classes
EventsByPersistenceIdQuery
override def eventsByPersistenceIdStartingFromSnapshot[Snapshot, Event](persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long, transformSnapshot: Function[Snapshot, Event]): Source[EventEnvelope[Event], NotUsed]

Same as EventsByPersistenceIdTypedQuery but with the purpose to use snapshot as starting point and thereby reducing number of events that have to be loaded.

Same as EventsByPersistenceIdTypedQuery but with the purpose to use snapshot as starting point and thereby reducing number of events that have to be loaded.

Attributes

Definition Classes
EventsByPersistenceIdStartingFromSnapshotQuery
override def eventsByPersistenceIdTyped[Event](persistenceId: String, fromSequenceNr: Long, toSequenceNr: Long): Source[EventEnvelope[Event], NotUsed]

Query events for a specific PersistentActor identified by persistenceId.

Query events for a specific PersistentActor identified by persistenceId.

You can retrieve a subset of all events by specifying fromSequenceNr and toSequenceNr or use 0L and Long.MaxValue respectively to retrieve all events. The query will return all the events inclusive of the fromSequenceNr and toSequenceNr values.

The returned event stream should be ordered by sequence number.

The stream is not completed when it reaches the end of the currently stored events, but it continues to push new events when new events are persisted. Corresponding query that is completed when it reaches the end of the currently stored events is provided by CurrentEventsByPersistenceIdTypedQuery#currentEventsByPersistenceIdTyped.

This is a new version of the akka.persistence.query.javadsl.CurrentEventsByPersistenceIdQuery#currentEventsByPersistenceId using a new envelope type akka.persistence.query.typed.EventEnvelope.

Attributes

Event

the type of the event payload

Definition Classes
EventsByPersistenceIdTypedQuery
override def eventsBySlices[Event](entityType: String, minSlice: Int, maxSlice: Int, offset: Offset): Source[EventEnvelope[Event], NotUsed]

Query events for given slices. A slice is deterministically defined based on the persistence id. The purpose is to evenly distribute all persistence ids over the slices.

Query events for given slices. A slice is deterministically defined based on the persistence id. The purpose is to evenly distribute all persistence ids over the slices.

The consumer can keep track of its current position in the event stream by storing the offset and restart the query from a given offset after a crash/restart.

The supported offset is akka.persistence.query.TimestampOffset and Offset.noOffset.

The timestamp is based on the database CURRENT_TIMESTAMP when the event was stored. CURRENT_TIMESTAMP is the time when the transaction started, not when it was committed. This means that a "later" event may be visible first and when retrieving events after the previously seen timestamp we may miss some events. In distributed SQL databases there can also be clock skews for the database timestamps. For that reason it will perform additional backtracking queries to catch missed events. Events from backtracking will typically be duplicates of previously emitted events. It's the responsibility of the consumer to filter duplicates and make sure that events are processed in exact sequence number order for each persistence id. Such deduplication is provided by the R2DBC Projection.

Events emitted by the backtracking don't contain the event payload (EventBySliceEnvelope.event is None) and the consumer can load the full EventBySliceEnvelope with R2dbcReadJournal.loadEnvelope.

The events will be emitted in the timestamp order with the caveat of duplicate events as described above. Events with the same timestamp are ordered by sequence number.

The stream is not completed when it reaches the end of the currently stored events, but it continues to push new events when new events are persisted. Corresponding query that is completed when it reaches the end of the currently stored events is provided by R2dbcReadJournal.currentEventsBySlices.

Attributes

Definition Classes
EventsBySliceQuery
override def eventsBySlicesStartingFromSnapshots[Snapshot, Event](entityType: String, minSlice: Int, maxSlice: Int, offset: Offset, transformSnapshot: Function[Snapshot, Event]): Source[EventEnvelope[Event], NotUsed]

Same as eventsBySlices but with the purpose to use snapshots as starting points and thereby reducing number of events that have to be loaded. This can be useful if the consumer start from zero without any previously processed offset or if it has been disconnected for a long while and its offset is far behind.

Same as eventsBySlices but with the purpose to use snapshots as starting points and thereby reducing number of events that have to be loaded. This can be useful if the consumer start from zero without any previously processed offset or if it has been disconnected for a long while and its offset is far behind.

First it loads all snapshots with timestamps greater than or equal to the offset timestamp. There is at most one snapshot per persistenceId. The snapshots are transformed to events with the given transformSnapshot function.

After emitting the snapshot events the ordinary events with sequence numbers after the snapshots are emitted.

To use eventsBySlicesStartingFromSnapshots you must enable configuration akka.persistence.r2dbc.query.start-from-snapshot.enabled and follow instructions in migration guide https://doc.akka.io/docs/akka-persistence-r2dbc/current/migration-guide.html#eventsBySlicesStartingFromSnapshots

Attributes

Definition Classes
EventsBySliceStartingFromSnapshotsQuery
override def loadEnvelope[Event](persistenceId: String, sequenceNr: Long): CompletionStage[EventEnvelope[Event]]

Load a single event on demand. The CompletionStage is completed with a NoSuchElementException if the event for the given persistenceId and sequenceNr doesn't exist.

Load a single event on demand. The CompletionStage is completed with a NoSuchElementException if the event for the given persistenceId and sequenceNr doesn't exist.

Attributes

Definition Classes
LoadEventQuery
override def sliceForPersistenceId(persistenceId: String): Int

Attributes

Definition Classes
EventsBySliceStartingFromSnapshotsQuery -> CurrentEventsBySliceStartingFromSnapshotsQuery -> EventsBySliceQuery -> CurrentEventsBySliceQuery
override def sliceRanges(numberOfRanges: Int): List[Pair[Integer, Integer]]

Attributes

Definition Classes
EventsBySliceStartingFromSnapshotsQuery -> CurrentEventsBySliceStartingFromSnapshotsQuery -> EventsBySliceQuery -> CurrentEventsBySliceQuery
override def timestampOf(persistenceId: String, sequenceNr: Long): CompletionStage[Optional[Instant]]

Attributes

Definition Classes
EventTimestampQuery