EventStore.Akka.Persistence icon indicating copy to clipboard operation
EventStore.Akka.Persistence copied to clipboard

How to support typed ActorSystem ?

Open la-urre opened this issue 4 years ago • 4 comments

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 ?

la-urre avatar Apr 25 '20 19:04 la-urre

I just stumbled upon the same problem. It seems it's still not fixed in v8.0.0

guiwoda avatar Jan 19 '22 21:01 guiwoda

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 avatar Jan 20 '22 08:01 ahjohannessen

@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 avatar Jan 20 '22 17:01 guiwoda

@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.

ahjohannessen avatar Jan 21 '22 08:01 ahjohannessen