简体   繁体   English

如何从 Camunda 的任何流程点跳转到事件?

[英]How to jump to the event from any process point in Camunda?

I have a BPMN process of a middle complexity with several tasks and gateways.我有一个中等复杂性的 BPMN 流程,其中包含多个任务和网关。 The BPMN engine works with Spring Boot. BPMN 引擎与 Spring Boot 配合使用。

Now, I have the following task: if I receive a request to my endpoint, I need to trigger a special process event, no matter on which step the process is at the moment.现在,我有以下任务:如果我收到对我的端点的请求,我需要触发一个特殊的流程事件,无论流程目前处于哪个步骤。 I tried to use Signal Event, but I can't find a solution that allows me not to throw an event on a specific point, but to throw in programmatically to the specific process instance (using its execution ID).我尝试使用信号事件,但找不到允许我不在特定点上抛出事件,而是以编程方式抛出到特定流程实例(使用其执行 ID)的解决方案。

I think I need a kind of the goto operator analogue from the C++ or @EventListener analogue from the Spring Boot events model, but not sure if Camunda provides such a functionality.我想我需要一种来自 C++ 的goto运算符模拟或来自 Spring Boot 事件模型的@EventListener模拟,但不确定 Camunda 是否提供这样的功能。

Any thoughts on it?对此有何想法?

You can define catching events for different 'scopes'.您可以为不同的“范围”定义捕获事件。 For instance a receive message boundary event can be attached to an embedded sub processes.例如,可以将接收消息边界事件附加到嵌入式子进程。 This way the process will be ready to receive the message for the complete duration of the embedded sub process, no matter which task it is currently in. See: https://docs.camunda.org/manual/latest/reference/bpmn20/subprocesses/embedded-subprocess/ These boundary events can be interrupting (the embedded sub process) or non-interrupting (new token fro separate branch)这样,进程将准备好在嵌入式子进程的整个持续时间内接收消息,无论它当前处于哪个任务中。请参阅: https : //docs.camunda.org/manual/latest/reference/bpmn20/ subprocesses/embedded-subprocess/这些边界事件可以是中断的(嵌入式子流程)或非中断的(来自单独分支的新令牌)

Another solution is to work with event based sub processes.另一种解决方案是使用基于事件的子流程。 Those can be place inside an embedded sub process to limit them to a define scope / section of the process, or the can be place in the parent process, where they serve as a 'global' event handler.这些可以放置在嵌入式子流程中以将它们限制在流程的定义范围/部分,或者可以放置在父流程中,在那里它们充当“全局”事件处理程序。 See: https://docs.camunda.org/manual/latest/reference/bpmn20/subprocesses/event-subprocess/请参阅: https : //docs.camunda.org/manual/latest/reference/bpmn20/subprocesses/event-subprocess/

Once you process instance has reached a message receive state, you can send a message (or signal) to the process instance to affect its behavior.一旦流程实例达到消息接收状态,您就可以向流程实例发送消息(或信号)以影响其行为。 To match the message to the correct process instance out of many, you need a correlation criteron.要将消息与众多流程实例中的正确流程实例相匹配,您需要一个相关性标准。 The simplest and best solution is to give each process instance a unique business key (special process data).最简单和最好的解决方案是给每个流程实例一个唯一的业务密钥(特殊流程数据)。 This business key can then be used as a parameter on the message API to correlate the message to the correct process instance.然后,可以将此业务密钥用作消息 API 上的参数,以将消息与正确的流程实例相关联。 See: https://docs.camunda.org/manual/latest/reference/rest/message/post-message/ If no business key is available, a (combination of) process data can be used as correlation criterion.请参阅: https : //docs.camunda.org/manual/latest/reference/rest/message/post-message/如果没有可用的业务密钥,则可以将流程数据(的组合)用作关联标准。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM