Eventsourced applications can create a mongoDB reactivemongo backed journal using the MongodbReactiveJournalProps configuration object.
A mongoDB reactive journal has the following properties when running on a real mongoDB cluster:
- Highly available.
- Horizontal scalability of writes via sharding.
- Horizontal scalability of reads (replay) via sharding.
- Writes evenly distributed via sharding.
- All reads and writes are asynchornous and non-blocking.
- Efficient per-processor recovery.
- Efficient per-channel recovery (applies to reliable channels).
Experimental but fully functional.
This section shows how to initialize a journal that connects to a local, standalone mongoDB instance.
First, download, install and start a standalone mongoDB instance by following the instructions in the mongoDB Installing MongoDB. Then add the required dependencies to your project's build.sbt
file:
resolvers += "Eligosource Snapshots" at "http://repo.eligotech.com/nexus/content/repositories/eligosource-snapshots"
libraryDependencies += "org.eligosource" %% "eventsourced-core" % "0.7-SNAPSHOT"
libraryDependencies += "org.eligosource" %% "eventsourced-journal-mongodb-reactive" % "0.7-SNAPSHOT"
import akka.actor._
import org.eligosource.eventsourced.core._
import org.eligosource.eventsourced.journal.mongodb.reactive.MongodbReactiveJournalProps
implicit val system = ActorSystem("example")
// create and start the reactive based mongoDB journal
val journal: ActorRef = MongodbReactiveJournalProps(List("localhost:27017").createJournal
// create an event-sourcing extension that uses the ReactiveMongo based mongoDB journal
val extension = EventsourcingExtension(system, journal)
// ...