jBPM timer not executing/firing
dsalam May 29, 2010 12:37 PMI am using Eclipse v3 with jbpm 3.2.3
I have a timer in my process definition that should send an email once it fires.
It seems the timer never fires and I am not sure why.
- I included all services in jbpm-context
- my timers are being stored in the databse ( Ican see the tables populating)
- am I missing a class that schedules the timers to run (I thought that the scheduler service takes care of that)???
If I remove the timer from the state and keep the mail statement (to send mail), it WORKS ... so it seems my timer is not firing
** I have tried using event (with <create-timer>), state (with <timer>), a simple system.out but to no avail
Any insight would be appreciated
HERE's all the files I am using for this simple java application
PROCESS Definition code
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="TimerProcess/Tprocessdefinition.xml">
<start-state name="start">
<transition to="setTimer" name="trSetTimer"></transition>
</start-state>
<state name="setTimer">
<timer name="notification" transition="trEnd" duedate="5 seconds">
<action name="emailNotify" class="org.jbpm.mail.Mail">
<subject>
notify timer
</subject>
<text>
testing jbpm timer
</text>
<to>
</to>
</action>
</timer>
<transition name="trEnd" to="end"/>
</state>
<end-state name="end"></end-state>
</process-definition>
package com.sample;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
public class RunTimer {
public static void main(String args[])throws Exception {
new RunTimer().execute();
}
public void execute() throws Exception {
JbpmContext jbpmContext= JbpmConfiguration.getInstance().createJbpmContext();
try{
ProcessInstance instance = processDefinition.createProcessInstance();
jbpmContext.deployProcessDefinition(processDefinition);
displayStatus(instance);
instance.signal();
displayStatus(instance);
jbpmContext.save(instance);
}finally{
jbpmContext.close();
}
}
private void displayStatus(ProcessInstance instance) {
String nodeName = instance.getRootToken().getNode().getName();
System.out.println("You are now in node: "+nodeName);
}
}
and my jbpm cfg xml
<jbpm-configuration>
<jbpm-context>
<service name='persistence' factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />
<service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
<service name='message' factory='org.jbpm.msg.db.DbMessageServiceFactory' />
<service name='scheduler' factory='org.jbpm.scheduler.db.DbSchedulerServiceFactory' />
<service name='logging' factory='org.jbpm.logging.db.DbLoggingServiceFactory' />
<service name='authentication' factory='org.jbpm.security.authentication.DefaultAuthenticationServiceFactory' />
</jbpm-context>
<!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
<string name='resource.hibernate.cfg.xml' value='hibernate.cfg.xml' />
<!-- <string name='resource.hibernate.properties' value='hibernate.properties' /> -->
<string name='resource.business.calendar' value='org/jbpm/calendar/jbpm.business.calendar.properties' />
<string name='resource.default.modules' value='org/jbpm/graph/def/jbpm.default.modules.properties' />
<string name='resource.converter' value='org/jbpm/db/hibernate/jbpm.converter.properties' />
<string name='resource.action.types' value='org/jbpm/graph/action/action.types.xml' />
<string name='resource.node.types' value='org/jbpm/graph/node/node.types.xml' />
<string name='resource.parsers' value='org/jbpm/jpdl/par/jbpm.parsers.xml' />
<string name='resource.varmapping' value='org/jbpm/context/exe/jbpm.varmapping.xml' />
<string name="resource.mail.templates" value="jbpm.mail.templates.xml" />
<string name="jbpm.mail.smtp.host" value="smt4.rogers.com"/>
<int name='jbpm.byte.block.size' value="1024" singleton="true" />
<bean name='jbpm.task.instance.factory' class='org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl' singleton='true' />
<bean name='jbpm.variable.resolver' class='org.jbpm.jpdl.el.impl.JbpmVariableResolver' singleton='true' />
<bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
<bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor" singleton="true"/>
</jbpm-configuration>