This content has been marked as final.
Show 1 reply
-
1. Re: Configure JobExecutor in Spring
jeffj55374 Sep 25, 2007 2:37 PM (in response to mckanth)Hi,
I wrote my own sub class of JobExecutor since the setter methods where missing. The code is below. The spring config is shown a the end.package org.jbpm.job.executor; import org.jbpm.JbpmConfiguration; /** Extend JobExecutor to provide setter methods so JobExecutor can be created by Spring * * @author jpjohnson * */ public class JbpmJobExecutor extends JobExecutor { private static final long serialVersionUID = 1L; /** Initialize this class and start the threads. Intended to be used via * Spring to begin execution of the threads. You may also want to specify * lazy-init="true" in the Spring config file and explicitly load the bean * in your startup sequence. */ public void init() { this.start(); } public void setJbpmConfiguration(JbpmConfiguration configuration) { jbpmConfiguration = configuration; } public void setName(String newName) { name = newName; } public void setNbrOfThreads(int value) { nbrOfThreads = value; } public void setIdleInterval(int value) { idleInterval = value; } public void setMaxIdleInterval(int value) { maxIdleInterval = value; } public void setHistoryMaxSize(int value) { historyMaxSize= value; } public void setMaxLockTime(int value) { maxLockTime = value; } public void setLockMonitorInterval(int value) { lockMonitorInterval = value; } public void setLockBufferTime(int value) { lockBufferTime= value; } }
Here's the relevant section from my spring config.<!-- jBPM configuration --> <bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"> <property name="sessionFactory" ref="sessionFactory"/> <!-- property name="objectFactory" ref="jbpmObjectFactory"/--> <property name="configuration" value="classpath:/org/jbpm/default.jbpm.cfg.xml"/> <property name="createSchema"><value>false</value></property> <!-- <property name="processDefinitions"> <list> <ref local="simpleWorkflow"/> </list> </property> <property name="createSchema" value="false"/> <property name="processDefinitionsResources"> <list> <value>classpath:/org/springmodules/workflow/jbpm31/someOtherWorkflow.xml</value> </list> </property> --> </bean> <bean id="jbpmObjectFactory" class="org.springmodules.workflow.jbpm31.JbpmObjectFactory"> </bean> <!-- JbpmJobExecutor is a DigitalRiver custom class to allow Spring to create JobExecutor --> <bean id="jbpm.job.executor" class="org.jbpm.job.executor.JbpmJobExecutor" lazy-init="true" init-method="init" destroy-method="stopAndJoin"> <property name="jbpmConfiguration" ref="jbpmConfiguration" /> <property name="name" value="JbpmJobExecutor"/> <property name="nbrOfThreads" value="3"/> <property name="idleInterval" value="5000"/> <property name="maxIdleInterval" value="300000"/> <property name="historyMaxSize" value="20"/> <property name="maxLockTime" value="2147483646"/> <!-- 10 minutes --> <property name="lockMonitorInterval" value="60000"/> <!-- 1 minute --> <property name="lockBufferTime" value="5000"/> <!-- 5 seconds --> </bean>