2017-06-01 22 views
0

我有凸輪進程問題,看起來像this。 此過程在步驟SetId和CreateObjectsForId(都是JavaDelegates)中以非確定性方式無休止地循環。Camunda/Activiti進程在JavaDelegate的環境中循環

我正在使用camunda 7.5。

我有一些BaseJavaDelegate實現這樣的:從例如執行

@Override 
public void execute(DelegateExecution aExecution) throws Exception 
{ 
    logBefore(aExecution); 
    try 
    { 
     executeInTry(aExecution); 
    } 
    catch(Throwable aEx) 
    { 
     aEx.printStackTrace(); 
     throw new BpmnError("GENERIC_ERROR_CODE", aEx.getMessage()); 
    } 
    logAfter(aExecution); 
} 

登錄:

01.06.2017 15:32:53,902;pool-6-thread-2:...wf.base.BaseJavaDelegate;callExecuteInTry;DEBUG; 
Starting task: 
    ProcessDefinitionId: ...Process1:1:1 
    ProcessInstanceId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ExecutionId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ActivityId: SetId 
    TransactionId: null 
... 
01.06.2017 15:32:54,664;pool-6-thread-2:...wf.base.BaseJavaDelegate;callExecuteInTry;DEBUG; 
Ended task: 
    ProcessDefinitionId: ...Process1:1:1 
    ProcessInstanceId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ExecutionId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ActivityId: SetId 
    TransactionId: null 
... 
Starting task: 
    ProcessDefinitionId: ...Process1:1:1 
    ProcessInstanceId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ExecutionId: d161958b-46ce-11e7-8483-005056b37c6b 
    ActivityId: CreateObjectsForId 
    TransactionId: null 
... 
01.06.2017 15:37:53,886;pool-6-thread-3:...wf.base.BaseJavaDelegate;callExecuteInTry;DEBUG; 
Starting task: 
    ProcessDefinitionId: ...Process1:1:1 
    ProcessInstanceId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ExecutionId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ActivityId: SetId 
    TransactionId: null 
... 
01.06.2017 15:37:53,893;pool-6-thread-3:...wf.base.BaseJavaDelegate;callExecuteInTry;DEBUG; 
Ended task: 
    ProcessDefinitionId: ...Process1:1:1 
    ProcessInstanceId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ExecutionId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ActivityId: SetId 
    TransactionId: null 
... 
Starting task: 
    ProcessDefinitionId: ...Process1:1:1 
    ProcessInstanceId: ae2ecf43-46ce-11e7-8483-005056b37c6b 
    ExecutionId: d161958b-46ce-11e7-8483-005056b37c6b 
    ActivityId: CreateObjectsForId 
    TransactionId: null 

從日誌可以看出,SETID開始第二時間,同時CreateObjectsForId永遠不會結束。 執行過程中不會引發異常。 前面的步驟都是在同一個線程中執行的,但是當循環開始時,進程開始使用另一個線程/兩個線程。

我試圖繞過這個問題,設計過程像this。 這次SetId步驟的實現知道它是第二次進入,並且專用門進程應該更進一步。

不幸的是,這個過程仍然循環!我的代碼沒有例外。沒有OptimisticLockException。 Camunda沒有任何其他例外。 我不知道還有什麼可以導致過程循環像這樣。

+0

請添加Camunda版本和整個BPMN XML您的過程。 – thorben

回答

0

也許我錯過了一些東西,但它看起來像你在這裏遞歸的代碼。 您的委託執行,然後執行並在executeInTry()中再次執行....清洗並重復。

我錯過了什麼嗎? Greg

+0

這個BaseJavaDelegate是一個抽象類。唯一的辦法就是用try/catch來包裝執行器的執行,以便捕捉所有東西(並將它重新拋出爲BPMError)。我的SetId和CreateObjectsForId正在實現BaseJavaDelegate。 Camunda調用execute方法,此方法調用executeInTry - 我的JavaDelegates的真正實現。 – Krzysztof

0

我找到了解決我的問題的方法。 我一直在運行嵌入式camunda引擎。

有一次,我決定嘗試在應用程序服務器上運行相同的代碼(在我的情況下是wildfly)。現在我在日誌中收到了明確的消息,說明我們的交易時間太長。 Here你可以找到這個問題的解決方案(交易超時和工作執行者lockTimeInMillis)