EventStore / EventStore.Akka.Persistence

Event Store Journal for Akka Persistence
BSD 3-Clause "New" or "Revised" License
74 stars 21 forks source link

How to support typed ActorSystem ? #53

Open la-urre opened 4 years ago

la-urre commented 4 years ago

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 ?

guiwoda commented 2 years ago

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

ahjohannessen commented 2 years ago

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.

guiwoda commented 2 years ago

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

ahjohannessen commented 2 years ago

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