Closed igalic closed 4 years ago
I'm not sure how to do it in Riker, but maybe you could potentially use Arc<Mutex<ActorSystem>>
and pass it around like that?
that's basically what I'm already doing (well, without the Mutex
yet…)
but then how do i access an actor that's already started?
I think in actor systems it's normal to hold on to references once you create them and pass them to the other actors who need them.
yes, I'd just like to not pass around 5 references, when i'm also holding the ActorSystem
IMO passing around should be preferred, because then all your dependencies are more explicit. But if you don't want to do that, actor selection is probably the way to go.
aye. and that is the route we've taken, so we're on the correct (enough) path
i'm trying to store the (reference? to) the
ActorSystem
in my server's state management facility, to allow the various request handling threads of the server to have access to all theActor
s of theActorSystem
in it.But i don't understand how to get an
ActorRef
from theActorSystem
again after theActor
has already been started inmain()
. request handlers are short-lived, and it doesn't make sense for them to startActor
s, let alone have all the information passed to them that would allow them to start thoseActor
s.From what I gather, the only way to do that, is to use Selection