ironfish / akka-persistence-mongo Goto Github PK
View Code? Open in Web Editor NEWAn Akka Persistence Plugin for Mongo
License: Apache License 2.0
An Akka Persistence Plugin for Mongo
License: Apache License 2.0
Hello,
I'm testing the akka-sample-persistence-java in typesafe, but get only 30 persistent messages per second and I think I must get something wrong.
here is my build.sbt file,
name := """akka-sample-persistence-java"""
version := "2.3.5"
scalaVersion := "2.10.4"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies ++= Seq(
"com.github.ddevore" %% "akka-persistence-mongo-casbah" % "0.7.4" % "compile",
"com.typesafe.akka" %% "akka-persistence-experimental" % "2.3.5",
"com.github.ironfish" %% "akka-persistence-mongo-casbah" % "0.7.5-SNAPSHOT" % "compile"
)
And my application.conf is,
akka.persistence.journal.plugin = "casbah-journal"
casbah-journal.mongo-journal-url = "mongodb://localhost:27017/store.messages"
akka.persistence.snapshot-store.plugin = "casbah-snapshot-store"
casbah-snapshot-store.mongo-snapshot-url = "mongodb://localhost:27017/store.snapshots"
my mongodb is 2.4.12, and I just use command "mongod" to start the default mongo. And my test code is,
public static void main(String... args) throws Exception {
final ActorSystem system = ActorSystem.create("example");
final ActorRef persistentActor =
system.actorOf(Props.create(ExamplePersistentActor.class), "persistentActor-4-java");
for(int i = 0;i < 100000; i++){
persistentActor.tell(new Cmd("a"), null);
}
Thread.sleep(60000);
system.shutdown();
}
when i run with cassadra with the same code, i can persist about 3000 messages per second, but only 30 with mongodb.
Extract unit test into JouranlSpec.
When setting casbah-snapshot-store.mongo-snapshot-url
to something custom;
casbah-snapshot-store.mongo-snapshot-url = "mongodb://localhost:27017/wowcrafters-informant"
akka.persistence.snapshot-store.plugin = "casbah-snapshot-store"
Throws an exception:
[ERROR] [08/17/2014 11:15:20.679] [informant-akka.actor.default-dispatcher-2] [akka://informant/system/snapshot-store] None.get
akka.actor.ActorInitializationException: exception during creation
at akka.actor.ActorInitializationException$.apply(Actor.scala:164)
at akka.actor.ActorCell.create(ActorCell.scala:596)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
at akka.dispatch.Mailbox.run(Mailbox.scala:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:313)
at scala.None$.get(Option.scala:311)
at akka.persistence.mongo.snapshot.CasbahSnapshotHelper$class.$init$(CasbahSnapshotHelper.scala:30)
at akka.persistence.mongo.snapshot.CasbahSnapshotStore.<init>(CasbahSnapshotStore.scala:18)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at akka.util.Reflect$.instantiate(Reflect.scala:45)
at akka.actor.NoArgsReflectConstructor.produce(Props.scala:361)
at akka.actor.Props.newActor(Props.scala:252)
at akka.actor.ActorCell.newActor(ActorCell.scala:552)
at akka.actor.ActorCell.create(ActorCell.scala:578)
... 7 more
Scala version: 2.10.4
Hello,
in the last versions processorId was renamed to persistenceId in the bson document.
Therefore all the events we already persisted before upgrading to the new version could not be read anymore. We could work around it, but it would be nice if there would be a warning in the documentation about it.
For the future - is it possible to name this key independent from how it is called in akka persistence - smthg. like pid?
thanks,
michael
akka.loglevel = "ERROR"
should not be defined in reference.conf, since it might change the defaults of akka. That is something that only applications should change.
Similar with akka.persistence.journal.plugin
. The plugin should not be activated just by adding it as a dependcency. This should be specifed in application.
Why akka.persistence.publish-confirmations=on
?
Is mongo-journal-write-concern = "acknowledged"
a good default? Isn't it too unsafe?
It was resolving just fine yesterday but is gone today:
[warn] module not found: com.github.ddevore#akka-persistence-mongo-casbah_2.10;0.7.4-SNAPSHOT
[warn] ==== local: tried
[warn] /Users/jean/.ivy2/local/com.github.ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/github/ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/akka-persistence-mongo-casbah_2.10-0.7.4-SNAPSHOT.pom
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/github/ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/akka-persistence-mongo-casbah_2.10-0.7.4-SNAPSHOT.pom
[warn] ==== sbt-plugin-snapshots: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/com.github.ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.github.ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/ivys/ivy.xml
[warn] ==== Sonatype Snapshots: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/com/github/ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/akka-persistence-mongo-casbah_2.10-0.7.4-SNAPSHOT.pom
[warn] ==== playvertx Repository: tried
[warn] http://fmasion.github.com/releases/com.github.ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/ivys/ivy.xml
[warn] ==== Rhinofly Internal Repository: tried
[warn] http://maven-repository.rhinofly.net:8081/artifactory/libs-release-local/com/github/ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/akka-persistence-mongo-casbah_2.10-0.7.4-SNAPSHOT.pom
[warn] ==== eu.byjean.repo: tried
[warn] http://dl.bintray.com/jeantil/maven/com/github/ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/akka-persistence-mongo-casbah_2.10-0.7.4-SNAPSHOT.pom
[warn] ==== FMasion bintray repository: tried
[warn] http://dl.bintray.com/fmasion/maven/com/github/ddevore/akka-persistence-mongo-casbah_2.10/0.7.4-SNAPSHOT/akka-persistence-mongo-casbah_2.10-0.7.4-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.ddevore#akka-persistence-mongo-casbah_2.10;0.7.4-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
Also I was wondering if there are plans to make a release of 0.7.4
thanks
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.ddevore#akka-persistence-mongo-common_2.10;0.3-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: com.github.ddevore#akka-persistence-mongo-common_2.10;0.3-SNAPSHOT: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:213)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:104)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:51)
at sbt.IvySbt$$anon$3.call(Ivy.scala:60)
When trying out the Kryo serialization I noticed that my snapshots were never serialized with Kryo but always with the standard Java serializer. The cause is, I think, that the SelectedSnapshot is serialized which is not handled by the Akka peristence SnapshotSerializer that is registered.
See pull request #75 for a fix I tested with my project.
When connecting to a remote mongo database with credentials authentication fails against targeted collection
example URL: mongodb://[username:password@]remotehost:27017/store.messages
Here is how I used the sharding:
ClusterSharding(system).start(
typeName = "CoreProcessor",
entryProps = if (cluster.selfRoles.contains("normal")) Some(Props[CoreProcessor]) else None,
idExtractor = { case msg => ("1", msg) },
shardResolver = { case _ => "1" })
When I stop the actor system that runs the event sourced processor, another actor system (that I believe tries to become a backup) raised this error:
[ERROR] [02/14/2014 01:49:44.104] [kio-akka.persistence.dispatchers.default-plugin-dispatcher-18] [akka://kio/user/sharding/CoreProcessorCoordinator/singleton] swallowing exception during message send
java.io.NotSerializableException: com.mongodb.ServerAddress
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1165)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1535)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1413)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1159)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1535)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1413)
When db become unavailable akka will try recreate CasbahJournal actor and this operation failed with PostRestartException. The reason is CasbahJournalHelper lines (47,48,49). Maybe we need to find more suitable place for this operations
Logging configuration should entirely be up to the users. You probably want to also move your dependency on logback to the "test" configuration.
The README says you can fetch akka-persistence-mongo via the sonatype snapshot repo, and uses 0.7.4-SNAPSHOT as the example version to fetch from there.
I'm pretty sure this worked for me once in the past, as I'm using 0.7.4 on one of my machines -- but I've just tired building elsewhere, and I'm now unable to fetch 0.7.4 from there -- 0.7.3 seems to be the most recent version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.