+per #15229 defer for PersistentActor
* Deferred events are not persisted, thus will not participate in replays etc. If users want events to be persisted, they can simply use `persistAsync` instead. * This, 3rd, rewrite extends the Persistent hierarchy by a top level trait "Resequenceable", which is used to mark every event to be sent in sequence back to the PersistentActor. These are split into NonPersistentRepr or PersistentRepr, and acted upon accordingly. * defer is guaranteed to be called, even after persistence failures * Includes docs updates for java/scala/java8 Resolves #15229 Depends on #15227 Conflicts: akka-docs/rst/scala/code/docs/persistence/PersistenceDocSpec.scala akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala akka-persistence/src/main/scala/akka/persistence/Processor.scala akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala project/AkkaBuild.scala
This commit is contained in:
parent
580b5af816
commit
a71790bb18
19 changed files with 905 additions and 159 deletions
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Copyright (C) 2014 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
|
||||
package akka.persistence.journal
|
||||
|
||||
import akka.persistence.{ PersistentRepr, Resequenceable }
|
||||
import akka.actor.Actor
|
||||
import scala.collection.immutable
|
||||
|
||||
private[akka] trait WriteJournalBase {
|
||||
this: Actor ⇒
|
||||
|
||||
protected def preparePersistentBatch(rb: immutable.Seq[Resequenceable]): immutable.Seq[PersistentRepr] =
|
||||
rb.filter(persistentPrepareWrite).asInstanceOf[immutable.Seq[PersistentRepr]] // filter instead of flatMap to avoid Some allocations
|
||||
|
||||
private def persistentPrepareWrite(r: Resequenceable): Boolean = r match {
|
||||
case p: PersistentRepr ⇒
|
||||
p.prepareWrite(); true
|
||||
case _ ⇒
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue