@frandayz wrote:
We are using event sourcing with Akka Persistence by extending EventSourcedBehavior. When we create the persistent actor we give it an unique name, by using an uuid (the same we use inside
create
to build thePersistenceId
, for entity sharding):UUID uuid = UUID.randomUUID(); String name = MyBehavior.nameFor(uuid); ActorRef<Command> actorRef = context.spawn(MyBehavior.create(uuid), name);
Later on, when we want to send further commands to the actor, we would like to get an
ActorRef<Command>
from the context, since theactorRef
object reference returned byspawn
won’t be in scope anymore. Think about commands as a result of subsequents HTTP requests.We can’t use
context.getChild(name)
as it returnsActorRef<Void>
.We’ve also considered actor discovery with Receptionist, but the documentation says it doesn’t scale to any number of actors:
https://doc.akka.io/docs/akka/current/typed/actor-discovery.html#receptionist-scalability
On the other hand, ActorSelection is not supported in typed, as per the following link:
https://doc.akka.io/docs/akka/current/typed/from-classic.html#actorselection
We are not sure about the right approach here. Any help would be much appreciated.
Posts: 2
Participants: 2