Strange intermittent problem with Drools Flow
by Dan Nathanson
Hi,
I'm seeing some odd behavior in some of my test cases. And it only
seems to happen to one guy. And he's done fresh checkouts of the code,
blown away his local M2 repository and verified installed software
like OS and Java is same as everyone else's.
I have some test cases that build up some simple flows programatically
using fluent API. Very simple (start --> work item --> work item -->
state --> end). I am using Drools Flow 5.1.1 with JPA (in-memory H2
DB for unit tests). Intermittently, after completing a work item, the
flow doesn't continue. Logging in a process event listener shows that
the the work item node is never left, although I can see in the logs
that the work item is deleted from DB.
There are no errors, warning or info level messages coming out of
Drools or Hibernate prior to the failure.
It only happens to one guy, but he can reproduce the problem
regularly, although it moves around in different test cases and
different points in the flows.
Anyone ever seen this behavior before? Any possible explanations?
I'd attach the log file, but it is huge since I've got hibernate
logging set very verbose.
Regards,
Dan Nathanson
15 years, 1 month
First Order Logic - METHODS in Drools
by Arjun Dhar
According to First order Logic, (from a rule perspective), one can represent
their statements using:
PREDICATES, METHODS, CONNECTORS (including existential quantifiers)
..while PREDICATES can be synonymous with Object and Object expressions; the
only way of using methods has been via "eval" (AFAIK, as per my outdated
knowledge); and this is discouraged for the fact that evals perhaps dont fit
in the RETE-OO scheme of things.
Please note: By methods I dont bean Bean getter/setters; but work horse
service layer methods.
..however, to be true to FOL, using methods directly should be supported.
Q1) If it is, can one show or state an example?
Q2) If not, for METHODS that return a specific type of Object, cant they be
useful in RETE-OO evaluation?
Q3) I've used "from" for DAO's , conceptually does "from" address this
fully? In FOL (imo) PREDICATES & METHODS can be exchanged freely, not sure
if "from" gives that freedom.
thanks
--
View this message in context: http://drools.46999.n3.nabble.com/First-Order-Logic-METHODS-in-Drools-tp2...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 1 month
Fw: Some Querries on Drools
by Sumeet Karawal
Hi Everybody,
I had posted this earlier. It would be very greatful if anybody could help
me on these queries, any suggestions or any document that I can refer to.
Thanks and Regards,
Sumeet Karawal
Mailto: sumeet.karawal(a)tcs.com
From: Sumeet Karawal/MUM/TCS
To: rules-users(a)lists.jboss.org
Date: 04/18/2011 06:58 PM
Subject: Some Querries on Drools
Hello All,
I have some queries regarding use of drools as rule engine for my
Application. It would be very helpful if I get some guidance regarding
these:
1) I have an application in which a user logs in, and according to his
profile he is provided with some benefits, and rule engine check for the
eligibility criteria. But if hundreds of thousands of user will log in at
same time, then what will be the performance accordingly. Like, these
concurrent users hitting the server, and so many threads will be generated
and many number of rules will be fired in the session. Will this hamper the
performance of Rule Engine.
2) Suppose I have an application using drools. I create EAR / WAR file of
that application and deploy it on some other system. Would it be still
possible for me to change the rules on the fly. Or some dependencies might
have to be managed.
3) How can we manage sessions in drools? Suppose we are having different
stateful sessions in our application, but time consumption when we
fireAllRules() exceeds the expected time. So is there a mechanism to kill,
restart the session in drools. Could I get some help/document regarding
session Management on drools.
Thanks & Regards,
Sumeet Karawal
Mailto: sumeet.karawal(a)tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
15 years, 1 month
How to use for loop in drools!!!!
by Sumeet Karawal
Hello Everybody,
I am not getting, on how to do for loop functionality in drools.
Like for instance, my functionality has :
for(i = 0; i<10; i++)
{
c.setCustomerCount(c.getCustomerCount() + 1);
}
How to translate this code into rule language (.drl).
It would be helpful if anybody could guide me on this.
Thanks and Regards,
Sumeet Karawal
Mailto: sumeet.karawal(a)tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
15 years, 1 month
Trying to compare int and String objects
by Manuel Ortiz
Hello everybody:
I'm trying to write rules in which fact int attributes and fact String
attributes should be compared in condition elements. When I compare them,
let's say from int to String,
rule
when
Fact1($intAttr : attrInt1)
Fact2(attrString == $intAttr)
....
the rule seems to behave OK, whereas when I compare them from String to int,
rule
when
Fact1($stringAttr : attrString1)
Fact2(attrInt == $stringAttr)
....
I get a RuntimeDroolsException( "Conversion to long not supported from
java.lang.String").
I've taken a look at the code which throws the exception,
BaseObjectClassField.getLongValue() and found that it only accepts Number
and Date objects to be converted to long.
...
if ( value instanceof Number ) {
return ((Number) value).longValue();
} else if ( value instanceof Date ) {
return ((Date) value).getTime();
}
...
Is it possible to add String to long conversion via Long.parseLong(str) or
is there any reason not to allow this conversion?.
Thank you again for your time.
Best regards,
Manuel Ortiz.
15 years, 1 month
calling static error function....thread safe?
by marunam
Hello,
I am calling static "error" function in ValidationHelper class from drool
rules. My rules are going to be executed in spring based web application. Is
this call to an "error" function thread safe?
public class ValidationHelper {
public static void error (RuleContext kcontext, Object... context) {
KnowledgeRuntime knowledgeRuntime = drools.getKnowledgeRuntime();
ValidationReport validationReport = (ValidationReport)
knowledgeRuntime
.getGlobal(ValidationConstants.VALIDATION_REPORT_GLOBAL);
ReportFactory reportFactory = (ReportFactory)
knowledgeRuntime
.getGlobal(ValidationConstants.REPORT_FACTORY_GLOBAL);
validationReport.addMessage(reportFactory.createMessage(
Message.Type.ERROR, messageKey, context));
}
}
import org.drools.runtime.rule.RuleContext;
import function ValidationHelper.error;
...
rule test
when
#condition
then
error(drools)
Please advise
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/calling-static-error-function-thread-sa...
Sent from the Drools: User forum mailing list archive at Nabble.com.
15 years, 1 month