Re: [akka-user] akka extensions with arguments, any wise words ?

2014-05-10 Thread Akka Team
Hi Olger,

Akka Extensions are a mechanism that allows arbitrary actors to access a
given object or piece of functionality that is scoped to the ActorSystem,
i.e. created only once. This means that creation happens conceptually
“before the first actor is started”, it is merely retrieved when needed
(and optimized to be only created at the first appearance of need). This in
turn means that arguments to its constructor must come from the ActorSystem
itself, hence from configuration as you also figured out. You can use
system.dynamicAccess in order to reflectively create your factory from a
fully qualified class name.

Regards,

Roland



On Fri, May 9, 2014 at 6:14 PM, Olger Warnier ol...@spectare.nl wrote:

 Hi All,

 I try to create an extension that needs a parameter in order todo it's
 job.

 extensions are created like:

 override def createExtension(system: ExtendedActorSystem) = {
 new MyExtension(system)
   }

 And I'd like have something like 'new MyExtension(system,
 myCustomParameter: AType)'
 The custom parameter is actually a kind of Actor Factory that will create
 specific handling actors for use with this specific instance of the actor
 system
 and should be passed someway into the extensions when it's created

 Now, it's possible to have this type in the conf file, and construct from
 there, but I was wondering if this is possible via the code.

 Kind regards,

 Olger




  --
  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 akka-user+unsubscr...@googlegroups.com.
 To post to this group, send email to akka-user@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] akka extensions with arguments, any wise words ?

2014-05-10 Thread Olger Warnier
Hi Roland, 

Thanks for your clarification, very helpful to get understand this in the 
proper way. 

Kind regards, 

Olger

On Saturday, May 10, 2014 12:34:50 PM UTC+2, Akka Team wrote:

 Hi Olger,

 Akka Extensions are a mechanism that allows arbitrary actors to access a 
 given object or piece of functionality that is scoped to the ActorSystem, 
 i.e. created only once. This means that creation happens conceptually 
 “before the first actor is started”, it is merely retrieved when needed 
 (and optimized to be only created at the first appearance of need). This in 
 turn means that arguments to its constructor must come from the ActorSystem 
 itself, hence from configuration as you also figured out. You can use 
 system.dynamicAccess in order to reflectively create your factory from a 
 fully qualified class name.

 Regards,

 Roland



 On Fri, May 9, 2014 at 6:14 PM, Olger Warnier ol...@spectare.nljavascript:
  wrote:

 Hi All, 

 I try to create an extension that needs a parameter in order todo it's 
 job. 

 extensions are created like:

 override def createExtension(system: ExtendedActorSystem) = {
 new MyExtension(system)
   }

 And I'd like have something like 'new MyExtension(system, 
 myCustomParameter: AType)'
 The custom parameter is actually a kind of Actor Factory that will create 
 specific handling actors for use with this specific instance of the actor 
 system 
 and should be passed someway into the extensions when it's created 

 Now, it's possible to have this type in the conf file, and construct from 
 there, but I was wondering if this is possible via the code. 

 Kind regards, 

 Olger




  -- 
  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 akka-user+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Akka Team
 Typesafe - The software stack for applications that scale
 Blog: letitcrash.com
 Twitter: @akkateam
  

-- 
  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.