开发者

Drools reusability issues

I'm evaluating JBoss Drools currently and would like to seek help from the community regarding the reusability issues I've identified so far:

  1. To create knowledgebase, one has to import .drl file/s but if I only want to use a subset of rules from a .drl file, other than forming rule groups (using agenda-group or RuleFlowGroup), are there other ways to do this? Using rule groups can easily make the rule definition messy, imagine you have 10 different subsets of rules with overlapping, that's 10 rule groups...

  2. Is there any way to insert facts into the rule knowledgesession开发者_JAVA百科 dynamically? It seems to me all the required facts/data need to be inserted into the session before firing the rule engine, creating performance bottlenecks... E.g., If one of the facts resides in database, the engine cannot be fired unless the fact from database is drawn. It would be better if the engine can process other facts first and when the fact from database is ready, insert it dynamically into the session.


  1. Good way of doing this is using agenda-group. Other way is, separate your rules package wise.

  2. As I under stand your question, you can use Fact Handles.

    Use StatefullKnowledgeSession here.

    FactHandle objHandle = ksession.insert( fact );

After while, when your facts are ready from database, you can modify the facts in current running session.

ksession.update(objHandle, newFactObject(of same class))

For more details, go to http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html chapter 2.1.2. Stateful Knowledge Session.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜