!per #3681 Performance and consistency improvements

- batch-write of persistent messages (user API)
- batch-write of events (in EventsourcedProcessor)
- command processing in EventsourcedProcessor by unstashing messages one-by-one from the internal stash
   * fixes performance issues that come up with unstashAll
- commands are not looped through journal actor but processed directly
- initial performance tests
  * command sourcing
  * event sourcing
  * event sourcing with user stash operations
- suppress stack traces in tests
This commit is contained in:
Martin Krasser 2013-10-27 08:01:14 +01:00
parent 8eeaadfee0
commit 1da3369643
29 changed files with 1324 additions and 76 deletions

View file

@ -9,6 +9,8 @@ import scala.Option;
import akka.actor.*;
import akka.persistence.*;
import static java.util.Arrays.asList;
public class PersistenceDocTest {
public interface ProcessorMethods {
@ -237,4 +239,31 @@ public class PersistenceDocTest {
}
}
};
static Object o6 = new Object() {
//#batch-write
class MyProcessor extends UntypedProcessor {
public void onReceive(Object message) throws Exception {
if (message instanceof Persistent) {
Persistent p = (Persistent)message;
if (p.payload().equals("a")) { /* ... */ }
if (p.payload().equals("b")) { /* ... */ }
}
}
}
class Example {
final ActorSystem system = ActorSystem.create("example");
final ActorRef processor = system.actorOf(Props.create(MyProcessor.class));
public void batchWrite() {
processor.tell(PersistentBatch.create(asList(
Persistent.create("a"),
Persistent.create("b"))), null);
}
// ...
}
//#batch-write
};
}

View file

@ -45,6 +45,11 @@ public class PersistencePluginDocTest {
return null;
}
@Override
public Future<Void> doWriteBatchAsync(Iterable<PersistentImpl> persistentBatch) {
return null;
}
@Override
public Future<Void> doDeleteAsync(PersistentImpl persistent) {
return null;