+per #3746 Remote sharing of LevelDB for testing purposes
Further changes - remove obsolete identity checks in Eventsourced - fix wrong serialize-messages config in tests
This commit is contained in:
parent
4d05253391
commit
d0bc8a6400
20 changed files with 649 additions and 179 deletions
|
|
@ -5,6 +5,7 @@
|
|||
package docs.persistence;
|
||||
|
||||
//#plugin-imports
|
||||
import akka.actor.UntypedActor;
|
||||
import scala.concurrent.Future;
|
||||
import akka.japi.Option;
|
||||
import akka.japi.Procedure;
|
||||
|
|
@ -12,8 +13,44 @@ import akka.persistence.*;
|
|||
import akka.persistence.journal.japi.*;
|
||||
import akka.persistence.snapshot.japi.*;
|
||||
//#plugin-imports
|
||||
import akka.actor.*;
|
||||
import akka.persistence.journal.leveldb.SharedLeveldbJournal;
|
||||
import akka.persistence.journal.leveldb.SharedLeveldbStore;
|
||||
|
||||
public class PersistencePluginDocTest {
|
||||
|
||||
|
||||
static Object o1 = new Object() {
|
||||
final ActorSystem system = null;
|
||||
//#shared-store-creation
|
||||
final ActorRef store = system.actorOf(Props.create(SharedLeveldbStore.class), "store");
|
||||
//#shared-store-creation
|
||||
|
||||
//#shared-store-usage
|
||||
class SharedStorageUsage extends UntypedActor {
|
||||
@Override
|
||||
public void preStart() throws Exception {
|
||||
String path = "akka.tcp://example@127.0.0.1:2552/user/store";
|
||||
ActorSelection selection = getContext().actorSelection(path);
|
||||
selection.tell(new Identify(1), getSelf());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Object message) throws Exception {
|
||||
if (message instanceof ActorIdentity) {
|
||||
ActorIdentity identity = (ActorIdentity) message;
|
||||
if (identity.correlationId().equals(1)) {
|
||||
ActorRef store = identity.getRef();
|
||||
if (store != null) {
|
||||
SharedLeveldbJournal.setStore(store, getContext().system());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//#shared-store-usage
|
||||
};
|
||||
|
||||
class MySnapshotStore extends SnapshotStore {
|
||||
@Override
|
||||
public Future<Option<SelectedSnapshot>> doLoadAsync(String processorId, SnapshotSelectionCriteria criteria) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue