!per #15377 Mandate atomic writes for persistAll, and support rejections

* changing Plugin API for asyncWriteMessages and writeMessages
* passing explicit AtomicWrite that represents the events of
  persistAll, or a single event from persist
* journal may reject events before storing them, and that
  will result in onPersistRejected (logging) and continue in the
  persistent actor
* clarified the semantics with regards to batches and atomic writes,
  and failures and rejections in the api docs of asyncWriteMessages
  and writeMessages
* adjust the Java plugin API, asyncReplayMessages, doLoadAsync
This commit is contained in:
Patrik Nordwall 2015-06-23 21:01:36 +02:00
parent 33ee447ec9
commit 8c47e01e9d
38 changed files with 1500 additions and 216 deletions

View file

@ -8,7 +8,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import akka.actor.*;
import akka.dispatch.Futures;
import com.typesafe.config.Config;
@ -19,8 +19,6 @@ import akka.persistence.japi.snapshot.JavaSnapshotStoreSpec;
import akka.persistence.journal.leveldb.SharedLeveldbJournal;
import akka.persistence.journal.leveldb.SharedLeveldbStore;
import scala.concurrent.Future;
import akka.japi.Option;
import akka.japi.Procedure;
//#plugin-imports
import akka.persistence.*;
@ -87,7 +85,7 @@ public class PersistencePluginDocTest {
class MyAsyncJournal extends AsyncWriteJournal {
@Override
public Future<Void> doAsyncWriteMessages(Iterable<PersistentRepr> messages) {
public Future<Iterable<Optional<Exception>>> doAsyncWriteMessages(Iterable<AtomicWrite> messages) {
return null;
}
@ -98,7 +96,7 @@ public class PersistencePluginDocTest {
@Override
public Future<Void> doAsyncReplayMessages(String persistenceId, long fromSequenceNr,
long toSequenceNr, long max, Procedure<PersistentRepr> replayCallback) {
long toSequenceNr, long max, Consumer<PersistentRepr> replayCallback) {
return null;
}