regarding drools guvnor and eclipse IDE
by Sai Nadh
How can i access the rules (which i have created in Drools Guvnor) to my
java application?
plz give me some example....
i have tried with below code, is there any mistakes?? if yes pls mention....
private static KnowledgeBase createKnowledgeBase() {
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent"
);
KnowledgeAgentConfiguration kaconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty( "drools.agent.scanDirectories", "false" );
kagent.applyChangeSet( ResourceFactory.newUrlResource("
http://localhost:8080/guvnor/rest/packages/ProductPositionAlert/assets/ch...")
);
return kbase;
}
my guvnor package sanpshot details are
[image: Inline image 2]
thanks in advance
--
*Regards*
* sainadh*
* *
13 years, 4 months
Task Handler blocking
by Alberto R. Galdo
Hi All,
We have an application where we are using JBPM for our processes. In our
application there's a strong requirement to maintain the same
KnowledgeSession between restarts even though that we are not using rules
at all, just BPMN 2.0 processes ( we are aware that JBPM needs it to
maintain process state, workitem state and so on ... but don't need
neither rules nor ReteOO loops in our app ).
Now we got to the tricky task handling part, were we have several
handlers that depend on I/O which blocks the entire execution of the
processes. And just because all our application depends on the *same*
shared stored knowledge session, all our other parallel processes that need
to execute processes are waiting ( like in a queue ) for the I/O to finish
and execute themselves whenever the execution of JBPM gets blocked by I/O.
We've tried to execute our handlers in different threads, but as we are
running inside a persisted environment JBPM looses the JTA transaction as
it is not bound to the current thread. Seems not a solution. We tried then
to implement thread communication mechanisms, yield() and notify() and just
made the problem worse.
Any insights on the subject? How can we execute parallel non-blocking
processes inside a shared and persisted KnowlegdeSession with JBPM?
Greets,
Alberto R. Galdo
argaldo(a)gmail.com
13 years, 4 months
Rete Tree node colors
by raffi
Hello,
after reading the documantation of the RETE algorithm here I have an
understanding problem.
I think the first step (after ReteNode) are the ObjectTypeNodes, colored in
blue in documentation. The view in eclipse shows me the red colored
AlphaNodes as first childs after the ReteNode. Afterwards there are the blue
colored ObjectTypeNodes. The number of these blue colored nodes corresponds
to the number of conditions for one type. That is why I ask about a possible
color changing.
Or do I have a generel misunderstanding there?
Greetings...
--
View this message in context: http://drools.46999.n3.nabble.com/Rete-Tree-node-colors-tp4020322.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Rule not working with Change_set.xml
by anniejoseph
Hi,
I'm trying to use change-set.xml, which pionts to a drl file.My code is
try {
url =new URL("file:config/change-set.xml");
} catch (MalformedURLException e) {
e.printStackTrace();
}
kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) );
kbase = kagent.getKnowledgeBase();
ksession= kbase.newStatefulKnowledgeSession();
sconf
=ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty( "drools.resource.scanner.interval", "10" );
ResourceFactory.getResourceChangeScannerService().configure( sconf );
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
ksession.insert(object);
ksession.fireAllRules();
and my change-set.xml is:-
<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
>
<add>
<resource source ='file:config/Rule.drl' type='DRL'
basicAuthentication='enabled' username='admin' password='admin'></resource>
</add>
</change-set>
This code worked without any exception, but the rule is not executing. I
tried without changeset.xml and rule worked properly.
What is wrong?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Rule-not-working-with-Change-set-xml-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Listening to changes on facts
by jspartan0901
Hello,
I am currently evaluating fusion for our project. We are planning to deploy
it on an application server.
When a rule is successfully executed. I need to generate an action such as
sending a message to a queue.
As per my understanding so far, when a rule matches conditions, we need to
insert a fact in the working memory and listen for changes in the java code.
Can anyone please share a piece of code on how to listen on changes to
facts?
Thanks!
Sam
--
View this message in context: http://drools.46999.n3.nabble.com/Listening-to-changes-on-facts-tp4020231...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
firing rules twice in single session on single object
by Sai Nadh
hi ,
I am able to fire the rules in drools...But i want to fire the rules
after modification of same data
ie.., i want to fire the rules twice in the same session
for example: i have some stock of different items, if the particular stock
item quantity is less than minimum quantity i want fire a rule that order
that quantity
after that the stock is added to that previous count(stock), i want to
recheck the stock positions and again need to fire rules
is it possible to fire the rules twice or more in Drools
if, please provide me some sample code....
I want to know that Drools can fire a rule multiple times in one session or
not????
please let me know if possible and guide me in this scenario
thanks in advance
13 years, 4 months
How to Use functions in Web-Guided Editor
by ayonchak
Hi All,
I am facing some problem when migrating from excel-based drools to Drools
Guvnor. Suppose we are using some function in the Conditions and Actions of
excel. But how to write them in Guvnor as in Guvnor I can only get the value
of the condition and set the value of the variable in action. Then I can
manipulate the value in code. But is there any option of doing that in Rule?
Like I am using this in an action of excel based Drools -
long mnthlyBnft=$1*1L;
if(planRule.getMonthlyBnftList().size() == 0)
{
do
{
planRule.getMonthlyBnftList().add(mnthlyBnft);
mnthlyBnft = mnthlyBnft + $3;
}while(mnthlyBnft<=$2);
}
In the values I am giving 3 comma-separated values for $1, $2 and $3.
How to do the same in Guvnor? I saw the new function option in Guvnor but
didn't find anywhere how to use that in Web-Guide based decision table rule.
Please help me. Thanks!
Ayon
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-Use-functions-in-Web-Guided-Edit...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months