diff --git a/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/CurrentEventsByTagQuery.scala b/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/CurrentEventsByTagQuery.scala index 2cd1d03705..9d6edad8b0 100644 --- a/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/CurrentEventsByTagQuery.scala +++ b/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/CurrentEventsByTagQuery.scala @@ -15,8 +15,11 @@ trait CurrentEventsByTagQuery extends ReadJournal { /** * Same type of query as [[EventsByTagQuery#eventsByTag]] 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. + * 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. */ def currentEventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] } diff --git a/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByPersistenceIdQuery.scala b/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByPersistenceIdQuery.scala index 9ac5988875..4ca9fd5cad 100644 --- a/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByPersistenceIdQuery.scala +++ b/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByPersistenceIdQuery.scala @@ -17,7 +17,8 @@ trait EventsByPersistenceIdQuery extends ReadJournal { * 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. + * 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. * diff --git a/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByTagQuery.scala b/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByTagQuery.scala index 148004ff6a..96bcbd5b56 100644 --- a/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByTagQuery.scala +++ b/akka-persistence-query/src/main/scala/akka/persistence/query/javadsl/EventsByTagQuery.scala @@ -27,6 +27,13 @@ trait EventsByTagQuery extends ReadJournal { * timestamp (taken when the event was created or stored). Timestamps are not unique and * not strictly ordered, since clocks on different machines may not be synchronized. * + * In strongly consistent stores, where the `offset` is unique and strictly ordered, the + * stream should start from the next event after the `offset`. Otherwise, the read journal + * should ensure that between an invocation that returned an event with the given + * `offset` and this invocation, no events are missed. Depending on the journal + * implementation, this may mean that this invocation will return events that were already + * returned by the previous invocation, including the event with the passed in `offset`. + * * The returned event stream should be ordered by `offset` if possible, but this can also be * difficult to fulfill for a distributed data store. The order must be documented by the * read journal plugin. diff --git a/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/CurrentEventsByTagQuery.scala b/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/CurrentEventsByTagQuery.scala index cbfeb7b7a4..e7c2e02c99 100644 --- a/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/CurrentEventsByTagQuery.scala +++ b/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/CurrentEventsByTagQuery.scala @@ -15,8 +15,11 @@ trait CurrentEventsByTagQuery extends ReadJournal { /** * Same type of query as [[EventsByTagQuery#eventsByTag]] 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. + * 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. */ def currentEventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] diff --git a/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByPersistenceIdQuery.scala b/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByPersistenceIdQuery.scala index 13e12da6e6..c39b45f491 100644 --- a/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByPersistenceIdQuery.scala +++ b/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByPersistenceIdQuery.scala @@ -17,7 +17,8 @@ trait EventsByPersistenceIdQuery extends ReadJournal { * 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. + * 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. * diff --git a/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByTagQuery.scala b/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByTagQuery.scala index ec99fa2324..fb6c08def3 100644 --- a/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByTagQuery.scala +++ b/akka-persistence-query/src/main/scala/akka/persistence/query/scaladsl/EventsByTagQuery.scala @@ -27,6 +27,13 @@ trait EventsByTagQuery extends ReadJournal { * timestamp (taken when the event was created or stored). Timestamps are not unique and * not strictly ordered, since clocks on different machines may not be synchronized. * + * In strongly consistent stores, where the `offset` is unique and strictly ordered, the + * stream should start from the next event after the `offset`. Otherwise, the read journal + * should ensure that between an invocation that returned an event with the given + * `offset`, and this invocation, no events are missed. Depending on the journal + * implementation, this may mean that this invocation will return events that were already + * returned by the previous invocation, including the event with the passed in `offset`. + * * The returned event stream should be ordered by `offset` if possible, but this can also be * difficult to fulfill for a distributed data store. The order must be documented by the * read journal plugin.