We started developing our first agents (performers) using Fey, and we found
our first “problem”. There is no integration of Fey and Spring.  Or at
least, we did not understand how to integrate Fey with Spring.

We want to instantiate our agents in Spring to enjoy all of its benefits
(e.g. dependency injection, object management, easy transaction
configuration and so forth). Therefore, instead of telling Fey the
performer class to instantiate, we would have to tell Fey the source as the
application context name and the bean name; so Fey can retrieve the agent
(object) already instantiated by Spring.

This would have consequences on the performer constructor; we would need to
add another hook to configure an agent in Fey such as a post-constructor
method that would be intended to do the same as the constructor today. I
mean, we maintain everything we have so far, and we add only a default
constructor with no parameters and the post-constructor method that would
be hooked in Fey’s performer life-cycle.

Then, we would have to possibilities, first the one we already have to
instantiate an agent:

 "source": {

            "name": *"agentJarWithDependencies.jar"*,

            "classPath": *"org.awesomeCompany.agentOne"*,

            "parameters": {

            }

And an alternative for agent objects managed by Spring:

"source": {

            "name": *" agentJarWithDependencies.jar"*,

            "applicationContextName": *"agentOneApplicationContext.xml"*,

            "performerBeanName": *"agentOneApplicationContext.xml"*


This would require Fey to instantiate the Spring’s application context, and
then look the bean up there. The idea is that application context file can
be found in the classpath.



What do you guys think about this? We can work to create this integration
after we discussed the changes that would be applied to Fey.



-- 
Rafael Weingärtner

Reply via email to