Have you considered implementing your connection as an extension but
using different configurations for the different systems?
http://doc.akka.io/docs/akka/current/general/configuration.html

On Wed, Jan 27, 2016 at 11:55 AM,  <[email protected]> wrote:
> Hello,
> my actor based application needs access to exactly one database per actor
> system. I look for a way to attach a singleton database connection object to
> the actor system. I'm looking for a kind of type safe and immutable servlet
> context like approach.
>
> First I thought about Extension's. But  I found that an extension is
> identified by an object of type ExtensionId which itself if the factory the
> extensions value.
> So the problem with that approach is that two different actor system
> instances with exactly the same code base wouldn't be able to access
> different databases via extensions.
> Since the code base of both actor system is equal, the extension key in both
> systems is also equal. The creation of the extension value is bound to the
> key both actor system would contain equal db connection values? Though there
> would be two different extension value instances their internals (host,
> port, credentials, ...) would be equal.
>
> Second I thought about Agents. But it seams that Agents are global
> sophisticated AtomicReference like objects. There seams to not exist any
> binding to an actor system at all.
>
> What I need is that the same key can produce different singleton values of
> same type per actor systems. So with key: DbConnection I could connect to db
> a in actor system A and to db b in actor system B.
>
> Thanks,
> Leslie
>
> --
>>>>>>>>>>> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to