I have done something like this:
| import org.jbpm.api.ProcessEngine;
| import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
| import org.springframework.beans.factory.annotation.Required;
| import org.springframework.context.ApplicationEvent;
| import org.springframework.context.ApplicationListener;
| import org.springframework.context.event.ContextClosedEvent;
| import org.springframework.context.event.ContextRefreshedEvent;
|
|
| public class JbpmJobExecutorLoader implements ApplicationListener {
|
| private ProcessEngine processEngine;
|
| @Required
| public void setProcessEngine(ProcessEngine processEngine) {
| this.processEngine = processEngine;
| }
|
| public void onApplicationEvent(ApplicationEvent applicationEvent) {
| if (applicationEvent instanceof ContextRefreshedEvent) {
| JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
| if (!jobExecutor.isActive()) {
| jobExecutor.start();
| }
| } else if (applicationEvent instanceof ContextClosedEvent) {
| JobExecutor jobExecutor = processEngine.get(JobExecutor.class);
| jobExecutor.stop();
| }
| }
|
processEngine will be wired by Spring.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4259082#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...