Hi Jason,
thanks for the precise description, I can tell you exactly what goes wrong where: your local ActorRef from the clustered system does not have host:port information when you pass it to the actor in the nonClustered system, and when that actor sends it to some remote ActorRef the remoting layer of the nonClustered system will try to serialize the ActorRef, find it incomplete and fill in the missing bits with its own host:port.
Now the question is whether and if yes then how it should work. The only robust solution I can think of now is to explicitly hand off the ActorRef from one system to the other, thereby making it “remote”:
val addr = clustered match {
case eas: ExtendedActorSystem => eas.provider.getDefaultAddress
}
val path = actorRef.path.toStringWithAddress(addr)
val remoteRef = nonClustered.actorFor(path)
This is a use-case which I’ll have to sleep over before deciding on the ticket …
Regards,
Roland
7 mar 2013 kl. 23:13 skrev Jason Kolb:
Hey guys,
I'm trying to set up two actor system: one which is a remote-enabled actor system that's shared across all nodes, another that's clustered and only shared across a subset. That part is working fine.
What I want to do, though, is create an ActorRef on the clustered system and pass it to a node that's not participating in the cluster so that it can .tell() the actor to do something. The problem I'm running into is that if I create an ActorRef in the cluster-enabled actor system and pass it to the normal actor system, the actor somehow becomes transformed into an ActorRef on the non-clustered system.
Here's the chain of events:
- Non-cluster-participating node runs an actor which looks up a remote actor on the cluster-participating node that acts as a proxy for creating actors.
- The proxy, running on the clustered node, creates an actor in the clustered actor system, and passes the ActorRef back to the calling actor. Before being passed back the clustered actor looks correct, if you look at its path it's on the clustered actor system (akka://clusteredA...@127.0.0.1:2551/user/actor).
- When the actor on the non-clustered system receives the ActorRef, its path has been somehow transformed to be a part of the non-clustered actor system (it has turned into akka://nonClustere...@127.0.0.1:2551/user/actor)
From reading the docs I had thought that ActorRefs could be passed around and used pretty much at will, but the way this is not always true with clustered actors. Should my scenario work? I'd be happy to provide code if it would help, but all this requires a fair number of actors so I didn't want to just throw everything up there.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Dr. Roland KuhnAkka Tech LeadTypesafe – Empowering professional developers to build amazing apps.
twitter:
@rolandkuhn