Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

EventStore/EventStore.Akka.Persistence

Repository files navigation

Warning

DEPRECATION NOTICE:

  • EventStoreDB version 23.10.x is the last OSS version to support the tcp protocol based client.
  • This project is no longer maintained. We recommend moving to EventStoreDB-Client-Java for ongoing updates and support.

Event Store Plugin for Akka Persistence Continuous Integration Version

Akka Persistence journal and snapshot-store backed by EventStoreDB.

Scala 3.1.0 / 2.13.7 / 2.12.15
Akka 2.6.18
EventStore client 8.0.1

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" % "8.0.1"

Maven

<dependency>
    <groupId>com.geteventstore</groupId>
    <artifactId>akka-persistence-eventstore_${scala.version}</artifactId>
    <version>8.0.0</version>
</dependency>