Class LeveldbReadJournal
- java.lang.Object
-
- akka.persistence.query.journal.leveldb.javadsl.LeveldbReadJournal
-
- All Implemented Interfaces:
CurrentEventsByPersistenceIdQuery
,CurrentEventsByTagQuery
,CurrentPersistenceIdsQuery
,EventsByPersistenceIdQuery
,EventsByTagQuery
,PersistenceIdsQuery
,ReadJournal
public class LeveldbReadJournal extends java.lang.Object implements ReadJournal, PersistenceIdsQuery, CurrentPersistenceIdsQuery, EventsByPersistenceIdQuery, CurrentEventsByPersistenceIdQuery, EventsByTagQuery, CurrentEventsByTagQuery
persistenceIds
is used for retrieving allpersistenceIds
of all persistent actors.The returned event stream is unordered and you can expect different order for multiple executions of the query.
The stream is not completed when it reaches the end of the currently used
persistenceIds
, but it continues to push newpersistenceIds
when new persistent actors are created. Corresponding query that is completed when it reaches the end of the currently currently usedpersistenceIds
is provided bycurrentPersistenceIds()
.The LevelDB write journal is notifying the query side as soon as new
persistenceIds
are created and there is no periodic polling or batching involved in this query.The stream is completed with failure if there is a failure in executing the query in the backend journal.
-
-
Constructor Summary
Constructors Constructor Description LeveldbReadJournal(LeveldbReadJournal scaladslReadJournal)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Source<EventEnvelope,NotUsed>
currentEventsByPersistenceId(java.lang.String persistenceId, long fromSequenceNr, long toSequenceNr)
Same type of query aseventsByPersistenceId(java.lang.String, long, long)
but the event stream is completed immediately when it reaches the end of the "result set".Source<EventEnvelope,NotUsed>
currentEventsByTag(java.lang.String tag, Offset offset)
Same type of query aseventsByTag(java.lang.String, akka.persistence.query.Offset)
but the event stream is completed immediately when it reaches the end of the "result set".Source<java.lang.String,NotUsed>
currentPersistenceIds()
Same type of query aspersistenceIds()
but the stream is completed immediately when it reaches the end of the "result set".Source<EventEnvelope,NotUsed>
eventsByPersistenceId(java.lang.String persistenceId, long fromSequenceNr, long toSequenceNr)
eventsByPersistenceId
is used for retrieving events for a specificPersistentActor
identified bypersistenceId
.Source<EventEnvelope,NotUsed>
eventsByTag(java.lang.String tag, Offset offset)
eventsByTag
is used for retrieving events that were marked with a given tag, e.g.static java.lang.String
Identifier()
Source<java.lang.String,NotUsed>
persistenceIds()
-
-
-
Constructor Detail
-
LeveldbReadJournal
public LeveldbReadJournal(LeveldbReadJournal scaladslReadJournal)
-
-
Method Detail
-
Identifier
public static final java.lang.String Identifier()
-
persistenceIds
public Source<java.lang.String,NotUsed> persistenceIds()
- Specified by:
persistenceIds
in interfacePersistenceIdsQuery
-
currentPersistenceIds
public Source<java.lang.String,NotUsed> currentPersistenceIds()
Same type of query aspersistenceIds()
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.- Specified by:
currentPersistenceIds
in interfaceCurrentPersistenceIdsQuery
- Returns:
- (undocumented)
-
eventsByPersistenceId
public Source<EventEnvelope,NotUsed> eventsByPersistenceId(java.lang.String persistenceId, long fromSequenceNr, long toSequenceNr)
eventsByPersistenceId
is used for retrieving events for a specificPersistentActor
identified bypersistenceId
.You can retrieve a subset of all events by specifying
fromSequenceNr
andtoSequenceNr
or use0L
andLong.MaxValue
respectively to retrieve all events. Note that the corresponding sequence number of each event is provided in theEventEnvelope
, which makes it possible to resume the stream at a later point from a given sequence number.The returned event stream is ordered by sequence number, i.e. the same order as the
PersistentActor
persisted the events. The same prefix of stream elements (in same order) are returned for multiple executions of the query, except for when events have been deleted.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
currentEventsByPersistenceId(java.lang.String, long, long)
.The LevelDB write journal is notifying the query side as soon as events are persisted, but for efficiency reasons the query side retrieves the events in batches that sometimes can be delayed up to the configured
refresh-interval
.The stream is completed with failure if there is a failure in executing the query in the backend journal.
- Specified by:
eventsByPersistenceId
in interfaceEventsByPersistenceIdQuery
- Parameters:
persistenceId
- (undocumented)fromSequenceNr
- (undocumented)toSequenceNr
- (undocumented)- Returns:
- (undocumented)
-
currentEventsByPersistenceId
public Source<EventEnvelope,NotUsed> currentEventsByPersistenceId(java.lang.String persistenceId, long fromSequenceNr, long toSequenceNr)
Same type of query aseventsByPersistenceId(java.lang.String, long, long)
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.- Specified by:
currentEventsByPersistenceId
in interfaceCurrentEventsByPersistenceIdQuery
- Parameters:
persistenceId
- (undocumented)fromSequenceNr
- (undocumented)toSequenceNr
- (undocumented)- Returns:
- (undocumented)
-
eventsByTag
public Source<EventEnvelope,NotUsed> eventsByTag(java.lang.String tag, Offset offset)
eventsByTag
is used for retrieving events that were marked with a given tag, e.g. all events of an Aggregate Root type.To tag events you create an
EventAdapter
that wraps the events in aTagged
with the giventags
.You can retrieve a subset of all events by specifying
offset
, or use0L
to retrieve all events with a given tag. Theoffset
corresponds to an ordered sequence number for the specific tag. Note that the corresponding offset of each event is provided in theEventEnvelope
, which makes it possible to resume the stream at a later point from a given offset.In addition to the
offset
theEventEnvelope
also providespersistenceId
andsequenceNr
for each event. ThesequenceNr
is the sequence number for the persistent actor with thepersistenceId
that persisted the event. ThepersistenceId
+sequenceNr
is an unique identifier for the event.The
offset
is exclusive, i.e. the event with the exact same sequence number will not be included in the returned stream. This means that you can use the offset that is returned inEventEnvelope
as theoffset
parameter in a subsequent query.The returned event stream is ordered by the offset (tag sequence number), which corresponds to the same order as the write journal stored the events. The same stream elements (in same order) are returned for multiple executions of the query. Deleted events are not deleted from the tagged event stream.
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
currentEventsByTag(java.lang.String, akka.persistence.query.Offset)
.The LevelDB write journal is notifying the query side as soon as tagged events are persisted, but for efficiency reasons the query side retrieves the events in batches that sometimes can be delayed up to the configured
refresh-interval
.The stream is completed with failure if there is a failure in executing the query in the backend journal.
- Specified by:
eventsByTag
in interfaceEventsByTagQuery
- Parameters:
tag
- (undocumented)offset
- (undocumented)- Returns:
- (undocumented)
-
currentEventsByTag
public Source<EventEnvelope,NotUsed> currentEventsByTag(java.lang.String tag, Offset offset)
Same type of query aseventsByTag(java.lang.String, akka.persistence.query.Offset)
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.- Specified by:
currentEventsByTag
in interfaceCurrentEventsByTagQuery
- Parameters:
tag
- (undocumented)offset
- (undocumented)- Returns:
- (undocumented)
-
-