| SqlReadJournalEventsByTag Method |
EventsByTag(String, Int64) 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
IEventAdapter that wraps the events
in a
Tagged with the given `tags`.
You can retrieve a subset of all events by specifying
offset, or use `0L` to retrieve all
events with a given tag. The
offset corresponds to an ordered sequence number for
the specific tag. Note that the corresponding offset of each event is provided in the
EventEnvelope, which makes it possible to resume the
stream at a later point from a given offset.
In addition to the
offset the
EventEnvelope also provides `persistenceId` and `sequenceNr`
for each event. The `sequenceNr` is the sequence number for the persistent actor with the
`persistenceId` that persisted the event. The `persistenceId` + `sequenceNr` is an unique
identifier for the event.
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(String, Int64).
The SQL 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.
Namespace:
Akka.Persistence.Query.Sql
Assembly:
Akka.Persistence.Query.Sql (in Akka.Persistence.Query.Sql.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public Source<EventEnvelope, NotUsed> EventsByTag(
string tag,
long offset
)
abstract EventsByTag :
tag : string *
offset : int64 -> Source<EventEnvelope, NotUsed>
override EventsByTag :
tag : string *
offset : int64 -> Source<EventEnvelope, NotUsed>
Parameters
- tag
- Type: SystemString
[Missing <param name="tag"/> documentation for "M:Akka.Persistence.Query.Sql.SqlReadJournal.EventsByTag(System.String,System.Int64)"]
- offset
- Type: SystemInt64
[Missing <param name="offset"/> documentation for "M:Akka.Persistence.Query.Sql.SqlReadJournal.EventsByTag(System.String,System.Int64)"]
Return Value
Type:
SourceEventEnvelope,
NotUsed[Missing <returns> documentation for "M:Akka.Persistence.Query.Sql.SqlReadJournal.EventsByTag(System.String,System.Int64)"]
Implements
IEventsByTagQueryEventsByTag(String, Int64)See Also