05-23-2018 02:00 AM
Hi,
I am using activiti in my spring application and i would like to use timer start event for every minute. I designed the bpmn file and deployed. but it isn't working to trigger the business logic.
source code:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="timeEventProcess" name="My process" isExecutable="true">
<startEvent id="timerstartevent1" name="Timer start">
<timerEventDefinition>
<timeDuration>P1M</timeDuration>
</timerEventDefinition>
</startEvent>
<serviceTask id="servicetask1" name="Service Task" activiti:class="org.nipun.it.activiti.listener.TimeEventListener"></serviceTask>
<sequenceFlow id="flow1" sourceRef="timerstartevent1" targetRef="servicetask1"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="mailtask1"></sequenceFlow>
<serviceTask id="mailtask1" name="Mail Task" activiti:type="mail">
<extensionElements>
<activiti:field name="to">
<activiti:string><![CDATA[vamsikrishna.g@nipun.net]]></activiti:string>
</activiti:field>
<activiti:field name="from">
<activiti:string><![CDATA[support@nipun.net]]></activiti:string>
</activiti:field>
<activiti:field name="subject">
<activiti:string><![CDATA[Activiti: Testing Timer]]></activiti:string>
</activiti:field>
<activiti:field name="html">
<activiti:string><![CDATA[Testing]]></activiti:string>
</activiti:field>
</extensionElements>
</serviceTask>
<sequenceFlow id="flow3" sourceRef="mailtask1" targetRef="endevent1"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_timeEventProcess">
<bpmndi:BPMNPlane bpmnElement="timeEventProcess" id="BPMNPlane_timeEventProcess">
<bpmndi:BPMNShape bpmnElement="timerstartevent1" id="BPMNShape_timerstartevent1">
<omgdc:Bounds height="35.0" width="35.0" x="80.0" y="40.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
<omgdc:Bounds height="55.0" width="105.0" x="160.0" y="30.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="450.0" y="40.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="mailtask1" id="BPMNShape_mailtask1">
<omgdc:Bounds height="55.0" width="105.0" x="310.0" y="30.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="115.0" y="57.0"></omgdi:waypoint>
<omgdi:waypoint x="160.0" y="57.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="265.0" y="57.0"></omgdi:waypoint>
<omgdi:waypoint x="310.0" y="57.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="415.0" y="57.0"></omgdi:waypoint>
<omgdi:waypoint x="450.0" y="57.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
Please check and help me out of this.
Thanks
05-23-2018 09:12 AM
<timeDuration>P1M</timeDuration> this will run once every month. Try <timeDuration>PT1M</timeDuration> instead.
Check out ISO 8601 - Wikipedia for more info about durations.
05-24-2018 12:06 AM
PT1M means for for every minute right? But it is executed first time only. I would like to execute for every minute. Please tell me if you know about this.
05-24-2018 03:58 AM
What version of activiti are you using? As mentioned in Activiti User Guide timers are only fired when the job or async executor is enabled. Do you have them enabled?
Explore our Alfresco products with the links below. Use labels to filter content by product module.