[rules-users] Rules Deployment
Hi all, We are using rules in our java based project that connects to jboss for jms. To implement rules, we include drools specific jar files in the code itself. When this code is executed, rules also get executed and our purpose is served. Rules file is written manually and is called from within the java code. Going forward, we want to deploy java application together with rules on jboss. I want to know the standard way of doing it ? Please provide pointers on this. Regards Samya Maiti -- View this message in context: http://drools.46999.n3.nabble.com/Rules-Deployment-tp4019302.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] Calling a function from When part
Hey laune, I think we are mixing up the things. My requirement is to call a method in an helper class, that in turn accesses the db. Currently i have done with */evel(functionCall() )/* //The return type of the method is boolean *But the problem is, once the control enters WHEN part of the rule it making multiple calls to this method ( checked by putting in SYSO statements). But i want this call to take place once.* So it will be very helpful, if any once can suggest me any other way to make function call from when part. Also tried with /*$A : Boolean() from functionCall( ) eval( $A )*/ But the result is same. Also please provide your inputs if it is not possible to handle the problem, where in it make multiple function call. Regards, Sam -- View this message in context: http://drools.46999.n3.nabble.com/Calling-a-function-from-When-part-tp4018987p4019024.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] Calling a function from When part
Hi laune, Ok let me state you my req, In my pojo I populate a list of employeesNo that have age 30, by firing a query on my Employee *metadata* tables of company say ABC. Then I come to the rules try to see if the company name is ABC? If yes, i need to fetch all the employeeNo having age30 from the Employee *Runtime* table( This table stores records for all employees working today ), in this way i will come to know if all employees above age 30 are present or not. Regards, Sam -- View this message in context: http://drools.46999.n3.nabble.com/Calling-a-function-from-When-part-tp4018987p4019010.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] Calling a function from When part
Thanks for the idea, Sorry to say, but can you please explain me the flow, as in how we are going to access the data of employees from the runtime table? More over can you put some focus on the global EmployeeTable empTable; Regards, Sam -- View this message in context: http://drools.46999.n3.nabble.com/Calling-a-function-from-When-part-tp4018987p4019018.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] Calling a function from When part
Hi FrankVhh, The above approach you suggested works, But the problem is it continuously hits this method when it satisfies the rule in the method I have a DB call, so it creates some problem. For eg: - function boolean sampleFunction(){ //makes a DataBase call System.out.println(1234); return true/false; } rule sample1 when //condition 1 then System.out.println(abcd); //some action to satisfy condition 2 System.out.println(mnop); end rule sample2 when //condition 2 sampleFunction(); then //some action System.out.println(xyz); end O/P abcd 1234 1234 1234 1234 mnop 1234 1234 1234 1234 1234 1234 1234 1234 1234 1234 xyz Is there any way to tackle this. As in by using salience or something.? Regards, Sam -- View this message in context: http://drools.46999.n3.nabble.com/Calling-a-function-from-When-part-tp4018987p4018995.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] Calling a function from When part
Hi Davide, Thanks for the prompt reply, Now i have changed my requirement a bit, to make it much simpler function boolean foo(List list){ //do some action on the list set true false accordingly. system.out.println(foo ); return true/false; } rule one no-loop salience -1 when //condition 1 then system.out.println(one in); //populate a list system.out.println(one out); end rule two salience -2 when eval(foo(pass the list that we populated in the above rule)) then system.out.println(two in); //do some action system.out.println(two out); end O/P we are getting: - foo one in foo foo one out two in two out Expected O/P one in one out foo two in two out Please suggest a way to do the same. Regards, Sam -- View this message in context: http://drools.46999.n3.nabble.com/Calling-a-function-from-When-part-tp4018987p4019007.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] How to iterate over a given rule multiple times
Hi All, I have a specific requirement where in, i have my rules file as follows rule one when //some condition then //fire a particular query retrieve the count of records for a filter condition //Then populate it to some fact property using modify() end rule two when //check if the count of records is, say 100 after, the above modify statement then //any further action end Now the problem is, I want to execute rule one again and again until rule two is satisfied. Two probable solutions I can think of is: - 1. Put some condition in rule one, so that ruleone is true until rule two condition is satisfied. But that has a problem, ruleone will still fire even if rule two gets satisfied. 2. Other is, have some kind of third rule that will call rule one, when ruletwo is not satisfied. Please provide your valuable inputs. Thanks in advance. Regards, Sam -- View this message in context: http://drools.46999.n3.nabble.com/How-to-iterate-over-a-given-rule-multiple-times-tp4018974.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