Thanks - the example project is attached.



The output I'd like to get in the Console window is:

Hello World
Thread launched
Inserting SimpleFact
Inserting SimpleFact
Updating SimpleFact
Updating SimpleFact
All set

However, what I currently get is:

Hello World
Thread launched
Inserting SimpleFact
All set
Inserting SimpleFact
Updating SimpleFact
Updating SimpleFact

Many thanks for taking the time to look at this.

Regards,

Alan




Mauricio Salatino <salaboy@gmail.com>
Sent by: rules-users-bounces@lists.jboss.org

15/04/2010 14:36
Please respond to
Rules Users List <rules-users@lists.jboss.org>

To
Rules Users List <rules-users@lists.jboss.org>
cc
Subject
Re: [rules-users] Drools Flow: Problem with constraint in (Wait)        State node





Hi Alan,
Share with us the simple project, I can take a look on it and get back with some suggestions.


2010/4/15 <Alan.Gairey@tessella.com>

I have a simple rule flow of the form: Start -> Work Item -> Wait State -> Action -> End.


The handler for the work item launches a separate thread, and then completes. This thread inserts a number of facts into the (stateful) session's working memory; each fact ('SimpleFact') has a boolean property ('complete') that is initially set false. Later on in the thread, the facts in memory are updated by setting their 'complete' properties to true.


I want the Wait State to hold execution of the rule flow until ALL the facts in memory have the 'complete' property set to true. My first attempt at setting the constraint was as follows:


forall(SimpleFact(complete == true))


With this constraint, the Action node executes straight after the completion of the Work Item. My next attempt for the constraint was:


exists(SimpleFact()) and forall(SimpleFact(complete == true))


With this constraint, the Action node executes as soon as the first instance of SimpleFact is inserted into the working memory.


So my question is: how do I specify the Wait State node constraint so that the rule flow only resumes once all the SimpleFact instances in working memory have their 'complete' property set to true?


(I have a simple project to demonstrate the problem if required.)


Many thanks,


Alan

_______________________________________________
rules-users mailing list

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




--
-
http://salaboy.wordpress.com
-
http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users