Hi,

On 15 May 2014 at 20:26:49, MV ([email protected]) wrote:

Hello,

I am trying to use DI with Spring and Akka actors. I found the template example 
at TypesafeActivator but I had question for a case that is not working for me.
The example uses AnnotationBased DI and I would like to use XMl based for the 
following reason:

I have two algorithm implementations for my project which project my results to 
the end user in different formats. The algorithms are also significantly 
different and I have a single JAVA interface that these 2 algorithms implement.
I don't prefer the annotation based binding because I want the tester during 
integration testing to change the algorithm we use in an XML file or property 
file because if the chnage is done in a JAVA file, it warrants a new release of 
software version at the Integration test site. I want the tester to be able to 
run the jar with different algorithms based on an external XML/ java properties 
file.

Qn 1) The example on the website to create the actor system and Props uses Java 
annotation technique. How do I convert that to a regular <bean>....</bean> kind 
of thing?


If you don't want to convert everything, then you can mix annotations and XML 
by adding this to your spring context before you call refresh().

XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
xmlReader.loadBeanDefinitions("spring.xml");

If you do want to convert everything, then I guess you would just have to wire 
the things up by hand in the same way that they are wired by the annotations.

Qn 2) I want to create a few actors as simple UntypedActors and few Actors as 
ConsistentHashingRouter where the number of workers comes from a Java 
Properties file. Is this as simple as having another props() method? How can I 
translate this props() method to an XML format so that I can make it follow the 
way I want to in Qn (1). As of now, I do not want a mix of dependency injection 
techniques and would like to stick to one format.


So the props method doesn't care how you wired up your beans, it only looks up 
a named bean. Configuration of akka is usually done in code or in the 
application.conf file described in the documentation. If you would want full 
control of that from Spring, then you would probably have to add another props 
method, that looks up some named configuration bean that tells you which router 
add with which router configuration.

B/

Any help will be really appreciated because I am a novice to Spring DI with 
Akka actors.

Thanks in advance,
Meena Venkat
--
>>>>>>>>>> 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.
-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

JOIN US. REGISTER TODAY!
Scala
Days
June 16th-18th,
Berlin

-- 
>>>>>>>>>>      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.

Reply via email to