Hi
I use akka version 2.6.6 with scala version 2.13 for akka-serialization-jackson.
I want to save a snapshot from an AbstractPersistentActor’s state:
ArrayList<Foo> state
where Foo is defined as:
public class Foo {
public final String name;
public final double value;
public Foo(String name, double value) {
this.name = name;
this.value = value;
}
}
Akka tells me the correct serializer is used when saving the snapshot:
Using serializer [akka.serialization.jackson.JacksonCborSerializer] for message [java.util.ArrayList]
.
This is as expected because I added a serialization-bindings "java.util.List" = jackson-cbor
But when I get the SnapshotOffer and set state to the deserialized snapshot:
state = (ArrayList<Foo>) snapshotOffer.snapshot();
I get an ArrayList<scala$collection$immutable$Map$Map2>
instead.
How can I prevent this and configure persistence such that I get an ArrayList<Foo>
from the SnapshotOffer?
This should also work with more complex data structures than Foo.
I use inmem journal with local snapshot-store for testing.
Thanks!