dnvriend / akka-persistence-inmemory

Akka-persistence-inmemory is a plugin for akka-persistence that stores journal and snapshot messages memory, which is very useful when testing persistent actors, persistent FSM and akka cluster
Apache License 2.0
134 stars 41 forks source link

Improve doc for Java #68

Open olijaun opened 5 years ago

olijaun commented 5 years ago

As a beginner with AKKA (using javadsl) I had some troubles sending the "ClearJournal" message to the in-memory-store. Currently it seems not to be possible to do this with a proper Java-API. I had to use some strange "$"-classes (at least for me because I don't know Scala).

The documentation should be improved with a "full" example:

TestProbe tp = new TestProbe(akkaSetup.actorSystem());
StorageExtensionImpl extension = (StorageExtensionImpl) StorageExtension.get(akkaSetup.actorSystem());
ActorRef actorRef = extension.journalStorage();

InMemoryJournalStorage.ClearJournal$ myvar = InMemoryJournalStorage.ClearJournal$.MODULE$;
        tp.send(actorRef, myvar);
        tp.expectMsg(new Status.Success(""));

Also I'm not really sure about the versions. In maven I have 2.5.15.2 configured. However the latest version in github is 2.5.15.1.

BeatSager commented 5 years ago

Using scala case objects in java code is quite ugly. Instead of adding this to the documentation I would propose to solve this in the api by either not use case objects but empty case classes (will be warned in scala) or add some functions returning this objects.

olijaun commented 5 years ago

@BeatSager Yes, sure. I just think that until it is solved in the API the next best thing is to have it in the doc ;-)

BeatSager commented 5 years ago

@dnvriend I could change the api and prepare a pull request. What do you think about it? Do you already know when you plan to go drop support for akka 2.4 https://github.com/dnvriend/akka-persistence-inmemory/issues/57 ?