I have 1000 orders, and I want to create an actor for each unique order. What would be the best way to safely create these actors, ensuring that I have only one unique order?
I tried to use ActorSelection first, then if I cannot find an actor with this id, I use ActorOf to create a new one, but when I start them I get a lot of ActorNotFoundException and when I then try to use ActorOf crashes with InvalidActorNameException.
Example:
try
{
actorRef = await actorSelection.ResolveOne(TimeSpan.FromMilliseconds(3000));
}
catch (ActorNotFoundException)
{
actorRef = Actor.EwmsActorSystem.ActorOf<T>(actorId);
}
source
share