PersistentEntity to glue together Sharding and PersistentBehavior better
* Makes the combination more visable
* You don't have to worry about the persistenceId, only EntityTypeKey and entityId
* The glue is stronger in the javadsl because of two reasons
* Couldn't realisticly create a PersistentEntity class extending PersistenBehavior (which
contains all the optional parameters and functions) since that would duplicate too much.
* The ActorContext would be needed in the ShardedEntityContext parameter and because of the
additional M type parameters the type inference breaks down when using the factory. Would
require specifying the type of the ShardedEntityContex[M] parameter. That problem doesn't
seem to exist in Java.
renamed:
s/ShardedEntityContext/EntityContext/
s/ShardedEntity/Entity/
This commit is contained in:
parent
bed17cc172
commit
2672bd7a95
19 changed files with 670 additions and 165 deletions
|
|
@ -14,6 +14,11 @@ import akka.persistence.typed.ExpectingReply
|
|||
|
||||
object EffectFactory extends EffectFactories[Nothing, Nothing, Nothing]
|
||||
|
||||
/**
|
||||
* Factory methods for creating [[Effect]] directives.
|
||||
*
|
||||
* Not for user extension
|
||||
*/
|
||||
@DoNotInherit sealed class EffectFactories[Command, Event, State] {
|
||||
/**
|
||||
* Persist a single event
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ package akka.persistence.typed.scaladsl
|
|||
import akka.Done
|
||||
import akka.actor.typed.BackoffSupervisorStrategy
|
||||
import akka.actor.typed.Behavior.DeferredBehavior
|
||||
import akka.annotation.InternalApi
|
||||
import akka.persistence._
|
||||
import akka.persistence.typed.EventAdapter
|
||||
import akka.persistence.typed.internal._
|
||||
|
|
@ -85,9 +84,14 @@ object PersistentBehavior {
|
|||
}
|
||||
|
||||
/**
|
||||
* Not intended for user extension.
|
||||
* Further customization of the `PersistentBehavior` can be done with the methods defined here.
|
||||
*
|
||||
* Not for user extension
|
||||
*/
|
||||
@DoNotInherit trait PersistentBehavior[Command, Event, State] extends DeferredBehavior[Command] {
|
||||
|
||||
def persistenceId: PersistenceId
|
||||
|
||||
/**
|
||||
* The `callback` function is called to notify the actor that the recovery process
|
||||
* is finished.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue