Considering that googling on "rule latch" will return this thread on gmane as 
the 2nd link, you might find research difficult. :)  I think Tom coined that 
term in this context, but it fits.  The basic idea is that you use an object as 
an indicator of what processing has happened, and whether or not rules should 
fire.

class RuleLatch {
  public final String name;
  public final DataObject dataObject;
  public RuleLatch(String name, DataObject dataObject) { 
    this.name = name; this.dataObject = dataObject;
  }
}

when 
  data: DataObject(...selection conditions for data...)
  level1Latch: RuleLatch(name == "level1Foo", dataObejct == data)
  level2Latch: RuleLatch(name == "level2Bar", dataObject == data)
then
  ...if this rule wants to cancel all subsequent "level1Foo" it retracts 
level1Latch...

  ...if this rule wants to cancel all subsequent "level2Bar" it 
retractslevel2Latch...
end

An alternative, more efficient, but not as OO happy way, is to put the control 
information into the DataObject itself.  Drools does a lot of optimization on 
the == tests with hashing, but if speed is a priority it might not be enough.  
So...

class DataObject {
  public boolean level1Foo = true;

  public boolean level2Bar = true;
}

when 

  data: DataObject(level1Foo == true, level2Bar == true, ...selection 
conditions for data... )
then

  ...if this rule wants to cancel all subsequent "level1Foo" it updates 
level1Foo = false...


  ...if this rule wants to cancel all subsequent "level2Bar" it updates 
level2Bar = false...

end



--- On Thu, 7/22/10, tom ska <tiberium.li...@gmail.com> wrote:

From: tom ska <tiberium.li...@gmail.com>
Subject: Re: [rules-users] Problem with DRL language/ XLS decision tables.
To: "Rules Users List" <rules-users@lists.jboss.org>
Date: Thursday, July 22, 2010, 11:50 AM


Thanks for reacting ;)
I did some simulations, and after them, I want of course to parallelize this 
process of processing 2 billions facts. But as far as I wrote, Drools engine, 
can't do this. And I have to create threads manually in application (with pool 
of sessions). Am I right? Tuning number of data sounds fine to me, so I will 
try method with "rule latch" too (but I have to read about this, because, I 
don't know what is it, and I don't want to waste your time ;) But still I don't 
know how to use StatefulSessions to do this...

Summarising, there are 3 methods to do, what I want to do (apart of a 
scalability problem - yet ;)
1.)with StatelessSession for one fact at time and "activation group"

2.)"rule latch" - I have to read more about it
3.)with a pool of StatefulSessions that I reuse - but I still don't know how to 
do it using StatefulSessions

Really thanks for help ;)


P.S. I use Drools 5 :)


      
_______________________________________________

rules-users mailing list

rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users






-----Inline Attachment Follows-----

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



      
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to