Example #1
0
        private async Task <IActorRef> GetOrCreateCustomer(int id)
        {
            string name = CustomerActor.CreateName(id);

            try
            {
                return(await _actorSystem.ActorSelection($"akka://AkkaWeb/user/" + CustomerActor.CreateName(id))
                       .ResolveOne(TimeSpan.FromMilliseconds(250)));
            }
            catch (ActorNotFoundException)
            {
                return(_actorSystem.ActorOf(Props.Create(() => new CustomerActor(id, _bank)), name));
            }
        }