我正在從Activiti版本5.21遷移到6.0.0。除了預期的變化(有些意外),我在執行異步郵件任務時遇到了一個有趣的問題。 Mail任務按預期發送消息,並且不會引發錯誤,但儘管操作成功,但仍會顯示失敗流的重試。經過3次嘗試(併發送3封電子郵件)後,作業移至死信表格,就像發生錯誤一樣。在表中的錯誤信息是異步郵件任務Activiti 5.21到6.0.0遷移問題
什麼奇怪的是,沒有從Activiti的引發的錯誤「JobEntity [ID = SOME ID]被同時其它事務更新」。我將日誌級別設置爲追蹤,沒有任何事情看起來與衆不同。
根據用戶指南(https://www.activiti.org/userguide/#failRetry),如果出現問題,我會希望嘗試重試操作,但在這種情況下,沒有任何操作失敗並且郵件已正確發送。
如果我將Process config AsyncExecutorNumberOfRetries屬性設置爲零(configurationImpl.setAsyncExecutorNumberOfRetries(0);),我可以避免此錯誤,但這看起來不像我應該做的事情。
ProcessEngineConfigurationImpl中asyncExecutorNumberOfRetries屬性的默認值是3,這樣可以解釋3次嘗試,但我想知道爲什麼引擎不捕獲成功的郵件事件並將其視爲失敗。
這是我的bpmn模型代碼:它只是一個簡單的開始/結束事件,帶有電子郵件和臨時任務。
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:activity="http://activiti.org/bpmn" xmlns:klover="http://klover.io/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="MigrationTest3" name="Migration Test 3" isExecutable="true" klover:category="tenant1|Incident:TaskCategoryType">
<bpmn:documentation>test 3</bpmn:documentation>
<bpmn:startEvent id="StartEvent_1" name="Start Event" activity:initiator="initiator">
<bpmn:documentation>This element denotes the start of the process instance</bpmn:documentation>
<bpmn:outgoing>SequenceFlow_0xdrrlx</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="ServiceTask_0p317lq" name="MIgration Test 3" activity:async="true" activity:type="mail">
<bpmn:documentation>This element denotes the service to send email</bpmn:documentation>
<bpmn:extensionElements>
<activity:field name="from">
<activity:expression></activity:expression>
</activity:field>
<activity:field name="to">
<activity:expression>[email protected]</activity:expression>
</activity:field>
<activity:field name="subject">
<activity:expression>Test Migration 3</activity:expression>
</activity:field>
<activity:field name="text">
<activity:expression>testing re-enabling async mail task - did this send 3 times?</activity:expression>
</activity:field>
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0xdrrlx</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0wboybt</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="EndEvent_11vu7d5" name="Undefined End Event">
<bpmn:documentation>This element denotes the end of the process instance</bpmn:documentation>
<bpmn:incoming>SequenceFlow_17ff3nr</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_0xdrrlx" sourceRef="StartEvent_1" targetRef="ServiceTask_0p317lq" />
<bpmn:sequenceFlow id="SequenceFlow_0wboybt" sourceRef="ServiceTask_0p317lq" targetRef="UserTask_1sghk67" />
<bpmn:userTask id="UserTask_1sghk67" name="Testing Adhoc task after email" activity:assignee="tenant1|718abdcf-e192-11e5-b7f0-9f235e785c94" activity:priority="0" klover:formType="Adhoc">
<bpmn:documentation>Testing the new execution id change</bpmn:documentation>
<bpmn:incoming>SequenceFlow_0wboybt</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_17ff3nr</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="SequenceFlow_17ff3nr" sourceRef="UserTask_1sghk67" targetRef="EndEvent_11vu7d5" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="MigrationTest3">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="44" y="84" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="34" y="120" width="55" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0p317lq_di" bpmnElement="ServiceTask_0p317lq">
<dc:Bounds x="285" y="128" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_11vu7d5_di" bpmnElement="EndEvent_11vu7d5">
<dc:Bounds x="663" y="281" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="644" y="317" width="74" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0xdrrlx_di" bpmnElement="SequenceFlow_0xdrrlx">
<di:waypoint xsi:type="dc:Point" x="80" y="102" />
<di:waypoint xsi:type="dc:Point" x="183" y="102" />
<di:waypoint xsi:type="dc:Point" x="183" y="168" />
<di:waypoint xsi:type="dc:Point" x="285" y="168" />
<bpmndi:BPMNLabel>
<dc:Bounds x="198" y="125" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0wboybt_di" bpmnElement="SequenceFlow_0wboybt">
<di:waypoint xsi:type="dc:Point" x="385" y="168" />
<di:waypoint xsi:type="dc:Point" x="452" y="168" />
<di:waypoint xsi:type="dc:Point" x="452" y="207" />
<di:waypoint xsi:type="dc:Point" x="453" y="259" />
<bpmndi:BPMNLabel>
<dc:Bounds x="467" y="187.5" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="UserTask_1sghk67_di" bpmnElement="UserTask_1sghk67">
<dc:Bounds x="403" y="259" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_17ff3nr_di" bpmnElement="SequenceFlow_17ff3nr">
<di:waypoint xsi:type="dc:Point" x="503" y="299" />
<di:waypoint xsi:type="dc:Point" x="581" y="299" />
<di:waypoint xsi:type="dc:Point" x="581" y="299" />
<di:waypoint xsi:type="dc:Point" x="663" y="299" />
<bpmndi:BPMNLabel>
<dc:Bounds x="596" y="299" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
任何建議將不勝感激!
誤差在工作完成後comitting交易。這是已知的活動引擎行爲 - 您必須回滾工作或使其可以多次執行。您可以在具有多個執行器和任務的高負載環境中遇到類似的事情。在這種情況下,您可以使用獨佔作業(在下一節8.7.3的用戶指南中介紹),以便在執行異步作業之前鎖定進程的大多數場景。 –