Time to Scale some Drools
by tolitius
1. What are the options to scale?
If many rule requests are coming from different nodes ( server nodes ) OR
many rule requests are coming from the same node, but with a very high
frequency: WHAT ARE THE BEST PRACTICE(S) to:
Create
Expose
Access
All the knowledge artifacts? ( KnowledgeBase, Session, etc... )
Guvnor is not production ready, hence I am looking for ways / best practices
with production ready components.
2. I understand that "session creation is very light", but how light? We
have certain SLAs in milliseconds for the whole "request / response" travel,
which would include throwing facts into the engine and getting results.
3. Seems like caching a KnowlegeBase ( e.g. GemFire, Terracotta, etc.. )
across nodes would be one way to go, what are others?
Thank you,
/Anatoly
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Time-to-Scale-some-Dr...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 5 months
Query on loading facts dynamically
by jobin wilson
Hello List,
I have a very basic question about inserting facts into the working memory
dynamically.For firing the rules,we should be having all our facts in the
working memory.In that case,How will we deal with the situation where the
facts that we need for evaluation of a particular rule is dependent on the
rule itself (needs to be brought it dynamically)?
Say for example say i want to use rule engine to reward all students with
average scores for all subjects > 75 for the past 3 exams.
The facts that i have are the Student objects & their Subject wise
scores(one to many relation;one student to many exams & each exams having
many subjects).
I want the "when" condition to be satisfied for all students whose average
scores for all subjects for the past 3 exams to be greater than 75
and the consequence to be to just print out the name of the student.
In this case,should i be loading all the student objects & each of their
past exam scores in the whole system to find student objects satisfying this
critera?
Since i already know that the rule just need the average scores for just the
past 3 exams for each student,wouldn't loading the whole facts be
inefficient?
Is there a way in which i can specify somehow how much of the facts needs to
be loaded before firing the rule based on the rule itself?
i mean a rule which is aware of the quantity of the facts on which it needs
to work on(considering loading 3 facts versus 100 facts)?
Thanks a lot in advance for all your inputs and suggestions on this.
Thanks & Regards
Jobin Wilson
14 years, 5 months
Rule Compilation Problems
by Jean-Philippe Steinmetz
Hello everyone,
I'm fairly new to Drools, having only worked with a basic setup for a
little while now. I've successfully gotten a Drools 5.0.1 runtime
working with an app running under JBoss 5 but now I need Drools to run
under a standalone application. I've more or less copied all of the set
up that I used in the JBoss app but am experiencing weird compilation
problems.
My application code looks like the following...
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("MyAgenda");
kagent.applyChangeSet(ResourceFactory.newClassPathResource("my_rules.xml
"));
KnowledgeBase kbase = kagent.getKnowledgeBase();
final StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
ksession.addEventListener(new DebugAgendaEventListener());
ksession.addEventListener(new DebugWorkingMemoryEventListener());
KnowledgeRuntimeLogger krlogger =
KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
ksession.insert(myObject);
ksession.fireAllRules();
krlogger.close();
ksession.dispose();
and my rules file looks like...
package mypackage
rule "test"
when
Object()
then
System.out.println("Hello World!");
end
Finally this is the output I am seeing from my application...
[2010:06:180 18:06:144:info] ResourceChangeNotification created
[2010:06:180 18:06:147:info] ResourceChangeScanner created with default
interval=60
[2010:06:180 18:06:147:debug] ResourceChangeNotification monitor added
monitor=org.drools.io.impl.ResourceChangeScannerImpl@7d0b8078
[2010:06:180 18:06:149:info] KnowledgAgent created, with configuration:
monitorChangeSetEvents=true scanResources=true scanDirectories=true
[2010:06:180 18:06:149:info] KnowledegAgent has started listening for
ChangeSet notifications
(null: 3, 78): SchemaLocation: schemaLocation value =
'http://drools.org/drools-5.0/change-set.xsd' must have even number of
URI's.
(null: 3, 78): cvc-elt.1: Cannot find the declaration of element
'change-set'.
[2010:06:180 18:06:181:info] KnowledgAgent applying ChangeSet
[2010:06:180 18:06:182:debug] KnowledgeAgent subscribing to
resource=[ClassPathResource path='TestRules.drl']
[2010:06:180 18:06:182:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@61176350 to
resource=[ClassPath
Resource path='TestRules.drl']
[2010:06:180 18:06:185:debug] ResourceChangeScanner subcribing
notifier=org.drools.io.impl.ResourceChangeNotifierImpl@46794afc to
resource=[ClassPathR
esource path='TestRules.drl']
[2010:06:180 18:06:187:debug] KnowledgeAgent ChangeSet requires
KnowledgeBuilder
[2010:06:180 18:06:187:debug] KnowledgeAgent rebuilding KnowledgeBase
using ChangeSet
[2010:06:180 18:06:315:debug] KnowledgeAgent building
resource=[ClassPathResource path='TestRules.drl']
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/e
clipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(Ecli
pseJavaCompiler.java:321)
at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJava
Compiler.java:351)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJa
vaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.
java:389)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompile
timeRegistry.java:56)
at
org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java
:290)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:488)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:25)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgent
Impl.java:386)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentIm
pl.java:120)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentIm
pl.java:109)
Now I've checked all of the maven dependencies to make sure the they are
all there and I can doubly confirm everything is fine. In fact, I even
went so far to make sure the jars included in my app contained the
org.eclipse.jdt.core.compiler.CategorizedProblem.class file. The only
difference I've been able to think of so far is that my standalone
application uses the Java service wrapper where JBoss does not.
Any help is greatly appreciated.
Cheers,
Jean-Philippe Steinmetz
14 years, 5 months
How can I use retract in action or exception handler?
by EugeneP
Good afternoon
How can I use retract in action or exception handler?
For example,
0. I have a flow diagram;
1. in some node the fact Person( age == 10) is added to the working memory
by 'insert';
2. after some steps, the split node pass the control to the action-node
3. and in this action I need to retract this fact. How?!
The action MVEL code like:
$t : Person( age==10)
retract($t)
- does not work b/c of knowledge base errors:
"Could not parse knowledge... "
"Unable to build expression for action... "
"java.lang.Class cannot be cast to org.mvel2.util.MethodStub :
org.drools.lang.descr.ProcessDescr@fa54fe"
Thanks,
Eugene P
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-can-I-use-retract...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 5 months
"Not exists" on at least one element from the set
by LeoIo
Hi,
I am desperately trying to figure out how to express the following:
Having a set of object names, say (a,b,c) I want to write a rule firing when
there are no objects in working memory with name equals to at least one name
from the set.
In other words I want to say: fire if there are no objects with name 'a', or
no objects with name 'b' or no objects with name 'c'.
The rule "not Object(name in('a', 'b', 'c'))" only fires if none of the
objects exist.
What I need is different though.
Any help greatly appreciated.
Thanks a lot.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Not-exists-on-at-leas...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 5 months
Request for help to execute rule using drools5.0 from excel file
by Sanjib Karmakar
Hi
I am new in drools and in my project I would like to access rules in excel
file using drools 5.0
Please provide me the source code for how to access the rules in excel file.
I have done the following code
KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
DecisionTableConfiguration dtconf =
KnowledgeBuilderFactory.newDecisionTableConfiguration();
dtconf.setInputType( DecisionTableInputType.XLS );
dtconf.setWorksheetName("Tables");
kBuilder.add(ResourceFactory.newFileResource("TeamAllocationExample.xls"),
ResourceType.DTABLE, dtconf);
KnowledgeBuilderErrors errors = kBuilder.getErrors();
if (errors.size() > 0)
{
for (KnowledgeBuilderError error: errors) {
System.out.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kBuilder.getKnowledgePackages());
return kbase;
I am using the 'TeamAllocationExample.xls' - which is the default example I
found searching in net.
Here LHS and RHS portions are given - I would like to know how could I
execute the rule and get the result what is given under 'ACTION' column?
Please help me.
Thanks in advance
Sanjib
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Request-for-help-to-e...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 5 months
Regarding a fact model in Guvnor
by shekharputtur puttur
Hi ALL,
I have created a dynamic fact model in guvnor for creating rules.I want to
use the same fact model in my java application too.
How do i create a jar for the created model in guvnor and download the same?
Another way is to create a fact model in java(eclipse editor), and we can
upload the same for writing rules.
But for my application , i need to use the first approach.
i use guvnor 5.1.0M1.
Could you please tell me solution to do this?
Thanks & Regards
Shekhar
14 years, 5 months
Re: [rules-users] Drools Rule Engine - Tiered Rates
by Greg Barton
You can also try a data driven approach:
declare Rate
minUnits : int
maxUnits : int
revenuePercent : int
end
declare Sale
units : int
end
rule "FindRate"
when
r : Rate( )
s : Sale( units > r.minUnits, units < r.maxUnits )
then
System.out.println( "revenuePercent for " + s + " is " + r.getRevenuePercent());
end
Sample code attached.
--- On Wed, 6/9/10, Esteban Aliverti <esteban.aliverti(a)gmail.com> wrote:
From: Esteban Aliverti <esteban.aliverti(a)gmail.com>
Subject: Re: [rules-users] Drools Rule Engine - Tiered Rates
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Date: Wednesday, June 9, 2010, 7:45 AM
Did you take a look at drools-template?http://hudson.jboss.org/hudson/job/drools/lastSuccessfulB...
Best,
On Wed, Jun 9, 2010 at 9:24 AM, ramram <ramram858(a)gmail.com> wrote:
Hi All,
I have the following question regarding Drools. The possibility to
implement tiered rates and that is I have the following example.
If the total units sold is between 0 - 1000 item a revenue return is 10%
while if the total units sold is between 1001- 2000 items the return is 20%.
I want to use 1 dynamic rule to implement the above example rather than
having 2 static rules defined? is this possible through drools?
Regards
Ram
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Rule-Engine-Ti...
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
-----Inline Attachment Follows-----
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
14 years, 5 months
Creating DSL rules in guvnor - Object mapping issues
by Fnu Mahalakshmi
hi,
I am wanting to use a particular feature while creating my DSLs using enums. Is it possible???
what i want to do is :
[when]When the credit rating is {rating:ENUM:Applicant.creditRating} = applicant:Applicant(creditRating=="{rating}")
[then]Approve the loan = applicant.setApproved(true)
I want the option to be either an Applicant or an Employee [both are different fact models)
So is it possible to do a mapping using Enums for the 2 object types : Applicant / Employee ???
Please Help
M
</pre>
<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>
*****************************************************************************
<br>
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.
</STRONG></P><pre>
14 years, 5 months