3

我有以下计时器实现:

<task-node name="recenze" create-tasks="false">
    <event type="node-enter" >
        <action expression="#{assignActors.assignActors(vybraniUzivatele,'recenze')}"></action>
    </event>

    <timer name="trolololo" duedate="5 business seconds" transition="transitionToVyporadaniPripominek" />

    <task name="recenze" description="A003: Ustanovení recenzentů" />

    <transition name="transitionToVyporadaniPripominek" to="vyporadaniPripominek" />
</task-node>

我试图找到问题所在,但我失败了。根据互联网上的许多来源,计时器声明似乎是正确的。在jbpm_jobjBPM 表中,我的计时器启动了一项作业,其所有信息均已正确设置。但定时器不触发。

有谁知道这里的问题可能出在哪里?非常感谢....

4

4 回答 4

1

将突出显示的 create-task 标志从 false 更改为 true,它将起作用。

于 2015-12-31T11:32:12.827 回答
0

我正在粘贴我用来理解 JBPM 中计时器概念的 BPMN 文件的代码,希望它对您有所帮助。

    <?xml version="1.0" encoding="UTF-8"?>
             <definitions id="Definition"
             targetNamespace="http://www.example.org/MinimalExample"
             typeLanguage="http://www.java.com/javaTypes"
             expressionLanguage="http://www.mvel.org/2.0"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
             xmlns:g="http://www.jboss.org/drools/flow/gpd"
             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
             xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
             xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
             xmlns:tns="http://www.jboss.org/drools">




 <process processType="Private" isExecutable="true" id="TimerBoundaryEventTest"                                                                                                                                                                                                    name="Timer Boundary Event Test" tns:packageName="defaultPackage" >



         <!-- nodes -->
        <startEvent id="_1" name="StartProcess" />
        <subProcess id="_2" name="SubProcess"  >
        <!-- nodes -->
        <startEvent id="_2-1" name="StartSubProcess" />
        <endEvent id="_2-3" name="EscalationEvent" />
        <scriptTask id="_2-4" name="Script" scriptFormat="http://www.java.com/java" >
          <script>System.out.println("In Script Task");
           Thread.sleep(6000);
            System.out.println("In Script Task After Sleep");
            Thread.sleep(2000);</script>
        </scriptTask>
        <!-- connections -->
        <sequenceFlow id="_2-4-_2-3" sourceRef="_2-4" targetRef="_2-3" />
        <sequenceFlow id="_2-1-_2-4" sourceRef="_2-1" targetRef="_2-4" />
        </subProcess>
        <endEvent id="_3" name="EndProcess" >
            <terminateEventDefinition/>
        </endEvent>
        <boundaryEvent id="_4" name="TimerEvent" attachedToRef="_2" >
          <timerEventDefinition>
            <timeDuration xsi:type="tFormalExpression">500ms</timeDuration>
          </timerEventDefinition>
        </boundaryEvent>
        <scriptTask id="_5" name="Goodbye" >
          <script>System.out.println("Timer handled");</script>
        </scriptTask>
        <endEvent id="_6" name="EndProcess" >
            <terminateEventDefinition/>
        </endEvent>
        <intermediateCatchEvent id="_7" name="Timer" >
          <timerEventDefinition>
            <timeCycle xsi:type="tFormalExpression">2000###2000</timeCycle>
          </timerEventDefinition>
        </intermediateCatchEvent>

        <!-- connections -->
        <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
        <sequenceFlow id="_7-_3" sourceRef="_7" targetRef="_3" />
        <sequenceFlow id="_4-_5" sourceRef="_4" targetRef="_5" />
        <sequenceFlow id="_5-_6" sourceRef="_5" targetRef="_6" />
        <sequenceFlow id="_2-_7" sourceRef="_2" targetRef="_7" />

      </process>

      <bpmndi:BPMNDiagram>
        <bpmndi:BPMNPlane bpmnElement="TimerBoundaryEventTest" >
          <bpmndi:BPMNShape bpmnElement="_1" >
            <dc:Bounds x="16" y="85" width="48" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_2" >
            <dc:Bounds x="96" y="16" width="223" height="187" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_2-1" >
            <dc:Bounds x="115" y="62" width="48" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_2-3" >
            <dc:Bounds x="205" y="132" width="48" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_2-4" >
            <dc:Bounds x="190" y="63" width="80" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_3" >
            <dc:Bounds x="431" y="85" width="48" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_4" >
            <dc:Bounds x="16" y="235" width="48" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_5" >
            <dc:Bounds x="96" y="235" width="223" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_6" >
            <dc:Bounds x="351" y="235" width="48" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNShape bpmnElement="_7" >
            <dc:Bounds x="351" y="85" width="48" height="48" />
          </bpmndi:BPMNShape>
          <bpmndi:BPMNEdge bpmnElement="_2-4-_2-3" >
            <di:waypoint x="134" y="71" />
            <di:waypoint x="133" y="140" />
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_2-1-_2-4" >
            <di:waypoint x="43" y="70" />
            <di:waypoint x="134" y="71" />
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_1-_2" >
            <di:waypoint x="40" y="109" />
            <di:waypoint x="207" y="109" />
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_7-_3" >
            <di:waypoint x="375" y="109" />
            <di:waypoint x="455" y="109" />
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_4-_5" >
            <di:waypoint x="40" y="259" />
            <di:waypoint x="207" y="259" />
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_5-_6" >
            <di:waypoint x="207" y="259" />
            <di:waypoint x="375" y="259" />
          </bpmndi:BPMNEdge>
          <bpmndi:BPMNEdge bpmnElement="_2-_7" >
            <di:waypoint x="207" y="109" />
            <di:waypoint x="375" y="109" />
          </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
      </bpmndi:BPMNDiagram>

    </definitions>

一切顺利。

于 2013-02-07T05:58:13.390 回答
0

您是否使用每个流程实例的会话?如果是,那么每当安全点出现时,与该流程实例相关的所有数据都会与会话信息一起保存在 db 中,并且会话会从内存中清除。现在,您的计时器已与该会话一起安排,当您现在返回并恢复会话时,您必须再次将您的计时器链接到该会话以加载到内存中并安排为作业。

于 2013-05-27T09:40:40.067 回答
0

这是我声明计时器的方式,与之前的答案示例完全相同:

<boundaryEvent id="_ID" name="TimerEvent" attachedToRef="_ANOTHERID" >
      <timerEventDefinition>
        <timeCycle xsi:type="tFormalExpression">500ms</timeCycle>
      </timerEventDefinition>
</boundaryEvent>

不同之处在于我不使用线程或中间捕获事件......与给定进程相关联的边界事件足以触发计时器并导致等待状态。这已经过测试并且可以正常工作。

希望能帮助到你 :)

于 2013-06-05T11:15:37.330 回答