Event Store Plugin for Akka Persistence
Akka Persistence journal and snapshot-store backed by Event Store.
Scala | 2.13.0 / 2.12.9 |
Akka | 2.5.25 |
EventStore client | 7.0.2 |
To use this plugin prior default one, add the following to application.conf
:
akka.persistence {
journal.plugin = eventstore.persistence.journal
snapshot-store.plugin = eventstore.persistence.snapshot-store
}
To configure EventStore.JVM client, see it's reference.conf
JSON serialization
Akka serializes your messages into binary data by default.
However you can add your own serializer to serialize as JSON,
But make sure you extend akka.persistence.eventstore.EventStoreSerializer
rather then akka.serialization.Serializer
.
And in case you are really going to serialize as json, please specify ContentType.Json
, it will allow you to use projections.
trait EventStoreSerializer extends Serializer {
def toEvent(o: AnyRef): EventData
def fromEvent(event: Event, manifest: Class[_]): AnyRef
}
Please check out some real examples used in tests:
Setup
Sbt
libraryDependencies += "com.geteventstore" %% "akka-persistence-eventstore" % "7.0.1"
Maven
<dependency>
<groupId>com.geteventstore</groupId>
<artifactId>akka-persistence-eventstore_${scala.version}</artifactId>
<version>7.0.1</version>
</dependency>