[rules-users] Query for a fact, and concurrent rule execution

stelomax stephen.lomax at mattelli.com
Wed May 2 05:39:46 EDT 2012


Hi,

Please bear with me, I am relatively new to the world of Drools and have a
question.  I am hoping it will be a simple issue.

First let me frame my planned implementation at a high level.  I am hoping
to use Drools as a real time service enabled quote validation tool.

Facts representing products and attributes will be loaded into a stateful
knowledge session upon boot (using a piece of Java that loads these as facts
from our product DB).

The front-end application will allow users to build up quotes consisting of
quote lines that make references to these products.  Once the quote is built
they will press a "Validate" button.  This will call a webservice that will:

1) Insert the quote details as facts into the knowledge session
2) Run a "rule flow" to validate the quote against the product facts
3) The rules will insert validation results as facts tagged against the
quote
4) QUERY for the validation results 
5) Retract the facts for the quote (inc validation results)
6) Send the validation results back as a response to the webservice call

My first question is how to implement step 4 --> how to physically query for
the validation results pertaining to that specific quote.  Any help here
would be greatly appreciated.

My second question relates to concurrency.  As this is a quote validation
tool there will be multiple users validating quotes so we will get
concurrent validation requests.

What is the recommended manner of dealing with concurrent rule requests
within a stateful knowledge session.  If 2 people attempt to validate a
different quote at the same time we will have two quotes within the
knowledge session together with all of the product facts.  Is drools capable
of running two concurrent rule flows against the knowledge session, each
referencing a different quote or would we need to instantiate 2 knowledge
sessions, or even deal with the matter in a serial manner placing the 2nd
quote validation flow on hold until the first completes?

Any help/pointers would be great.  I am hoping someone out there has
attempted to use Drools in a similar manner :)

Many Thanks

Ste

--
View this message in context: http://drools.46999.n3.nabble.com/Query-for-a-fact-and-concurrent-rule-execution-tp3954737.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list