Hi-
I am setting up a cluster and want to instantiate actors of the same type
with unique identities. Whenever I lookup an actor with
system.actorSelection( "/user/" + id ) that has been created on another
node, it is not found and my actor is created on the local node.
I fully expect that I am thinking about this incorrectly, but my simple
code is:
public ActorRef find( final String id ) throws Exception
{
final ActorSelection selection = system.actorSelection( "/user/" + id );
Future<ActorRef> future = selection.resolveOne( new
Timeout(1000).duration() );
try
{
return Await.result( future, new Timeout(1000).duration() );
}
catch( ActorNotFound exception )
{
LOG.info( "creating new app actor '{}'", id );
return system.actorOf( Props.create( AppActor.class, id ), id );
}
}
Even if this did work, it seems like there would be a race condition for
creating an actor of a given id.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.