Akka persistence plugin and JSON serialization

We’re trying out EventStoreDB with Akka Persistence and the eventstore-akka-persistence plugin. We’ve successfully stored event as binary, but when trying to store them as JSON as the README suggests, we’re getting the following problems:

Our events are using jackson-json serialization bindings, but we had to “force” Akka to match “PersistentRepr” to “EventStoreJsonSerializer”, our serializer implementing the plugin’s trait, that lazily tries to find the JacksonJsonSerializer from the SerializationExtension facade:

akka.actor {
   serializers {
    jackson-json = "akka.serialization.jackson.JacksonJsonSerializer"
    events-json = "com.example.EventStoreJsonSerializer"

  serialization-bindings {
    "com.example.Jsonable" = jackson-json
    "akka.persistence.PersistentRepr" = events-json

But, when serializing polymorphic events annotated with @JsonTypeInfo, the type information is lost.

package com.example;

public interface AccountEvent extends Jsonable {
    @JsonTypeInfo(use = Id.NAME, property = "type")
        @JsonSubTypes.Type(value = HoldingFound.class, name = "holding-found.v1"),
        @JsonSubTypes.Type(value = HoldingModified.class, name = "holding-modified.v1"),
        @JsonSubTypes.Type(value = HoldingRemoved.class, name = "holding-removed.v1"),
    interface HoldingEvent extends AccountEvent {}
    // implementations ommitted for brevity.

While the serializer does serialize the PersistentRepr, it fails to add the type property to them.

We’ve tried sending the payload directly to the serializer and it does add the type there, so it seems to be some sort of problem when our payload is wrapped into the PersistentRepr, and the PersistentRepr itself is not handled by the jackson-json serializer.

EDIT: The problem seems to be how Jackson serializes the PersistentRepr. The internal payload stored in it is not typed (it’s a scala’s Any type) so Jackson doesn’t find the corresponding annotations when serializing the instance.