I stumbled on to a DI/Service locator pattern yesterday, using an extension
as the ‘application context’ if you will.
Something along the lines of
trait Dependencies{
def serviceA : ActorRef
def serviceB: ServiceTrait
}
case class DI(system: ExtendedActorSystem) extends Extension with
Dependencies{...}
object DI extends ExtensionId[DI] with ExtensionIdProvider{...}
val serviceA = DI(system).serviceA
I havent seen this approach described anywhere. I like this approach as it
allows a central place to do stuff like init of ClusterSingletons, Sharding
etc..
It also will let you actually use a DI framework like guice to inject the
DI instance.
Anyone done similar? Anything that didnt work out?
--
>>>>>>>>>> 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.