[rules-users] Drools Flow: Problem with constraint in (Wait) State node
Alan.Gairey at tessella.com
Alan.Gairey at tessella.com
Thu Apr 15 09:04:58 EDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100415/dd54a747/attachment.html
More information about the rules-users
mailing list