I'm trying to setup a simple workflow that causes one of the API's on a bean be invoked at 3:30, 4:30 and 5:30pm.I'm using the code below but what I'm seeign happen is that when the code runtimeService.startProcessInstanceByKey() is invoked, the process runs immediately as I see that mySerivce.process() is being invoked. I do not want it to be invoked immediately but rather only on the scheduled timeCycle.Any suggestions?Thanks,Sanjiv
Deployment deployment = repositoryService.createDeployment()
.addClasspathResource("bpmn/my-timer.bpmn20.xml")
.deploy();
Map<String, Object> variableMap = new HashMap<String, Object>();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcessTimer", variableMap);
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
targetNamespace="http://www.bpmnwithactiviti.org"
xmlns:activiti="http://activiti.org/bpmn">
<process id="myProcessTimer" name="Scheduled Process">
<startEvent id="timerstartevent1">
<timerEventDefinition>
<!–run at 3:30, 4:30 and 5:30 every weekday–>
<timeCycle>0 30 15,16,17 ? * MON-FRI</timeCycle>
</timerEventDefinition>
</startEvent>
<sequenceFlow id="flow1" sourceRef="timerstartevent1" targetRef="processVariationMargin"></sequenceFlow>
<serviceTask id="processVariationMargin"
activiti:expression="#{mySerivce.process()}"/>
</process>
</definitions>