Hello!
I have recently tried out Akka Projection’s EventSourcedProvider and stumbled into some problems with typing the underlying event in the EventEnvelope. E.g. as per the documentation it is SourceProvider[Offset, EventEnvelope[ShoppingCart.Event]]
.
I have been trying it out in combination with akka-persistence-jdbc and typing it like that doesn’t work if I configure an event adapter for my persistence query stream.
The problem is that the EventAdapter’s fromJournal
method returns an akka.persistence.journal.EventSeq
which in the end is the type that I receive in the journal’s eventsByTag query and not a ShoppingCart.Event
.
So instead of having EventSourcedProvider.eventsByTag[ShoppingCart.Event](..)
my stream is EventSourcedProvider.eventsByTag[EventSeq](...)
. I wonder if there is a better way to solve this or if I am overseeing something in general.
Additionally, if this actually seems to be a problem I wonder if it would make sense to allow the configuration of a typed “EventAdapter” per EventSourcedProvider, similar as to how you configure it on an akka typed event sourced behavior:
EventSourcedBehavior
.apply[?, ?, ?](...)
.eventAdapter(eventAdapter)
If the issue is unclear, I can also provide a sample project on github.
Thanks a lot!