<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Mike,<div><br></div><div>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.</div><div><br></div><div>What is the performance hit in launching a Stateful knowledge session with say 10,000 facts, would it make the web service call slow?</div><div><br></div><div>Thanks very much for the help on the query also…we will look into that.</div><div><br></div><div>Kind Regards</div><div><br></div><div>Ste</div><div><br></div><div><div><div>On 2 May 2012, at 11:31, Michael Anstis wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Does each quote validation exercise enrich the StatefulKnowledgeSession with other facts that could influence validation of other quotes?<br><br>If not probably using a StatefulKnowledgeSession per HTTP request might be more simple (with the KnowledgeBase as an application scoped variable).<br>
<br>Regarding retrieval of results, there are a couple of options that spring to mind:-<br><ul><li>Look at using a Global to collate results.</li><li>Look at using a Query (<a href="http://stackoverflow.com/questions/5872215/how-do-i-add-facts-to-working-memory-at-runtime-in-the-drools-drl-and-retrieve-t">http://stackoverflow.com/questions/5872215/how-do-i-add-facts-to-working-memory-at-runtime-in-the-drools-drl-and-retrieve-t</a>)</li>
</ul>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 2 May 2012 10:39, stelomax <span dir="ltr"><<a href="mailto:stephen.lomax@mattelli.com" target="_blank">stephen.lomax@mattelli.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Please bear with me, I am relatively new to the world of Drools and have a<br>
question. I am hoping it will be a simple issue.<br>
<br>
First let me frame my planned implementation at a high level. I am hoping<br>
to use Drools as a real time service enabled quote validation tool.<br>
<br>
Facts representing products and attributes will be loaded into a stateful<br>
knowledge session upon boot (using a piece of Java that loads these as facts<br>
from our product DB).<br>
<br>
The front-end application will allow users to build up quotes consisting of<br>
quote lines that make references to these products. Once the quote is built<br>
they will press a "Validate" button. This will call a webservice that will:<br>
<br>
1) Insert the quote details as facts into the knowledge session<br>
2) Run a "rule flow" to validate the quote against the product facts<br>
3) The rules will insert validation results as facts tagged against the<br>
quote<br>
4) QUERY for the validation results<br>
5) Retract the facts for the quote (inc validation results)<br>
6) Send the validation results back as a response to the webservice call<br>
<br>
My first question is how to implement step 4 --> how to physically query for<br>
the validation results pertaining to that specific quote. Any help here<br>
would be greatly appreciated.<br>
<br>
My second question relates to concurrency. As this is a quote validation<br>
tool there will be multiple users validating quotes so we will get<br>
concurrent validation requests.<br>
<br>
What is the recommended manner of dealing with concurrent rule requests<br>
within a stateful knowledge session. If 2 people attempt to validate a<br>
different quote at the same time we will have two quotes within the<br>
knowledge session together with all of the product facts. Is drools capable<br>
of running two concurrent rule flows against the knowledge session, each<br>
referencing a different quote or would we need to instantiate 2 knowledge<br>
sessions, or even deal with the matter in a serial manner placing the 2nd<br>
quote validation flow on hold until the first completes?<br>
<br>
Any help/pointers would be great. I am hoping someone out there has<br>
attempted to use Drools in a similar manner :)<br>
<br>
Many Thanks<br>
<br>
Ste<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Query-for-a-fact-and-concurrent-rule-execution-tp3954737.html" target="_blank">http://drools.46999.n3.nabble.com/Query-for-a-fact-and-concurrent-rule-execution-tp3954737.html</a><br>
Sent from the Drools: User forum mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>
_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote></div><br></div></body></html>