Re: [rules-users] Fire Rule in Stateless Knowledge Session
I am facing memory leak while using StatefulKnowledgeSession I found that after dispose call the global objects still intact. ksession.dispose() See print statementd.; [STDOUT] % reading before dispose:p1.Readings@49fff2ef [STDOUT] % reading after dispose:p1.Readings@49fff2ef Any idea how to clear globals from memory? -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p4024467.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Fire Rule in Stateless Knowledge Session
Hi, I am new in Drools. I am using Drools version 5.1.0 My requirement is kind of request response, where I have to perform some checks for the request and respond the result. Hence, I decided to go with stateless knowledge session. I have prepared .DRL file and it contains set of rules. When some request receives I have to identify the rule(s) belongs to that request and then fire the rule(s). I am not able to figure out how to categories the rules request wise in DRL file? Also, how to fire only those rules which belongs to the category. For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs to Rq2 and R4, R5 belongs to Rq3. When some request receives only its belonging rules should be fired. For example, on receiving of Rq2 only R3 should be fired. Please provide me some code snipped or link. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234893.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
Basically you could do rule RL1 when Request( type == Rq1,... ) which limits the rule to Requests of this type. -W On 8 August 2011 10:23, snehils sneh...@gmail.com wrote: Hi, I am new in Drools. I am using Drools version 5.1.0 My requirement is kind of request response, where I have to perform some checks for the request and respond the result. Hence, I decided to go with stateless knowledge session. I have prepared .DRL file and it contains set of rules. When some request receives I have to identify the rule(s) belongs to that request and then fire the rule(s). I am not able to figure out how to categories the rules request wise in DRL file? Also, how to fire only those rules which belongs to the category. For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs to Rq2 and R4, R5 belongs to Rq3. When some request receives only its belonging rules should be fired. For example, on receiving of Rq2 only R3 should be fired. Please provide me some code snipped or link. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234893.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
You can have a map of kbases containing the specific rules. When a request arrives, you get the proper kbase from the map and create a ksession from it. Another way could be to use Control Objects in your rules. Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Mon, Aug 8, 2011 at 10:23 AM, snehils sneh...@gmail.com wrote: Hi, I am new in Drools. I am using Drools version 5.1.0 My requirement is kind of request response, where I have to perform some checks for the request and respond the result. Hence, I decided to go with stateless knowledge session. I have prepared .DRL file and it contains set of rules. When some request receives I have to identify the rule(s) belongs to that request and then fire the rule(s). I am not able to figure out how to categories the rules request wise in DRL file? Also, how to fire only those rules which belongs to the category. For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs to Rq2 and R4, R5 belongs to Rq3. When some request receives only its belonging rules should be fired. For example, on receiving of Rq2 only R3 should be fired. Please provide me some code snipped or link. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234893.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
I thought of doing same but this will become slow when number of rules are more (100 or 200 rules). The given condition will be checked in each rule. -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234939.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: Hi, I am new in Drools. I am using Drools version 5.1.0 My requirement is kind of request response, where I have to perform some checks for the request and respond the result. Hence, I decided to go with stateless knowledge session. I have prepared .DRL file and it contains set of rules. When some request receives I have to identify the rule(s) belongs to that request and then fire the rule(s). I am not able to figure out how to categories the rules request wise in DRL file? Also, how to fire only those rules which belongs to the category. For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs to Rq2 and R4, R5 belongs to Rq3. When some request receives only its belonging rules should be fired. For example, on receiving of Rq2 only R3 should be fired. Please provide me some code snipped or link. Thanks One way could be to have conditions in your rules that check what kind of request it is. Without knowing your problem in detail it's hard to know if this is feasible. E.g. you could insert a request object as a fact into the session and let rules in R3 have condition: when Request(type = Rq2) ... If you switch to stateful session instead of stateless you could use agenda groups to achieve something similar. See Drools Expert user guide for details on how to use agenda groups. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234944.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
Because of node sharing, it shouldn't be that bad if you use the Request() constraint as the first conditional element of your rules. You must also use always the same order when checking for more than 1 request. For example: rule Rule1 when Request ( type == Rq1 || type == Rq2) ... then end rule Rule2 when Request ( type == Rq1 || type == Rq2) --- Constraints are in the same order ... then end Wolfgang, please correct me if I'm wrong :) Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com On Mon, Aug 8, 2011 at 10:41 AM, snehils sneh...@gmail.com wrote: I thought of doing same but this will become slow when number of rules are more (100 or 200 rules). The given condition will be checked in each rule. -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234939.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: I thought of doing same but this will become slow when number of rules are more (100 or 200 rules). The given condition will be checked in each rule. The Rete algorithm will make sure that this does not become slow when number of rules increases. Multiple rules with the same condition will only result in one node in the Rete tree. I.e. each unique condition will only be checked once. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234977.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
Thanks Mattias... Now Wolfgang's solution will work Mattias Nilsson Grip wrote: The Rete algorithm will make sure that this does not become slow when number of rules increases. Multiple rules with the same condition will only result in one node in the Rete tree. I.e. each unique condition will only be checked once. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235065.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
Can you give some reference link ot code snippet? that would be helpful :) Esteban wrote: You can have a map of kbases containing the specific rules. When a request arrives, you get the proper kbase from the map and create a ksession from it. Another way could be to use Control Objects in your rules. Best Regards, Esteban Aliverti - Developer @ http://www.plugtree.com - Blog @ http://ilesteban.wordpress.com -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235070.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
Is there any disadvantage switching in stateful session? Mattias Nilsson Grip wrote: If you switch to stateful session instead of stateless you could use agenda groups to achieve something similar. See Drools Expert user guide for details on how to use agenda groups. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235084.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: Is there any disadvantage switching in stateful session? If you switch to stateful sessions you have to ensure that you call the dispose-method on your session when you are done with it. Otherwise you could get a memory leak. Other than that I can't think of any disadvantage. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235136.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users