4.x to 5.1.0 Rule migration issue
by Kumar Pandey
Hi
I've inherited some old code running under 4.x of Drools. I'm investigating
use of 5.1.0 for newer development.
I was testing the old code base as is with drools 5.1.0 and got some
compilation issues on the DRL. Here is the sample drl snippet
package com.test.rule
import ...
rule "EmailVerificationCheck"
salience 500
when
context : RuleContext (paymentMethod == "P_EXPRESS")
eval (!context.isTrustedUser())
act : RuleAction (action == null || == "VERIFY")
then
if (act.getAction() == null) {
if(!context.isPEmailVerified()) {
act.setAction ("VERIFY");
}
}
if (act.getAction() == "VERIFY") {
if(!context.isPEmailVerified()) {
act.getRuleNames().add("PEmailVerificationCheck");
}
}
end
Compilation error is at eval (!context.isTrustedUser()) and the error
message is as follows -
org.drools.rule.InvalidRulePackage: Unable to generate rule invoker. :
org.drools.lang.descr.EvalDescr@1f8b158
com/playspan/rule/Rule_PayPal_EmailVerificationCheck_0Eval0Invoker.java
(16:48) : Redefinition of local variable "context"
at org.drools.rule.Package.checkValidity(Package.java:477)
~[drools-core-5.1.0.jar:5.1.0]
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:479)
~[drools-core-5.1.0.jar:5.1.0]
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:445)
~[drools-core-5.1.0.jar:5.1.0]
at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:452)
~[drools-core-5.1.0.jar:5.1.0]
at com.playspan.rule.RuleEngine.buildRuleBase(RuleEngine.java:374)
[classes/:na]
at com.playspan.rule.RuleEngine.initializeRuleSession(RuleEngine.java:384)
[classes/:na]
It is using java dialect and JANINO compiler.
I would really appreciate if some could point me to a direction for
troubleshooting this issue.
Is this construct invalid for 5.x onwards?
Thanks
Kumar
15 years, 7 months
Re: [rules-users] Multi threaded rule engine question.
by Greg Barton
I wouldn't reuse a stateless session. You could reuse a stateful session and clean up between runs, but session creation is not that expensive. (and easily less expensive than cleanup of a stateful session, mattering on the complexity of your rules)
GreG
On Sep 27, 2010, at 8:39, Nadav Hashimshony <nadavh(a)gmail.com> wrote:
My rule engine server is multi threaded.
in the server main i build a knowledgebase:
KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(droolsConf, null);
KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(config);
builder.add(ResourceFactory.newFileResource("path to drools pkg", ResourceType.PKG);
KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages());
i have 10 threads that have the following code:
thread run method:
as long as a Vector has data do:
1. StatelessKnowledgeSession droolsSession= m_droolsKagent.getKnowledgeBase().newStatelessKnowledgeSession();
2. get data object from a vector
3. create fact model from data
4. droolsSession.insert(facts);
5. droolsSession.fireAllRules();
6. do stuff with the response
7.droosSession.dispose
8.get next object from vector.
Questions:
1. should i create each time the droolsSession? or can i resuse the same one, meaning can i create it in the Thread's constractor?
Thanks
Nadav.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
15 years, 7 months
Help require for "web actor" related task
by Ashish.zokarkar
Hello,
I am newbie for Drools flow. I am trying to build work flow in which
according to condition I have to ask either person properties or user
properties.
I am trying to embed it in web project. So I created 3 jsps.
1. Ask information about User or Product.
2. According to selection shows different options.
3. Display all the properties.
What I am trying is, remove all the forwards from jsp and put them in
workflow so that its easily supportable for new object as well.
I think I should use "Human Task" where I am taking user input.
Now i have below questions:
1. I am trying to use "Human Task". But I can see it supports only Web
Service Human task. Is it true???
2. How can I use "Human Task" in this situation? In examples, I can see, I
require EntityManagerFactory, mina Task which should run on some port. Is
these steps really necessary???
3. I am trying really simple POC where I require kind of web actor which
should wait till user click on "Submit" button and then proceed to next
step. Is any similar kind of support Drools have?? If yes how can i use it??
Small code snippets or doc link will be very helpful...
Thank you very much in advance..
Ashish Zokarkar
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Help-require-for-web-...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
Drools Eclipse IDE Update Site 3.5
by Brian Trezise
I'm not sure why, but when I try to get eclipse to download the
eclipse IDE from the drools update site as listed on the webpage,
Eclipse isn't seeing anything there. If i go to the link in Chrome I
get an error stating that the browser couldn't display the page; firefox
shows a list of three files. I'm trying to download the latest IDE
plugin from http://downloads.jboss.com/drools/updatesite3.5/
~Brian
15 years, 7 months
Can I have 2 different instance of Guvnor to use same SQL server DB?
by bbarani
Hi,
I have a Guvnor instance (instance 1) running in tomcat and its using SQL
server 2005 as its backend.
Now I am planning to have one more instance of Guvnor (instance 2) running
from another application server but want to point it to same SQL server
(configured for instance 1)
I just made changes to the persistance manager properties file and I was
able to view the package names listed in the new instance but I am not able
to view all the rules present in those package from instance 2.
Is there any other path related config changes that needs to be done when
using the same data for 2 different Guvnor instance?
Thanks,
BB
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Can-I-have-2-differen...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 7 months
iisue with Operator 'Operator = '>'' does not exist for StringEvaluator
by Ganesh Krishnan
Hi
I'm facing some issue with DRools . Could you help me to solve the issue.
The Error : Exception in thread "main" java.lang.RuntimeException: Operator 'Operator = '>'' does not exist for StringEvaluator
I'm using Drools 1.4 version and i'm having the following jars in my classpath.
ant-1.6.5.jar core-3.2.3.v_686_R32x.jar drools-compiler-4.0.7.jar
antlr-runtime-3.0.jar drools-analytics-4.0.7.jar drools-core-4.0.7.jar
ant-nodeps-1.6.5.jar drools-ant-4.0.7.jar drools-decisiontables-4.0.7.jar
drools-jsr94-4.0.7.jar janino-2.5.10.jar jsr94-1.1.jar
mvel-1.3.1-java1.4.jar
Please check the detail error deatils
Exception in thread "main" java.lang.RuntimeException: Operator 'Operator = '>'' does not exist for StringEvaluator.
at org.drools.base.evaluators.StringFactory.getEvaluator(StringFactory.java:70)
at org.drools.base.ValueType.getEvaluator(ValueType.java:166)
at org.drools.rule.builder.PatternBuilder.getEvaluator(PatternBuilder.java:900)
at org.drools.rule.builder.PatternBuilder.buildRestriction(PatternBuilder.java:714)
at org.drools.rule.builder.PatternBuilder.buildRestriction(PatternBuilder.java:625)
at org.drools.rule.builder.PatternBuilder.createRestriction(PatternBuilder.java:434)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:308)
at org.drools.rule.builder.PatternBuilder.buildConstraint(PatternBuilder.java:199)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:168)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:93)
at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:69)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:53)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
at com.starwood.saratoga.scripting.poc.SaratogaApp.buildRuleBase(SaratogaApp.java:34)
at com.starwood.saratoga.scripting.poc.SaratogaApp.scriptGenerator(SaratogaApp.java:133)
at com.starwood.saratoga.scripting.poc.SaratogaApp.main(SaratogaApp.java:204)
To resolve this issue please suggest what are the jar's i supposed to use.
Thanks & regards
Ganesh K
15 years, 7 months
Parallel Processing(multiple threads) in Drools Flow
by Prafull Kumar
Hi All,
We are evaluating Drools flow and looking for the parallel processing (multiple
threads) of few activities in the flow.
Could you please confirm if this is already supported for there are any plans
for this functionality.
Note : (I tried the Gateway[diverge] but it runs in the single thread and not in
the different threads.)
Thanks a lot in advance!
Regards, Prafull
15 years, 7 months
Guvnor: rule fire counts don't match when running modified test scenario
by Scott Mayne
I'm still going through Paul Browne's "JBoss Drools Business Rules" and am using test scenarios now.
What I've noticed is the activation counts displayed on different parts of the screen don't match. As per the book, I originally had a value for "sales" that would fire the rule 11 times, then changed the rule to have "no-loop true". Re-running the test gives the correct 1 activation at the top, but in 2 other places the old 11 count is still displayed.
I also noticed this behavior when changing the test scenario value of "sales" - for example, I'd start with a value that would fire 3 times, then change it to one that would fire 11 times. In the second case, 11 would correctly show at the top, but 3 would incorrectly display in 2 places lower down.
15 years, 7 months