Camunda/Activiti 进程循环在 JavaDelegate 中是有的



我对像这样的camunda过程有问题。此过程以非确定性的方式无休止地以setID和createObjectsforid的步骤循环(均为Javadelegates(。

我正在使用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 );
}

log from示例执行:

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从未完成。在此执行期间,没有例外。同样,以前的步骤都在同一线程中执行,但是当循环开始使用另一个线程/两个线程时。

我试图通过设计这样的过程来绕过这个问题。SETID步骤的这段实现知道它是第二次输入的,并且使用独家门的过程应该进一步进行。

不幸的是,该过程仍然循环!我的代码没有例外。没有OpportisticLockexception。没有其他例外。我不知道还有什么会导致过程循环。

也许我错过了一些东西,但是看起来您在这里有递归代码。您的委托执行,然后执行执行并在ExecuteIntry((....冲洗并重复。

中再次执行。

我想念什么吗?格雷格

我找到了解决问题的方法。我一直在运行嵌入式的Camunda引擎。

一次,我决定尝试在Application Server上运行相同的代码(在我的情况下是Wildfly(。现在,我在日志中收到了明确的消息,即我花了太长时间的交易。在这里,您可以找到此问题的解决方案(Transactions Timeout和Jobs-Exector Locktimeinmillis(

最新更新