public interface PersistentEntityRegistry
PersistentEntity
classes must be registered here
with register(java.lang.Class<? extends com.lightbend.lagom.javadsl.persistence.PersistentEntity<C, E, S>>)
.
Later, PersistentEntityRef
can be retrieved with refFor(java.lang.Class<? extends com.lightbend.lagom.javadsl.persistence.PersistentEntity<C, ?, ?>>, java.lang.String)
.
Commands are sent to a PersistentEntity
using a PersistentEntityRef
.
Modifier and Type | Method and Description |
---|---|
<Event extends AggregateEvent<Event>> |
eventStream(AggregateEventTag<Event> aggregateTag,
Offset fromOffset)
A stream of the persistent events that have the given
aggregateTag , e.g. |
<Event extends AggregateEvent<Event>> |
eventStream(AggregateEventTag<Event> aggregateTag,
Optional<UUID> fromOffset)
Deprecated.
Use eventStream(AggregateEventTag, Offset) instead. Since 1.2.0.
|
CompletionStage<akka.Done> |
gracefulShutdown(scala.concurrent.duration.FiniteDuration timeout)
Gracefully stop the persistent entities and leave the cluster.
|
<C> PersistentEntityRef<C> |
refFor(Class<? extends PersistentEntity<C,?,?>> entityClass,
String entityId)
Retrieve a
PersistentEntityRef for a given PersistentEntity class
and identifier. |
<C,E,S> void |
register(Class<? extends PersistentEntity<C,E,S>> entityClass)
At system startup all
PersistentEntity classes must be registered
with this method. |
<C,E,S> void register(Class<? extends PersistentEntity<C,E,S>> entityClass)
PersistentEntity
classes must be registered
with this method.<C> PersistentEntityRef<C> refFor(Class<? extends PersistentEntity<C,?,?>> entityClass, String entityId)
PersistentEntityRef
for a given PersistentEntity
class
and identifier. Commands are sent to a PersistentEntity
using a PersistentEntityRef
.<Event extends AggregateEvent<Event>> akka.stream.javadsl.Source<akka.japi.Pair<Event,Offset>,akka.NotUsed> eventStream(AggregateEventTag<Event> aggregateTag, Offset fromOffset)
aggregateTag
, e.g.
all persistent events of all Order
entities.
The type of the offset is journal dependent, some journals use time-based
UUID offsets, while others use sequence numbers. The passed in fromOffset
must either be Offset.NONE
, or an offset that has previously been produced
by this journal.
The stream will begin with events starting ''after'' fromOffset
.
To resume an event stream, store the Offset
corresponding to the most
recently processed Event
, and pass that back as the value for
fromOffset
to start the stream from events following that one.
IllegalArgumentException
- If the fromOffset
type is not supported
by this journal.<Event extends AggregateEvent<Event>> akka.stream.javadsl.Source<akka.japi.Pair<Event,UUID>,akka.NotUsed> eventStream(AggregateEventTag<Event> aggregateTag, Optional<UUID> fromOffset)
aggregateTag
, e.g.
all persistent events of all Order
entities.
This method will only work with journals that support UUID offsets. Journals that produce sequence offsets will fail during stream handling.
CompletionStage<akka.Done> gracefulShutdown(scala.concurrent.duration.FiniteDuration timeout)
CompletionStage
is completed when the node has been
removed from the cluster