EventStore.Akka.Persistence
EventStore.Akka.Persistence copied to clipboard
How to support typed ActorSystem ?
Hello everybody,
I started a new project and wanted to use the read journal provided in this library. I use the typed version of Akka. Unfortunately when I try to use the read journal, I get the following error:
java.lang.UnsupportedOperationException: cannot create top-level actor [eventstore-connection] from the outside on ActorSystem with custom user guardian at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:900) at eventstore.akka.EventStoreExtension.actor$lzycompute(EventStoreExtension.scala:11) at eventstore.akka.EventStoreExtension.actor(EventStoreExtension.scala:11) at eventstore.akka.EventStoreExtension.connection$lzycompute(EventStoreExtension.scala:12) at eventstore.akka.EventStoreExtension.connection(EventStoreExtension.scala:12) at akka.persistence.eventstore.query.scaladsl.EventStoreReadJournal.connection(EventStoreReadJournal.scala:112) at akka.persistence.eventstore.query.scaladsl.EventStoreReadJournal.eventsByPersistenceId$1(EventStoreReadJournal.scala:82) at akka.persistence.eventstore.query.scaladsl.EventStoreReadJournal.eventsByPersistenceId(EventStoreReadJournal.scala:99) at akka.persistence.eventstore.query.scaladsl.EventStoreReadJournal.eventsByPersistenceId(EventStoreReadJournal.scala:38)
Is there a way for me to make this work ? Would it be complicated to migrate this library to typed ?
I just stumbled upon the same problem. It seems it's still not fixed in v8.0.0
I have not looked into this, as I have not had the need for this. I guess the best path forward is a pull request.
@ahjohannessen it has to do with how the EsConnection
creates the connection
actor. I'm not familiar with the classic actor implementation, so I wouldn't know how to conserve backwards compatibility. But I understand using systemActorOf
should make it work for typed actors.
@guiwoda I am happy to help you out, but I do not have much cycles for this project. You could always reach out to akka developers and ask for pointers with regards to supporting both classic and typed actor system.