Kogito - 等待收到来自多个端点的数据
我将 Kogito 与 Quarkus 一起使用。我已经设置了 drl 规则并使用 bpmn 配置。如下所示,当前暴露了一个端点,用于启动该进程。从初始请求接收所有需要的数据,然后对其进行评估并继续处理。
我想扩展工作流程以拥有两个单独的端点。一个提供该人的年龄,另一个提供姓名。该过程必须等到收集完所有需要的数据后才能继续进行评估。
有人遇到过类似的解决方案吗?
I am using Kogito with Quarkus. I have set on drl rule and am using a bpmn configuration. As can be seen below, currently one endpoint is exposed, that starts the process. All needed data is received from the initial request, it is then evaluated and process goes on.
I would like to extend the workflow to have two separate endpoints. One to provide the age of the person and another to provide the name. The process must wait until all needed data is gathered before it proceeds with evaluation.
Has anybody come across a similar solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从技术上讲,您可以在对整个数据执行规则之前使用信号或消息将更多数据添加到流程实例中,请参阅 https://docs.kogito.kie.org/latest/html_single/#ref-bpmn-intermediate-events_kogito-developing-process-services。
为此,您需要在这些事件之间具有某种相关性,否则,如何将事件名称 1 映射到事件年龄 1。如果您可以保留流程实例 ID,那么第二个事件可以触发特定流程实例的休息端点或通过消息代理向其发送消息。
您还可以使用自己的自定义逻辑来聚合事件,并且仅在满足完整数据的标准后才触发新的流程实例,并且 Kogito 中还计划扩展如何完成关联的功能,例如允许使用变量进程的标识符作为标识符。例如,如果您将 person.id 作为关联,并且同一 ID 的名称和年龄的事件将发出相同流程实例的信号。希望这个信息有帮助。
Technically you could use a signal or message to add more data into a process instance before you execute the rules over the entire data, see https://docs.kogito.kie.org/latest/html_single/#ref-bpmn-intermediate-events_kogito-developing-process-services.
In order to do that you need to have some sort of correlation between these events, otherwise, how do you map that event name 1 should be matched to event age 1. If you can keep the process instance id, then the second event can either trigger a rest endpoint to the specific process instance or send it a message via a message broker.
You also have your own custom logic to aggregate the events and only fire a new process instance once your criteria of complete data is met, and there is also plans in Kogito to extend the capabilities of how correlation is done, allowing for instance to use variables of the process as the identifier. For example, if you have person.id as correlation and event to name and age of the same id would signal the same process instance. HOpe this info helps.