当前位置: 首页 > 知识库问答 >
问题:

Activiti 5.21到6.0.0在异步邮件任务中的迁移问题

巫马修然
2023-03-14

我正在从Activiti Version5.21迁移到6.0.0。除了预期的更改(一些意外的更改)之外,我在执行异步邮件任务时遇到了一个有趣的问题。邮件任务按预期发送消息,并且没有引发错误,但是尽管操作成功,但仍然遵循了重试失败流。在3次尝试(发送了3封电子邮件)之后,作业会移动到死信表,就好像发生了错误一样。表中的错误消息为

“JobEntity[ID=某个ID]被另一个事务同时更新”

奇怪的是Activiti没有抛出错误。我已经将日志级别设置为跟踪,没有什么异常

根据用户指南(https://www.activiti.org/userguide/#failretry),我希望在失败时尝试重试操作,但在本例中,没有任何失败,邮件也正确发送。

    <?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>me@test.org</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>

任何建议都将不胜感激!

共有1个答案

范浩荡
2023-03-14

原来这里的问题是,在我们的开发环境中,当每个开发人员都在开发应用程序时,我们启动了流程引擎的多个实例。因为我是当时唯一一个工作的人,最初我不认为这是问题。原来我们有一个旧的应用服务器在运行引擎。随后,它在AWS上运行在与我的本地实例不同的时区。这就是导致感知失败的原因,因为在这个AWS实例上锁定时间是UTC,而我是在本地MST上运行的。

在设置包含的本地环境后,我的异步邮件任务按预期执行...1次

 类似资料:
  • 我需要选择一个日志框架来替换log4j。我最初选择slf4j logback作为日志记录,并编写了以下配置,将应用程序日志和apache cxf的日志输出到单独的文件中,并在控制台上输出Spring/hibernate日志: 然而,我开始了解log4j2中的异步日志记录,我想在我的设置中使用log4j2实现异步日志记录,为此我编写了以下配置: log4j2配置可以工作,但它只在文件(app_log

  • 问题内容: 我正在Flask中编写一个应用程序,除了同步和阻塞之外,它的运行情况非常好。我特别有一项任务,该任务调出第三方API,该任务可能需要几分钟才能完成。我想拨打该电话(实际上是一系列电话)并使其运行。同时控制权返回给Flask。 我的看法如下: 现在,我要做的就是 运行并提供在方法返回时要执行的回调,而Flask可以继续处理请求。这是我需要Flask异步运行的唯一任务,并且我想就如何最好地

  • 我试图在这个类中实现异步任务,但问题是我在我的程序中调用了函数,该函数返回一个值,我不知道该把它放在哪里。在异步任务中,我应该在哪里定义?我得到以下例外 以下是我的主要课程: 这是我的解析类:公共类解析{ List headlines列出链接;列表描述;列出lstDate列出新日期;//字符串a,b,c,d;public InputStream getInputStream(URL URL){ t

  • stop-task 命令用于停止数据迁移任务。有关 stop-task 与 pause-task 的区别,请参考暂停数据迁移任务中的相关说明。 help stop-task stop a specified task Usage: dmctl stop-task [-s source ...] <task-name | task-file> [flags] Flags: -h, --hel

  • resume-task 命令用于恢复处于 Paused 状态的数据迁移任务,通常用于在人为处理完造成迁移任务暂停的故障后手动恢复迁移任务。 help resume-task resume a specified paused task Usage: dmctl resume-task [-s source ...] <task-name | task-file> [flags] Flags:

  • pause-task 命令用于暂停数据迁移任务。 注意: 有关 pause-task 与 stop-task 的区别如下: 使用 pause-task 仅暂停迁移任务的执行,但仍然会在内存中保留任务的状态信息等,且可通过 query-status 进行查询;使用 stop-task 会停止迁移任务的执行,并移除内存中与该任务相关的信息,且不可再通过 query-status 进行查询,但不会移除已