Rule firing issue in Drools 5.1.1...
by prashant.badhe
Hi,
Following are details of our configurations for Drools:
1. Drools v 5.1.1
2. Drools statefull kSession is initialized using Spring framework
3. We are using Resource scanner through change-set.xml. Scan interval is
set as 1 second. drools.Clocktype=realtime. drools.agent.newInstance=false.
4. There are about 8 DRL resources in the repository folder that resource
scanner scans.
5. Each DRL file has multiple rules. Within each DRL file, I am using same
aganda-group.
Issue:
After web server startup, it is observed that rules from some of the DRL
files fires. But, rules from 1 DRL file DO NOT fire at all.
There are no compilation errors/warnings appearing in log files after web
server startup.
If I remove this DRL file from repository (this is the location which
resource scanner scans) and copy it again after say 2-3 seconds, then the
rules from this file starts firing when appropriate facts are introduced in
WM.
Earlier I was using fireUntilHalt() to trigger rules, but now I am issuing
fireAllRules(). This was changed as I observed a 100% CPU consumption issue
when fireUntilHalt() even when the application is in idle state. See
"http://drools.46999.n3.nabble.com/fireUntilHalt-is-doing-busy-wait-and-co..."
I am using resource scanner feature to dynamically add/remove DRL files
without requiring restart of web server on production servers.
Does anybody faced similar issue in Drools 5.1.1 final?
Does resource scanner requires re-initialization of kSession after
add/update of DRL file in repository folder?
Thanks in advance,
Prashant Badhe
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-firing-issue-in-Drools-5-1-1-tp388...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 3 months
Multi Access to Stateful Session
by gboro54
I have a stateful session which is having objects inserted and updated from
multiple threads. The thread managing the session is using the fireUntilHalt
method as below:
@Override
public void run() {
if (logger.isDebugEnabled()) {
logger.debug("Starting session...");
}
threadName = Thread.currentThread().getName();
session.fireUntilHalt();
}
The code being invoked to insert/modify objects is below:
public synchronized void insertOrUpdate(Object fact) {
Preconditions.checkNotNull(fact);
FactHandle factHandle = session.getFactHandle(fact);
if (factHandle == null) {
session.insert(fact);
} else {
session.update(factHandle, fact);
}
}
The problem I am running into is that I have a control fact which keeps an
internal counter(messages coming in are sequenced and need to be processed
in order) and a list of "deregister messages"(messages that are not going
to be inserted for various reasons). The problem I am having is that 75% of
the time it seems something goes wrong with the counter and messages stop
being processed and build up in the session. If i pass every message in and
don't try and deregister any everything works ok. The rules I have for
working with the message deregister is as follows(this is a an example there
are will be other rules added eventually):
rule "Dereg Message"
salience 10000
when
$controller:MessageControl($pos:currentPosition,excludedPositions[$pos]!=null)
then
modify( $controller ){
moveCurrentPositionForward(1)
}
end
rule "Remove Message"
salience -15000
when
$controller:MessageControl($pos:currentPosition,excludedPositions[$pos]==null)
$tsc:Message(rank==$pos)
then
cdiEvent.fire(new CDIEvent($tsc));
retract($tsc);
modify( $controller ){
moveCurrentPositionForward(1)
}
end
The controller class is:
private BigInteger currentPosition = new BigInteger("0");
private Map<BigInteger, BigInteger> excludedPositions = new
ConcurrentHashMap<BigInteger, BigInteger>();
public synchronized void addPositionToExclusionList(BigInteger position) {
excludedPositions.put(position, position);
}
public synchronized BigInteger getCurrentPosition() {
return currentPosition;
}
public synchronized void moveCurrentPositionForward(Integer value) {
currentPosition = currentPosition.add(new BigInteger(value.toString()));
}
public synchronized Map<BigInteger, BigInteger> getExcludedPositions() {
return excludedPositions;
}
public synchronized Collection<BigInteger> getExclusionList() {
return excludedPositions.values();
}
Any thoughts to why this may be occuring? I have been banging my head on
this problem for a couple days. We are using drools 5.3
--
View this message in context: http://drools.46999.n3.nabble.com/Multi-Access-to-Stateful-Session-tp3877...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 3 months
Drools performance
by Hassan
Hi everyone,
In one of my tests, I inserted 1000000 objects into the working memory,
drools engine made a lot of time to execute the program and it throws
Exception : "java.lang.OutOfMemoryError !!
Please if someone could help me to improve drools performance and specially
reduce the drools execution time
thanks
-----
Youssef AZBAKH.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-performance-tp3870569p3870569.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 3 months
Rules Deployment Issue
by srinivas gullapalli
Hi,
We have a rule deployment directory where we can deploy the
rules.Currently we have written a new rule and deploying to the same to the
deployment directory.
what i observed is when i deploy the rule for the first time and passing
the corresponding data to fire the rule, the rule is not getting fired.If
copy the same file to some other
temporary directory and removing the same from current directory.Finally i
am copying the same file from the temporary directory(to which i copied
before removing the file) to our deployment directory then the rule is
getting fired as expected .
Could you please provide any pointers to resolve the issue.
we are uing 5.1.1 version of drools.
Regards,
Srinivas
14 years, 3 months
Inconsistent rule firing on a boolean field.
by Creighton Kirkendall
I have two rules below; the first fails to fire for all values of photo
(photo is a boolean field). The second rule give the correct behavior when
photo is true and false. I am new to drools and could be wrong but this
feels like a bug. Can anyone give me a reason for this behavior.
*BAD RULE:*
# rule values at C137, header at C132
rule "Photochromatic_137"
when
RxOrderType(product[0].lens.material.photo == true,
product[0].lens.design.lensType=="SV")
then
addResult("e1",results);
System.out.println("Single Vision-Photo");
end
*GOOD RULE (notice the - true &&):*
# rule values at C137, header at C132
rule "Photochromatic_137"
when
RxOrderType(true && product[0].lens.material.photo == true,
product[0].lens.design.lensType=="SV")
then
addResult("e1",results);
System.out.println("Single Vision-Photo");
end
Creighton Kirkendall
14 years, 3 months
parametrized rules
by Tim van Heugten
Hi all,
I'm new to Drools, and wonder how I can most cleanly write down rules for
the following.
(For the sake of example) Say I have an object that needs to be processed
season-dependent. I basically need a rule like:
rule
when
Date( month == X, day >= Y, day <= Z)
// Some date containing object
then
System.out.println("Season is "+R)
// Store season in associated object
end
And fill in X, Y, Z and R with:
X Y Z R
1 1 31 Winter
2 1 29 Winter
3 1 21 Winter
3 22 31 Spring
4 1 30 Spring
5 1 31 Spring
6 1 21 Spring
6 22 30 Summer
7 1 31 Summer
...
Should I expand all this rules by hand, and define 16 rules in my rule
file? Or can I parametrize the rules and have this done automagically?
Thanks a lot,
Tim van Heugten
14 years, 3 months
drl problem
by arup
Hi,
i'm having some problems(more like i'm just getting confused) while creating
a rule for my project.
I have 2 classes say Phone() and PhoneTC() like below:
Phone()
{
String number;
}
PhoneTC()
{
String tc;
}
also PhoneTC() is inside the Phone() class. like:
Phone()--String number
PhoneTC()--------String tc
now i need to create a rule like this....
when phone numbers are same and the tc values are different for that number
then do something.
will this work??
when
ph1: Phone(number1 : number)
phtc1: PhoneTC(tc1 : tc)
Phone(number == number1) and PhoneTC(tc != tc1)
then
........
can u suggest better rule for the requirement??.... thanks in advance... :)
:) :)
--
View this message in context: http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877814.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 3 months
ontologies
by Olfa h
hello,
how I can create ontologies with Drools ?
thx
14 years, 3 months