[jboss-user] [JBoss jBPM] - Re: Job Executor and Spring
oravecz
do-not-reply at jboss.com
Thu Oct 9 22:35:24 EDT 2008
I haven't yet got timers working for me so take that code with a grain of salt. Also note that I use the LocalJbpmConfigurationFactoryBean in my spring config, so I don't want to declare the same config twice. For this reason my spring.xml file looks like this:
| <bean id="jbpmConfig" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"
| p:sessionFactory-ref="sessionFactory"
| p:configuration="classpath:org/jbpm/default.jbpm.cfg.xml"
| >
| <property name="processDefinitionsResources">
| <list>
| <value>classpath:workflow/**/processdefinition.xml</value>
| </list>
| </property>
|
| </bean>
|
| <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
| <constructor-arg index="0" ref="jbpmConfig"/>
| </bean>
|
| <bean class="md.signmeup.workflow.jbpm.JobExecutorInitializingBean"
| p:jbpmConfiguration-ref="jbpmConfig" />
|
and I had a problem in my code. This overcomes it:
| import org.jbpm.JbpmConfiguration;
| import org.jbpm.job.executor.JobExecutor;
| import org.slf4j.Logger;
| import org.slf4j.LoggerFactory;
| import org.springframework.beans.factory.DisposableBean;
| import org.springframework.beans.factory.InitializingBean;
| import org.springframework.beans.factory.annotation.Required;
|
| /**
| *
| */
| public class JobExecutorInitializingBean implements InitializingBean, DisposableBean {
|
| // Statics -----------------------------------------------------------------
|
| private static final Logger LOG = LoggerFactory.getLogger(JobExecutorInitializingBean.class);
|
| // Instances ---------------------------------------------------------------
|
| private JbpmConfiguration _jbpmConfiguration;
|
| public void afterPropertiesSet() throws Exception {
| JobExecutor jobExecutor = _jbpmConfiguration.getJobExecutor();
| if (jobExecutor != null) {
| jobExecutor.setJbpmConfiguration(_jbpmConfiguration);
| jobExecutor.start();
| } else {
| if (LOG.isWarnEnabled())
| LOG.warn("No JobExecutor was found in the jBPM configuration.");
| }
| }
|
|
| public void destroy() throws Exception {
| JobExecutor jobExecutor = _jbpmConfiguration.getJobExecutor();
| if (jobExecutor != null) jobExecutor.stop();
| }
|
| @Required
| public void setJbpmConfiguration(final JbpmConfiguration jbpmConfiguration) {
| _jbpmConfiguration = jbpmConfiguration;
| }
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181361#4181361
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181361
More information about the jboss-user
mailing list