[jboss-user] [JBoss jBPM] - Re: Solution: JBPM3 and Spring Integration

mr_magoo do-not-reply at jboss.com
Wed Aug 19 19:55:57 EDT 2009


Finally, the spring config to tie it all together which has hopefully survived sanitation intact. :) You will not the class names of the above classes have been fudged to protect the innocent.


Notes:
I also do not claim this is the perfect solution. There are probably further optimisations that could be made to reduce the size/complexity. 

We create our own object factory and define various properties in spring.

The default jbpm context has the services injected manually to catch code that ignores the object factory. They are all named THE SAME as they would be in the jbpm config file. This is so our custom object factory will pick them up. You could rename them and put them into the objectfactory's map also.


<?xml version="1.0" encoding="UTF-8"?>
  | <beans>
  | 	<bean id="jbpmConfiguration" class="JbpmConfigurationFactoryBeanImpl">
  | 		<property name="transactionTemplate" ref="transactionTemplate" />
  | 		<property name="sessionFactory" ref="jBPMSessionFactory" />
  | 		<property name="startJobExecutor" value="true" />
  | 		<property name="objectFactory" ref="springJbpmObjectFactory" />
  | 		<property name="processDefinitionsResources">
  | 			<list>
  | 				<value>classpath:where is my xml???</value>
  | 			</list>
  | 		</property>
  | 	</bean>
  | 	<bean id="springJbpmObjectFactory" class="SpringObjectFactory">
  | 		<property name="jbpmProperties">
  | 			<map>
  | 				<entry key="jbpm.hide.stale.object.exceptions">
  | 					<bean class="java.lang.Boolean"><constructor-arg value="true" /></bean>
  | 				</entry>
  | 				<entry key="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
  | 				<entry key="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
  | 				<entry key="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
  | 				<entry key="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
  | 				<entry key="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
  | 				<entry key="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
  | 				<entry key="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
  | 				<entry key="resource.mail.templates" value="jbpm.mail.templates.xml" />
  | 				<entry key="jbpm.mail.smtp.host" value="localhost" />
  | 				<entry key="jbpm.mail.from.address" value="jbpm at noreply" />
  | 				<entry key="jbpm.byte.block.size">
  |                     <bean class="java.lang.Integer"><constructor-arg value="1024" /></bean>
  |                 </entry>
  |                 <entry key="jbpm.mail.address.resolver">
  |                     <bean class="org.jbpm.identity.mail.IdentityAddressResolver"></bean>
  |                 </entry>
  |                 <entry key="jbpm.variable.resolver">
  |                     <bean class="org.jbpm.jpdl.el.impl.JbpmVariableResolver"></bean>
  |                 </entry>
  |                 <entry key="jbpm.task.instance.factory">
  |                     <bean class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl"></bean>
  |                 </entry>
  | 		   </map>
  | 		</property>
  | 	</bean>
  | 	<bean id="default.jbpm.context" class="org.jbpm.JbpmContext" scope="prototype">
  | 		<constructor-arg>
  | 			<bean class="org.jbpm.svc.Services">
  | 				<constructor-arg>
  | 					<map>
  | 						<entry key="message" value-ref="message" />
  | 						<entry key="authentication" value-ref="authentication" />
  | 						<entry key="scheduler" value-ref="scheduler" />
  | 						<entry key="tx" value-ref="tx" />
  | 						<entry key="persistence" value-ref="persistence" />
  | 					</map>
  | 				</constructor-arg>
  | 			</bean>
  | 		</constructor-arg>
  | 		<constructor-arg ref="springJbpmObjectFactory" />
  | 	</bean>
  | 	<bean id="jbpmCommandService" class="org.jbpm.command.impl.CommandServiceImpl">
  | 		<constructor-arg ref="jbpmConfiguration" />
  | 	</bean>
  | 	<bean id="jbpm.job.executor" class="SpringJobExecutor">
  | 		<property name="transactionTemplate" ref="transactionTemplate" />
  | 		<property name="jbpmConfiguration" ref="jbpmConfiguration" />
  | 		<property name="name" value="SpringJbpmJobExecutor" />
  | 		<property name="nbrOfThreads" value="40" />
  | 		<property name="idleInterval" value="5000" />
  | 		<property name="maxIdleInterval" value="1700000" />
  | 		<property name="historyMaxSize" value="20" />
  | 		<property name="maxLockTime" value="300000" />
  | 		<property name="lockMonitorInterval" value="60000" />
  | 		<property name="lockBufferTime" value="5000" />
  | 	</bean>
  | 	<!-- services -->
  | 	<bean id="persistence" class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
  | 		<property name="sessionFactory" ref="jBPMSessionFactory" />
  | 		<property name="transactionEnabled" value="false" />
  | 		<property name="currentSessionEnabled" value="true" />
  | 	</bean>
  | 	<bean id="authentication" class="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
  |     <bean id="message" class="org.jbpm.msg.db.DbMessageServiceFactory" />
  | 	<bean name="tx" class="org.jbpm.tx.TxServiceFactory" />
  | 	<bean name="scheduler" class="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
  | </beans>

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250517#4250517

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250517



More information about the jboss-user mailing list