我们遇到了几个在达到流程结束事件后执行serviceTasks的情况。
ACT_HI_ACTINST
表中的一个示例如下(手动添加行号列“L#”):
SELECT
EXECUTION_ID_,
PROC_INST_ID_,
ACT_ID_,
ACT_TYPE_,
START_TIME_,
END_TIME_
FROM ACT_HI_ACTINST
WHERE PROC_INST_ID_ =
'9841ea77-cee8-11e6-b457-005056aa6e09'
ORDER BY
START_TIME_;
EXECUTION_ID_ PROC_INST_ID_ L# ACT_ID_ ACT_TYPE_ START_TIME_ END_TIME_
==================================== ==================================== === ============================ ======================== =================== ===================
9841ea77-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 1. startevent1 startEvent 2016-12-31 00:35:06 2016-12-31 00:35:06
9841ea77-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 2. lockOrder serviceTask 2016-12-31 00:35:06 2016-12-31 00:35:06
9841ea77-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 3. processingOrderStatus serviceTask 2016-12-31 00:35:06 2016-12-31 00:35:06
989cb4b1-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 4. subprocess1 subProcess 2016-12-31 00:35:06 2016-12-31 00:37:18
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 5. startevent2 startEvent 2016-12-31 00:35:06 2016-12-31 00:35:06
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 6. prepareContractContext serviceTask 2016-12-31 00:35:07 2016-12-31 00:35:07
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 7. processingContractStatus serviceTask 2016-12-31 00:35:08 2016-12-31 00:35:09
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 8. createSsoAccount serviceTask 2016-12-31 00:35:09 2016-12-31 00:35:09
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 9. exclusivegateway1 exclusiveGateway 2016-12-31 00:35:09 2016-12-31 00:35:09
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 10. exclusivegateway2 exclusiveGateway 2016-12-31 00:35:09 2016-12-31 00:35:09
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 11. modifyParty serviceTask 2016-12-31 00:35:10 2016-12-31 00:35:26
a44b1fb0-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 12. timerintermediatecatchevent1 intermediateTimer 2016-12-31 00:35:26 2016-12-31 00:37:30
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 13. createNotification serviceTask 2016-12-31 00:37:17 2016-12-31 00:37:17
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 14. closedContractStatus serviceTask 2016-12-31 00:37:18 2016-12-31 00:37:18
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 15. endevent1 endEvent 2016-12-31 00:37:18 2016-12-31 00:37:18
9841ea77-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 16. registerClosedOrderEvent serviceTask 2016-12-31 00:37:19 2016-12-31 00:37:19
9841ea77-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 17. closedOrderStatus serviceTask 2016-12-31 00:37:19 2016-12-31 00:37:19
9841ea77-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 18. endevent2 endEvent 2016-12-31 00:37:19 2016-12-31 00:37:19
989e8977-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 19. modifyService serviceTask 2016-12-31 00:37:30 2016-12-31 00:37:31
eeec32ad-cee8-11e6-b457-005056aa6e09 9841ea77-cee8-11e6-b457-005056aa6e09 20. waitingForModifyService intermediateMessageCatch 2016-12-31 00:37:31 2016-12-31 00:37:17
现在endEvent2
(第18行)是一个流程结束事件,在完成后会执行另一个任务(这个modifyService
(第19行)任务应该在timerintermediatecatchevent1
之后执行(行12)并且在大多数情况下是)。
我们仅将Activiti用作Spring应用程序的处理引擎。有5个应用程序实例连接到同一个DB。
什么可能导致这种行为?我们经常观察它,这对我们的业务流程非常危险。作为提示 - 无序任务在不同的机器上执行。
我们还调整了异步执行程序引擎的设置 - 代码段及其设置如下:
asyncExecutor.setDefaultAsyncJobAcquireWaitTimeInMillis(1000);
asyncExecutor.setDefaultTimerJobAcquireWaitTimeInMillis(5 * 1000);
asyncExecutor.setMaxAsyncJobsDuePerAcquisition(10);
asyncExecutor.setMaxTimerJobsPerAcquisition(10);
asyncExecutor.setAsyncJobLockTimeInMillis(10 * 60 * 1000);
asyncExecutor.setTimerLockTimeInMillis(10 * 60 * 1000);
Activiti版本:5.20.0
任何形式的帮助或暗示都会非常感激。