Issue with Rule X1 extends X2
by arul.prashanth@gmail.com
When two rules recide within a same drl extends works as expected.
rule "Base_Rule|1.1.2"
enabled false
when
$bdy : BDY()
Vehicles()
then
System.out.println(" >>>> 222 "+$bdy);
end
rule "TX_Rule|1.1.2" extends "Base_Rule|1.1.2"
when
then
System.out.println(" >>>> TX 222 "+$bdy);
end
When the super rule recides in a different DRL and child rule in a different
DRL the parent rule is not fired
rule "TX_Rule|1.1.1" extends "Base_Rule|1.1.0"
when
BDY();
then
System.out.println(" >>>> TX 111 "+$bdy);
end
Any thoughts ??
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-with-Rule-X1-extends-X2-tp4023114...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Drools JPA Example
by Charles Moulliard
Hi,
I'm looking for a Drools JPA example. As the Drools Community Project does
not contain such example I contact the community to figure out if such
example exist and is available in a git repo
Regards,
--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
11 years, 9 months
Working memory - database synchronisation approach
by riri
Hello everyone,
I am currently working on a Spring, Hibernate, Bitronix project and am
trying to integrate Drools functionality. I have a set of JPA Entities that
I can manage using Spring Data and Hibernate and I would like to use these
entities as facts inside a StatefulKnowledgeSession. As I understand it, I
need to have some mechanism of keeping the facts inside the working memory
in sync with the database and what I mean by that is:
1. update the facts in working memory when they are changed from outside
2. update the facts in the database when a RHS part of a rule changes
properties
This article http://www.ibm.com/developerworks/java/library/j-drools5/
<http://www.ibm.com/developerworks/java/library/j-drools5/> gives some
pointers on how to achieve 1. using AOP but in my case I do not have a
global knowledge session to insert, I need to be able to create a knowledge
base for each user of the application since each user will need to have his
own set of rules independent from other users.
What would be the best practices for achieving the synchronisation?
Currently for 1. I am updating the fact manually by retrieving the object
and calling update from java code. For 2. I have a
WorkingMemoryEventListener that is configured as a Spring @Component with
autowired services that can perform CRUD actions on entities and which are
called on objectUpdated.
I am new to all these technologies so I do not know if this is a good way to
go. I have a unit test where a rule modifies a property and the object is
updated in the database but if the Thread with the fireUntilHalt method is
not paused, the test finishes and the JTA manager is shut down before the
rules can fire and the transaction in the objectUpdated can be executed.
I would be very grateful for any insight from the more experienced users
that have come across such requirements before.
Best regards
--
View this message in context: http://drools.46999.n3.nabble.com/Working-memory-database-synchronisation...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Re: [rules-users] Upload POJO model, no facts are imported
by rjr201
When you upload the Jar file you have to then go to 'File'->'Save' and check
it in. If the objects still don't appear, try going to the edit tab on the
package and looking at the list under "Configuration: Imported types". If
there is nothing in this list, click on the green cross and see if you can
add your objects from there. If you can't then there is probably something
wrong with the Jar file you've uploaded. Make sure that's it's a non
compressed jar file, this has caused me problems in the past.
Hope that helps,
Rich.
--
View this message in context: http://drools.46999.n3.nabble.com/Upload-POJO-model-no-facts-are-imported...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Re: [rules-users] Importing existing drl into Guvnor
by droolist
"I have some requirement of building specific rules from same package , Can
we achieve this by maintaining guvnor repository from external RDBMS ?"
When you say build, I assume you mean packaging. Yes, Guvnor provides
selectors - built in selector using status and categories. And there is
custom selector where you can provide your selection logic.
"how can we achieve this requirement of firing specific rules under specific
conditions when I am using guvnor for managing rules"
Besides salience and agenda-group as mentioned by Abhinay, take a look at
AgendaFilters. You can use some custom metadata and use that in your custom
AgendaFitler to accept firing of certain rules.
--
View this message in context: http://drools.46999.n3.nabble.com/Importing-existing-drl-into-Guvnor-tp40...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 9 months
Issue with parallel StatelessKnowledgeSession
by Marc Mährländer
Hi,
I just tested the performance of Drools Expert for a scenario with a
number of Knowledbases most of them in sequential mode. I experienced
a strange behaviour when executing separated
StatelessKnowledgeSessions in parallel within different threads. In my
testcase, a queue is filled with 20 work items, each containing
indentical data objects approx. 10.000 objects. Consumers are taking
the work items from the queue and executing twelve
StatelessKnowledgeSessions with that input data in a row. The
Knowledgebases for each Thread are created independently. So the
different Threads do not share the same KnowledgeBase (but the
knowledge is created from the same drl files) nor do they share the
same input objects. (but the objects are created from one template as
deep copies).
I'm running on windows with a quad intel i7 cpu. When performing the
test with only one Thread, I need around 31s to empty the queue. When
starting the test with two consumer Threads I would expect the queue
to be emptied within nearly half of the time. But instead, it takes
28s, so only saving 2 seconds. So I start the same test in two
separated processes (virtual machines). I then get a calculated time
of around 17 second to process the 20 work items. So this is more or
less what I would expect.
I have the feeling, that there is some kind of synchronization between
two StatelessKnowledgeSessions, even if they are created independently
from each other. Observing the processes with VirtualVM in sample mode
shows method DefaultAgenda.notifyHalt() on top. That method is
synchronized, but on a local member which should normally not be a
problem
I'm using Drools Version 5.5.0 Final with Oracle JDK 7. There are
several hundert rules within the .drl files. Consumer threads are
created like this:
for (int i=0;i<consumerCount;i++)
{
GroupConsumer consumer = new
GroupConsumer((List<KnowledgeBase>)deepCopy(buildKnowledge()),queue,
"Consumer"+i);
consumers.add(consumer);
}
This is the code to execute the Sessions (Sessions are currently
cached within implementation of the consumers, but creating new
session for every work item does not change behaviour)
for (StatelessKnowledgeSession ksession : sessions)
{
long t1 = System.nanoTime();
ksession.setGlobal("annual_sales", 200000.0);
ksession.setGlobal("annual_assets", 10000000.0);
ksession.setGlobal("FLAG_31_4_INSTITUTE",1);
ksession.setGlobal("RW_INTRA_GROUP", 0.5);
ksession.setGlobal("REPDATE", repdate);
ksession.setGlobal("T3M", t3m);
ksession.setGlobal("T1M", t1m);
ksession.setGlobal("T2W", t2w);
ksession.setGlobal("T6M",t6m);
ksession.setGlobal("T12M", t12m);
ksession.setGlobal("T24M", t24m);
ksession.setGlobal("T60M", t60m);
ksession.setGlobal("DEFAULT_FSA_B825", defaultRating);
ksession.setGlobal("jcalF001","10-xxx-x-xx-xxxx");
ksession.setGlobal("NEW_OBJS", newObjs);
ksession.execute(group);
totalDroolsTime = totalDroolsTime + System.nanoTime() - t1;
group.addAll(newObjs);
newObjs.clear();
}
Is there anything I may have made wrong?
Regards,
--
Marc Mährländer
------------------------------------------------------------------------------------------------------------------------
Sifena Ltd - Dalkeith - Nursery Close - Woking - GU21 4UQ United Kingdom
email: marc.maehrlaender(a)sifena.com
tel: +49 (89) 420 957 312
mobile: +49 (177) 766 2008
11 years, 9 months