关于 Drools Flow 的 Qn:如何指定在特定节点启动的规则流?
我正在开发一个 Drools 项目,该项目需要暂停规则流(写入数据库)并恢复规则流(从数据库读取)。我知道 Drools 提供了开箱即用的 JPA/事务样式持久性,一是我无法让它运行,二是它以序列化形式持久化,这对我的用例来说不是很有用。
我想出的是让我的系统记住规则流暂停的节点(可以完成),将节点 ID 和工作事实保留在数据库中(可以完成)。然后在恢复规则流时检索这些持久化数据,将它们注入到知识会话中(可以完成)并从暂停的节点继续规则流(无法完成)。但我还没有找到从特定节点开始处理的方法。
请帮忙,谢谢。
I'm working on a Drools project which requires pausing of ruleflow (write into database) and resuming the ruleflow (read from database). I know that Drools provides out of the box JPA/transaction style persistence, one I couldn't get it running and second it persists in serialized form, not very useful for my use cases.
What I come up with is for my system to remember the node where the ruleflow is paused (can be done), persist the node id and working facts in database (can be done). Then retrieve these persisted data when resuming the ruleflow, inject them into the knowledge session (can be done) and continue the ruleflow from the paused node (cannot be done). But I have yet to find a way to start processing from a specific node.
Please help, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了类似的问题(如果我理解你的问题),据我所知,drools 只允许每个规则流有 1 个启动节点,因此我看到在任意节点启动规则流的唯一机会就是直接启动到网关(发散)节点,网关节点应连接到规则流中的每个节点(或根据需要连接到),为其定义的规则应允许您在任何节点启动工作流。当然,这个工作环境并不漂亮,但可能已经足够了。
顺便说一句,如果您找到更好的解决方案,请告诉我。
富安卡
I'm having a similar issue (if I understood your question), as far as I know, drools allows only 1 start node per ruleflow, so the only chance I see to start a ruleflow at an arbitrary node is to start right into a gateway (diverge) node, the gateway node should be connected to every node in the ruleflow (or as much as you neeed), the rules defined for it should allow you to start the workflow at any node. Sure this work arround is not pretty but might be enough.
By the way, If you find a better solution please let me know.
Fuanka