StatelessKnowledgeSession 和 Drools Flow
是否可以从 StatelessKnowledgeSession 运行 Drools Flow 流程?如果是这样,怎么办?它没有 startProcess(id, params)
方法,并且似乎只实现规则功能。我有一个服务,其方法运行一个进程。到目前为止,我已经使用了一个 StatefulKnowledgeSession,但我了解到它不是线程安全的。我提出的一个解决方案是注入一个知识库并为该方法的每次调用创建一个新会话,但这似乎是一种资源浪费。
Is it possible to run a Drools Flow process from a StatelessKnowledgeSession
? If so, how? It doesn't have the startProcess(id, params)
method and seems to only implement rule functionality. I have a service whose method runs a process. So far, I've used one StatefulKnowledgeSession
but I read that it's not thread-safe. One solution I came up with is to inject a knowledge base and create a new session for every call of this method, but that seems like a waste of resources.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
完成另一个答案,
你可以这样使用:
ksession.execute(CommandFactory.newStartProcess(theName,parameters));
Completing the other answer,
you can use like this:
ksession.execute(CommandFactory.newStartProcess(theName, parameters));
StatelessKnowledgeSession 有一个方法execute(..),您可以在其中传递一组命令。其中之一可能是 startProcess 命令。
StatelessKnowledgeSession has a method execute(..) where you can pass a set of commands. One of those could be a startProcess command.