Spring Beans as OSWorkflow Functions
Filed under: Flowfuse
Flowfuse now supports references to Spring beans in the workflow definition file. It leverages OSWorkflow’s new TypeResolver and Springmodules‘ support for it. This saves a lot of hazzle - until now one had to pass references to Spring beans through the input Map every time when executing a workflow action.
It was actually a little bit difficult to build Springmodules with TypeResolver support, b/c OSWorkflow 2.8 has not been released yet, and therefore the TypeResolver support is only available in the sandbox (more info here and here). However, now you can define your conditions, functions, and validators as Spring beans - and take advantage of all spring features, e.g. easier unit testing, AOP proxies, SOAP support.
Defining a Spring workflow function to access a web service is as easy as this:
<bean id="sendHolidayInfoToHrFunction"
class="org.flowfuse.holiday.services.workflow.functions.
SendHolidayInfoToHrFunction">
<property name="hrWebService">
<ref bean="hrWebService"/>
</property>
</bean>
<bean id="hrWebService"
class="org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean">
<property name="serviceInterface">
<value>my.company.RemoteHrService</value>
</property>
<property name="wsdlDocumentUrl">
<value>http://localhost:8080/hr/services/hrService?WSDL</value>
</property>
<property name="namespaceUri">
<value>http://localhost:8080/hr/services/hrService</value>
</property>
<property name="serviceName">
<value>HrService</value>
</property>
<property name="portName">
<value>HrPort</value>
</property>
</bean>
Then, in your workflow descriptor, you reference the function in your workflow file:
<function type="spring">
<arg name="bean.name">sendHolidayInfoToHrFunction</arg>
</function>
Too easy, mate!
Btw: Thanks to Costin for adding the TypeResolver support to the Springmodules sandbox!
Dec 9, 2005 at 23:25 | Permalink
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed