!per #18463 Make Persistence Query API explorable

* make the standard queries "single method interfaces" that may be implemented
  by a query journal plugin
* remove hints (major problems with varargs anyway), the hints for standard
  queries  should be given in configuration instead, e.g. refresh-interval
This commit is contained in:
Patrik Nordwall 2015-09-14 11:08:22 +02:00
parent a45f31cecb
commit 5bd245fbc8
46 changed files with 1487 additions and 948 deletions

View file

@ -38,10 +38,10 @@ extension:
Supported Queries
=================
EventsByPersistenceId
---------------------
EventsByPersistenceIdQuery and CurrentEventsByPersistenceIdQuery
----------------------------------------------------------------
``EventsByPersistenceId`` is used for retrieving events for a specific ``PersistentActor``
``eventsByPersistenceId`` is used for retrieving events for a specific ``PersistentActor``
identified by ``persistenceId``.
.. includecode:: code/docs/persistence/query/LeveldbPersistenceQueryDocTest.java#EventsByPersistenceId
@ -55,15 +55,10 @@ The returned event stream is ordered by sequence number, i.e. the same order as
``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 query supports two different completion modes:
* 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. This is the
default mode that is used when no hints are given. It can also be specified with
hint ``RefreshInterval``.
* The stream is completed when it reaches the end of the currently stored events.
This mode is specified with hint ``NoRefresh``.
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``.
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
@ -73,25 +68,20 @@ hint.
The stream is completed with failure if there is a failure in executing the query in the
backend journal.
AllPersistenceIds
-----------------
AllPersistenceIdsQuery and CurrentPersistenceIdsQuery
-----------------------------------------------------
``AllPersistenceIds`` is used for retrieving all ``persistenceIds`` of all persistent actors.
``allPersistenceIds`` is used for retrieving all ``persistenceIds`` of all persistent actors.
.. includecode:: code/docs/persistence/query/LeveldbPersistenceQueryDocTest.java#AllPersistenceIds
The returned event stream is unordered and you can expect different order for multiple
executions of the query.
The query supports two different completion modes:
* The stream is not completed when it reaches the end of the currently used ``persistenceIds``,
but it continues to push new ``persistenceIds`` when new persistent actors are created.
This is the default mode that is used when no hints are given. It can also be specified with
hint ``RefreshInterval``.
* The stream is completed when it reaches the end of the currently used ``persistenceIds``.
This mode is specified with hint ``NoRefresh``.
The stream is not completed when it reaches the end of the currently used `persistenceIds`,
but it continues to push new `persistenceIds` when new persistent actors are created.
Corresponding query that is completed when it reaches the end of the currently
currently used `persistenceIds` is provided by ``currentPersistenceIds``.
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.
@ -99,10 +89,10 @@ 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.
EventsByTag
-----------
EventsByTag and CurrentEventsByTag
----------------------------------
``EventsByTag`` is used for retrieving events that were marked with a given tag, e.g.
``eventsByTag`` is used for retrieving events that were marked with a given tag, e.g.
all domain events of an Aggregate Root type.
.. includecode:: code/docs/persistence/query/LeveldbPersistenceQueryDocTest.java#EventsByTag
@ -131,15 +121,10 @@ tagged event stream.
Events deleted using ``deleteMessages(toSequenceNr)`` are not deleted from the "tagged stream".
The query supports two different completion modes:
* 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. This is the
default mode that is used when no hints are given. It can also be specified with
hint ``RefreshInterval``.
* The stream is completed when it reaches the end of the currently stored events.
This mode is specified with hint ``NoRefresh``.
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``.
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