1
votes

I'm new to Akka.Actor system. I have some confusion regarding creation of actor via resolveOne approach. As We know, we can create actors via many ways.

The actorRef we create via resolveOne approach, will check if actor exists actor-system returns it's ref otherwise creates a new one.

My question is, what will happen if actorRef is already taken/busy? what will actorSystem do in this case, create another ref or wait for it ?

Also suggest me the best scenarios where we should use resolveOne approach.

1

1 Answers

1
votes

An actorRef cannot be taken/busy. ActorRefs are free to share.

resolveOne - which is a method of ActorSelection - will lookup an actorRef by path. Please note that resolveOne will NOT spawn a new actor in case it is not found. Instead, it will throw a ActorNotFound exception.

Couple of good pointers to learn more