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

Stephen Lomax stephen.lomax at mattelli.com
Wed May 2 06:58:19 EDT 2012


Hi Mike,

Each quote does not enrich the session, we were actively looking to remove the quote at the end of the session to prevent it growing as we were just comparing the quote to the core product attribute facts.

What is the performance hit in launching a Stateful knowledge session with say 10,000 facts, would it make the web service call slow?

Thanks very much for the help on the query also…we will look into that.

Kind Regards

Ste

On 2 May 2012, at 11:31, Michael Anstis wrote:

> Does each quote validation exercise enrich the StatefulKnowledgeSession with other facts that could influence validation of other quotes?
> 
> If not probably using a StatefulKnowledgeSession per HTTP request might be more simple (with the KnowledgeBase as an application scoped variable).
> 
> Regarding retrieval of results, there are a couple of options that spring to mind:-
> Look at using a Global to collate results.
> Look at using a Query (http://stackoverflow.com/questions/5872215/how-do-i-add-facts-to-working-memory-at-runtime-in-the-drools-drl-and-retrieve-t)
> With kind regards,
> 
> Mike
> 
> On 2 May 2012 10:39, stelomax <stephen.lomax at mattelli.com> wrote:
> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120502/de2953aa/attachment-0001.html 


More information about the rules-users mailing list