简体   繁体   English

将Drools与Java应用程序集成

[英]Integrate Drools with Java application

I am trying Drools/Guvnor for very first time, we are planned to do Rule Authoring in Guvnor, compile, build and download the package to “Rule Package Directory”. 我第一次尝试Drools / Guvnor,我们计划在Guvnor中进行规则创作,编译,构建并将软件包下载到“ Rule软件包目录”。

Now the question I am having is, what is the best way to integrate Drools with our Java application? 现在我的问题是,将Drools与我们的Java应用程序集成的最佳方法是什么? Option 1) Build the knowledge agent and start inserting the facts into memory for rule evaluation in our application. 选项1)构建知识主体,并开始将事实插入内存以在我们的应用程序中进行规则评估。 In this case Drools engine use JVM same as application JVM. 在这种情况下,Drools引擎使用的JVM与应用程序JVM相同。 Option 2) Have a Drools Server which builds the knowledge agent, and application can send the requests to Drools Server for rule evaluation using REST API. 选项2)拥有一个构建知识代理的Drools服务器,应用程序可以将请求发送到Drools Server以使用REST API进行规则评估。 Rules will be executed in separate JVM than application JVM. 规则将在与应用程序JVM不同的JVM中执行。

I also wondering is there any performance (in terms of execution time) difference between the options mentioned above? 我还想知道上述选项之间在性能(就执行时间而言)上是否有差异?

Could you please also let me know if I am thinking in the right direction? 您能不能告诉我我是否在朝着正确的方向思考?

-Sri -斯里兰卡

I've tested both your possibilities and saw no difference in performance BUT my tests were performed with only a few rules, I didn't really do stress tests. 我已经测试了您的可能性,但没有看到性能上的差异,但是我的测试仅遵循一些规则,我实际上并没有进行压力测试。 I don't know if the execution time scales well. 我不知道执行时间是否合适。

What I use is actually a mixture of both your options: I do everything in the same JVM, build the knowledge base (takes a few seconds) and insert facts into memory to trigger the rules. 实际上,我使用的是两种选择的结合:我在同一JVM中进行所有操作,建立知识库(花费几秒钟),并将事实插入内存以触发规则。

Either way, you're in the right direction :) 无论哪种方式,您都朝着正确的方向发展:)

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

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