!per persistAsync
Breaks binary compatibility because adding new methods to Eventsourced trait. Since akka-persistence is experimental this is ok, yet source-level compatibility has been perserved thankfuly :-) Deprecates: * Rename of EventsourcedProcessor -> PersistentActor * Processor -> suggest using PersistentActor * Migration guide for akka-persistence is separate, as wel'll deprecate in minor versions (its experimental) * Persistent as well as ConfirmablePersistent - since Processor, their main user will be removed soon. Other changes: * persistAsync works as expected when mixed with persist * A counter must be kept for pending stashing invocations * Uses only 1 shared list buffer for persit / persistAsync * Includes small benchmark * Docs also include info about not using Persistent() wrapper * uses java LinkedList, for best performance of append / head on persistInvocations; the get(0) is safe, because these msgs only come in response to persistInvocations * Renamed internal *MessagesSuccess/Failure messages because we kept small mistakes seeing the class "with s" and "without s" as the same * Updated everything that refered to EventsourcedProcessor to PersistentActor, including samples Refs #15227 Conflicts: akka-docs/rst/project/migration-guides.rst akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala akka-persistence/src/main/scala/akka/persistence/Persistent.scala akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala project/AkkaBuild.scala
This commit is contained in:
parent
5f3d6029b1
commit
d51b79c95a
32 changed files with 907 additions and 134 deletions
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
package sample.persistence;
|
||||
|
||||
//#eventsourced-example
|
||||
//#persistent-actor-example
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import akka.actor.Props;
|
||||
import akka.japi.pf.ReceiveBuilder;
|
||||
import akka.persistence.AbstractEventsourcedProcessor;
|
||||
import akka.persistence.AbstractPersistentActor;
|
||||
import akka.persistence.SnapshotOffer;
|
||||
import scala.PartialFunction;
|
||||
import scala.runtime.BoxedUnit;
|
||||
|
|
@ -73,7 +73,7 @@ class ExampleState implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
class ExampleProcessor extends AbstractEventsourcedProcessor {
|
||||
class ExampleProcessor extends AbstractPersistentActor {
|
||||
private ExampleState state = new ExampleState();
|
||||
|
||||
public int getNumEvents() {
|
||||
|
|
@ -104,9 +104,9 @@ class ExampleProcessor extends AbstractEventsourcedProcessor {
|
|||
match(String.class, s -> s.equals("print"), s -> System.out.println(state)).build();
|
||||
}
|
||||
}
|
||||
//#eventsourced-example
|
||||
//#persistent-actor-example
|
||||
|
||||
public class EventsourcedExample {
|
||||
public class PersistentActorExample {
|
||||
public static void main(String... args) throws Exception {
|
||||
final ActorSystem system = ActorSystem.create("example");
|
||||
final ActorRef processor = system.actorOf(Props.create(ExampleProcessor.class), "processor-4-java8");
|
||||
|
|
@ -11,8 +11,6 @@ import akka.japi.pf.ReceiveBuilder;
|
|||
import akka.persistence.AbstractProcessor;
|
||||
import akka.persistence.Persistent;
|
||||
import scala.Option;
|
||||
import scala.PartialFunction;
|
||||
import scala.runtime.BoxedUnit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ current processor state to <code>stdout</code>.
|
|||
|
||||
<p>
|
||||
To run this example, go to the <a href="#run" class="shortcut">Run</a> tab, and run the application main class
|
||||
<b><code>sample.persistence.EventsourcedExample</code></b> several times.
|
||||
<b><code>sample.persistence.PersistentActorExample</code></b> several times.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue