Not a problem.  Actually I prefer to perform flow control using working memory 
objects like that instead of using the keywords, but I'm old school. :)

GreG

On Nov 29, 2012, at 11:11, "Cotton, Ben" <[email protected]> wrote:

> Ø  Have you looked at agenda-group or ruleflow-group?  
>  
> Sweet.
>  
> Ø  You've reinvented some of their functionality here.  
>  
> Gak!  I figured I must have been doing that (and that’s the last thing I want 
> to do).   Got stuck in my “Drools newbie deep dive” … knew had to hit this 
> forum and “surface for air”.  THANKS!
>  
>  
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Greg Barton
> Sent: Thursday, November 29, 2012 12:00 PM
> To: Rules Users List
> Subject: Re: [rules-users] DROOLs 'Guarded entry/block' tactics for Rules 
> synchronization and ordinality?
>  
> Have you looked at agenda-group or ruleflow-group?  You've reinvented some of 
> their functionality here.  
>  
> From: "Cotton, Ben" <[email protected]>
> To: "[email protected]" <[email protected]> 
> Cc: "O'Brien, Patrick" <Patrick.O'[email protected]> 
> Sent: Thursday, November 29, 2012 10:47 AM
> Subject: [rules-users] DROOLs 'Guarded entry/block' tactics for Rules 
> synchronization and ordinality?
>  
> Hi,
>  
> I have finally gained a tiny bit of control (and maybe even some competency) 
> in using the DROOLs language operators ‘no-loop’ and ‘lock-on-active’ as a 
> basis for controlling rule set firing behavior in response to Fact mutation 
> events (during consequence processing).
>  
> I now want to (competently!) use DROOLs language tactics that give me ever 
> finer grained control over managing rule set firing behavior on Fact mutation 
> events.  Specifically, I want to be able to implement some form of ‘Guarded 
> entry/block’ controls. 
>  
> E.g. let’s say I have a Fact  (InsertedFactPOJO) that I insert into the KS 
> and want to have its ‘fireAllRules()’  AgendaSet(s) renedered in exact 
> incremental ordinal stages and in perfect isolation.  To do this, I am 
> testing the inclusion of a ‘countdownLatch’ Semaphore reference as a Fact 
> member (initialized to N=`total rule count` value).  I then use this to 
> ‘Guard’ individual rule entry, by generating an explicit predicate participant
>  
> (InsertedFactPOJO(countdownLatch             == i) )
>  
> @ each ith Rule producedby my template.
>  
> Is this approach a valid/sound/complete way to implement ‘Guarded 
> entry/block’ controls in DROOLs?  Is there a better way?
>  
> As always, my sincerest gratitude to this community for its generosity (and 
> its genius).
>  
> Ben
>  
> package 
> com.ms.fast.triclear.eligibility.rules.drools_community.questions.posted;
> import com.ms.fast.triclear.eligibility.InsertedFactPOJO;  
> //fact:(backed by Class 'InsertedFactPOJO'  has
> //- 'countdownLatch' (Semaphore) member
> //- 'aList' (List)member
>  
> rule "RULE_ALL_RULES_HAVE_FIRED_ONCE_ORDINALLY"
> when
>     fact:InsertedFactPOJO()
>     InsertedFactPOJO(countdownLatch == 0)
> then
>     System.out.format("\tALL RULES have fired *EXACTLY* once, *EXACTLY* 
> ordinally. "+
>                     " fact.countdownLatch=%d \n\t fact.aList=%s\n\n",
>                     fact.countdownLatch,
>                     fact.aList.toString());
> end
>   
> rule "RULE_3"
>     when
>         fact:InsertedFactPOJO()
>         InsertedFactPOJO(countdownLatch             == 3)
>         //bunch of other L-Value PREDICATES      
>     then
>         System.out.format("\t %20.20s"+
>                          " \t(DROOLS agenda: consequence fired for L-value 
> predicate match @RULE="+
>                       "3"+" -- fact.countDownLatch=%d)\n", "Rule 
> 3",fact.countdownLatch);
>         modify (fact) {
>             countdownLatch = fact.countdownLatch - 1,
>             aList.add("Rule 3 pattern-match event added to POJO 'aList' 
> field");
>         }     
> end
>  
> rule "RULE_2"
>     when
>         fact:InsertedFactPOJO()
>         InsertedFactPOJO(countdownLatch             == 2)
>         //bunch of other L-Value PREDICATES      
>     then
>         System.out.format("\t %20.20s"+
>                          " \t(DROOLS agenda: consequence fired for L-value 
> predicate match @RULE="+
>                       "2"+" -- fact.countDownLatch=%d)\n", "Rule 
> 2",fact.countdownLatch);
>         modify (fact) {
>             countdownLatch = fact.countdownLatch - 1,
>             aList.add("Rule 2 pattern-match event added to POJO 'aList' 
> field");
>         }     
> end
>  
> rule "RULE_1"
>     when
>         fact:InsertedFactPOJO()
>         InsertedFactPOJO(countdownLatch             == 1)
>         //bunch of other L-Value PREDICATES      
>     then
>         System.out.format("\t %20.20s"+
>                          " \t(DROOLS agenda: consequence fired for L-value 
> predicate match @RULE="+
>                       "1"+" -- fact.countDownLatch=%d)\n", "Rule 
> 1",fact.countdownLatch);
>         modify (fact) {
>             countdownLatch = fact.countdownLatch - 1,
>             aList.add("Rule 1 pattern-match event added to POJO 'aList' 
> field");
>         }     
> end
>  
>  
>  
> Ben D Cotton III
> Morgan Stanley & Co.
> OTC Derivatives Clearing Technology 
> 1221 AOTA Rockefeller Ctr - Flr 27
> New York, NY 10020
> (212)762.9094
> [email protected]
>  
>  
>  
> 
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions 
> or views contained herein are not intended to be, and do not constitute, 
> advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform 
> and Consumer Protection Act. If you have received this communication in 
> error, please destroy all electronic and paper copies and notify the sender 
> immediately. Mistransmission is not intended to waive confidentiality or 
> privilege. Morgan Stanley reserves the right, to the extent permitted under 
> applicable law, to monitor electronic communications. This message is subject 
> to terms available at the following link: 
> http://www.morganstanley.com/disclaimers If you cannot access these links, 
> please notify us by reply message and we will send the contents to you. By 
> messaging with Morgan Stanley you consent to the foregoing.
> 
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> 
> 
> 
> NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions 
> or views contained herein are not intended to be, and do not constitute, 
> advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform 
> and Consumer Protection Act. If you have received this communication in 
> error, please destroy all electronic and paper copies and notify the sender 
> immediately. Mistransmission is not intended to waive confidentiality or 
> privilege. Morgan Stanley reserves the right, to the extent permitted under 
> applicable law, to monitor electronic communications. This message is subject 
> to terms available at the following link: 
> http://www.morganstanley.com/disclaimers If you cannot access these links, 
> please notify us by reply message and we will send the contents to you. By 
> messaging with Morgan Stanley you consent to the foregoing.
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to