Derek Wyatt
Posts: 69
Nickname: dwyatt
Registered: Oct, 2012
|
|
Re: actorFor Outside ActorSystem
|
Posted: Dec 4, 2012 2:50 AM
|
|
That's a good question. I'm not sure I really have a huge opinion on this, though. Akka tends to make this stuff pretty transparent and universal, so what works for one ActorSystem works for more than one.
With that said, the patterns can be slightly different when it comes to the real-world usage of things. I use separate ActorSystems rather rarely; the only time I've done it is to segment two distinct parts of a running system that were truly separate components on their own. They were more like entirely separate apps.
In that configuration, I tended to use the two systems as distinct services from one another. Each system loaded up its Actors and did its work independently of the other, so nobody performed an actorOf() on anything but their own system.
In order to get Actor references between systems, I found it easiest to create well known entry points in each system (e.g. /user/ServiceManager) and used those as lookup services / delegators. Stuff like this:
// The remote Actor delegates and possibly proxies the request / response remoteSystem.actorFor("/user/ServiceManager") ! DoSomeWork(work)
// The remote Actor returns the reference to the internal Actor that I'm interested in remoteSystem.actorFor("/user/ServiceManager") ! LookupService(identifier)
These were very short-lived calls and I never had any reason to put deathwatch on them or anything like that.
As with most things, it really just depends on how you want to lay your app out.
|
|