gpt4 book ai didi

camunda - 异步启动进程

转载 作者:行者123 更新时间:2023-12-05 01:19:12 27 4
gpt4 key购买 nike

我想确保每个 Camunda 流程实例都异步启动,而不管流程定义如何。 Configure Asynchronous Continuations文档表明此行为需要使用“Asynchronous Before”属性标记每个开始事件:

Asynchronous instantiation of a process instance is enabled using the camunda:asyncBefore extension attribute on a process-level start event. On instantiation, the process instance will be created and persisted in the database, but execution will be deferred.



有没有办法使用 org.camunda.bpm.engine.RuntimeService 实现相同的目标?或其他 Java 代码而不将“Asynchronous Before”属性应用于每个流程定义中的每个启动事件?
RuntimeService公开异步方法,但仅用于删除操作,例如有 deleteProcessInstancesAsync()但没有 startProcessInstanceById**Async**()方法。

最佳答案

根据 thorben's评论一个可以实现自定义 BpmnParseListenerparseStartEvent()方法。

public class AsyncBeforeStartListener extends AbstractBpmnParseListener {

@Override
public void parseStartEvent(Element startEventElement, ScopeImpl scope,
ActivityImpl startEventActivity) {
startEventActivity.setAsyncBefore(true);
}

}

关于camunda - 异步启动进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51140969/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com