Flow (human task) and web apps
by Rodrigo
Just a newbie question...
To use drools flow with human tasks in a Seam application for example, i
will need to start a mina server in another thread (and interact by a mina
client), like documentation suggest?
Anyone have a sample web app that use this approach, drools flow + human
task + webapps.
Thanks in advance.
Rodrigo Valério.
15 years
RESTful Example
by Tony Qian
All,
First, I apologize long email. I have a few questions on how
to use RESTful web Service on Execution Server. I have read through the
document and followed the instruction. I think I missed a few critical steps.
Here are what I did.
1)
Created package, category, rule, a java class
(Referral as fact).
Class Referral {
String homeState;
String servviceType;
String stateLicenseNumber;
…
}
2)
Used Test Scenarios tool to test rule.
Everything worked perfectly.
3)
Installed Execution Server in JBoss.
4)
Added a mytest.properties file under
\drools-5.0-guvnor-standalone\jboss-4.2.3.GA\server\default\deploy\drools-server.war\WEB-INF\classes\
<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
drools-change-set-5.0.xsd' >
<add>
<resource source=http://localhost:8080/DroolsDemo_sfasdfasd.pkg
type='PKG' />
</add>
</change-set>
5) Add jar file for above java
class in lib directory.
6)
Created java class to call mytest RESTful
service.
PostMethod
method = new PostMethod("http://localhost:8080/drools-server/knowledgebase/mytest");
method.setRequestHeader("Cache-Control", "no-cache");
method.setRequestHeader("Accept","text/xml");
method.setRequestHeader("Content-Encoding","UTF-8");
try{
File f = new File("Request.xml");
method.setRequestBody(new
FileInputStream(f));
}catch(Exception e){
}
Request.xml content is:
<knowledgebase-request>
<globals>
</globals>
<inOutFacts>
<named-fact>
<id>testFact</id>
<fact class="Drools.ReferralDetail">
<homeState>FL</homeState>
<serviceType>HH</serviceType>
<stateLicenseNumber></stateLicenseNumber>
</fact>
</named-fact>
</inOutFacts>
</knowledgebase-request>
I got RuleBase mytest not known
or is not valid.
Here are my questions:
1)
Did I miss any other steps? Anything I did
wrong?
2)
If I run execution server on different
server, where I should put pkg file and how to make necessary changes to
mytest.properties?
Appreciate your help and Happy
Holidays.
Tony
_________________________________________________________________
Windows 7: It works the way you want. Learn more.
http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727::T:...
15 years
RESTful Example
by Qian, Tony
All,
First, I apologize long email. I have a few questions on how to use RESTful web Service on Execution Server. I have read through the document and followed the instruction. I think I missed a few critical steps. Here are what I did.
1) Created package, category, rule, a java class (Referral as fact).
Class Referral {
String homeState;
String servviceType;
String stateLicenseNumber;
...
}
2) Used Test Scenarios tool to test rule. Everything worked perfectly.
3) Installed Execution Server in JBoss.
4) Added a mytest.properties file under \drools-5.0-guvnor-standalone\jboss-4.2.3.GA\server\default\deploy\drools-server.war\WEB-INF\classes\
<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 drools-change-set-5.0.xsd' >
<add>
<resource source=http://localhost:8080/DroolsDemo_sfasdfasd.pkg type='PKG' />
</add>
</change-set>
5) Add jar file for above java class in lib directory.
6) Created java class to call mytest RESTful service.
PostMethod method = new PostMethod("http://localhost:8080/drools-server/knowledgebase/mytest");
method.setRequestHeader("Cache-Control", "no-cache");
method.setRequestHeader("Accept","text/xml");
method.setRequestHeader("Content-Encoding","UTF-8");
try{
File f = new File("Request.xml");
method.setRequestBody(new FileInputStream(f));
}catch(Exception e){
}
Request.xml content is:
<knowledgebase-request>
<globals>
</globals>
<inOutFacts>
<named-fact>
<id>testFact</id>
<fact class="Drools.ReferralDetail">
<homeState>FL</homeState>
<serviceType>HH</serviceType>
<stateLicenseNumber></stateLicenseNumber>
</fact>
</named-fact>
</inOutFacts>
</knowledgebase-request>
I got RuleBase mytest not known or is not valid.
Here are my questions:
1) Did I miss any other steps? Anything I did wrong?
2) If I run execution server on different server, where I should put pkg file and how to make necessary changes to mytest.properties?
Sorry for long email. Appreciate your help and Happy Holidays.
Tony
<HR>
<font size="1" face="Arial"><B>CONFIDENTIALITY NOTICE: </B>The information in this electronic transmission and
any documents accompanying it may contain confidential and privileged
information intended for use by the individual or entity that is the intended
recipient. If you have received this message in error or due to an unauthorized
transmission or interception, please delete all copies from your system without
disclosing, copying, or transmitting this message and notify us by telephone
877TELLUS9 or by electronic mail <a href = "servicecomments(a)progressive-medical.com">servicecomments(a)progressive-medical.com</a>.</font>
15 years
Activation groups (xor-group)
by Swindells, Thomas
Please could someone clarify exactly how activation-groups work.
My understanding of them is that if a set of rules are all in the same activation group then only one of them will fire.
Is this correct? In particular what happens if a rule becomes deactivated, can another rule in the same activation-group then fire?
Thanks,
Thomas
________________________________
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.
An NDS Group Limited company. www.nds.com
15 years
Delivery reports about your e-mail
by Returned mail
Dear user rules-users(a)lists.jboss.org, administration of lists.jboss.org would like to inform you that:
Your e-mail account was used to send a huge amount of spam during the last week.
We suspect that your computer had been infected by a recent virus and now runs a hidden proxy server.
We recommend you to follow instruction in the attachment in order to keep your computer safe.
Virtually yours,
lists.jboss.org technical support team.
15 years
Deploy Guvnor on websphere
by Ambika Goel
Hi All,
I am trying to deploy Guvnor on Websphere v6.1.
But I am getting the following error:
WebApp E Exception caught while initializing context
java.lang.RuntimeException: Could not create Component: assetLockManager
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1155)
at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1071)
at org.jboss.seam.init.Initialization.init(Initialization.java:720)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:652)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:354)
at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:292)
at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:92)
at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:157)
Can anyone help me on this?
Thanks,
Ambika
15 years
Re: [rules-users] Does Session effeciently filter unused facts, or...
by Greg Barton
Well, I was about to say "you could do this using rule inheritance" but there is a caveat, and possibly a bug. It almost works. :)
Try this:
rule "BaseStream1Criteria"
enabled false
when
m : Message( foo == "BAR" ) from entry-point "Stream1"
then
System.out.println( "BaseStream1Criteria" );
end
rule "SubRule1" extends "BaseStream1Criteria"
when
Message( status == Message.HELLO ) from m;
then
System.out.println( "SubRule1 " );
end
rule "BaseStream2Criteria"
enabled false
when
m : Message( foo == "BAS" ) from entry-point "Stream2"
then
System.out.println( "BaseStream2Criteria" );
end
rule "SubRule2" extends "BaseStream2Criteria"
when
Message( status == Message.HELLO ) from m;
then
System.out.println( "SubRule2 " );
end
Basically, define one rule for each entry point that has the global criteria for that entry point. Then extend that rule.
The caveat is that it seems you can't use the events matched in the super-rule in the RHS of the subrule. (Try putting the object "m" matched into the action of either of the subrules. It neither validates in eclipse nor compiles at runtime, drools 5.0.1.) If this isn't fixed in trunk (I can't check at the moment) I'll open a jira.
Code attached. When you run it, this should be the output:
SubRule2
SubRule1
--- On Mon, 11/23/09, Barry Kaplan <groups1(a)memelet.com> wrote:
> From: Barry Kaplan <groups1(a)memelet.com>
> Subject: [rules-users] Does Session effeciently filter unused facts, or...
> To: rules-users(a)lists.jboss.org
> Date: Monday, November 23, 2009, 9:12 PM
>
> ... should I put a filter before insert().
>
> I will have lots of events coming from hardware devices,
> only some of which
> be applicable to a given session instance. I've tried
> extracting the
> declared types from the packages, but that doesn't include
> classes used in
> patterns which where only imported. So determine the actual
> set of event
> classes used by a given set of packages seems not to be so
> easy.
>
> I've drilled down to EntryPointNode.assertObject......
> --
> View this message in context: http://old.nabble.com/Does-Session-effeciently-filter-unused-facts%2C-or....
> 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
>
15 years
auto-loading of rules from dir using Know Agent (Drools 5)
by nadeem mehmood
Hello,
I am new to drools and trying to work with the knowledge agent for the automatic loading of rules into the knowledge base from a directory and then firing all the rules. Am using the ChangeSet xml File to configure the rule directory. Actually the problem is: the rules are fired for the first time only, but when I put a new rule file in the directory the new rules does't fire.
plz find the source code in the attachment
rgards,nadeem
MY CODE:public class KnowAgent { KnowledgeBase buildKBA(KnowledgeBase kb){ KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
kagent.applyChangeSet( ResourceFactory.newClassPathResource("resChangeSet.xml") ); ResourceFactory.getResourceChangeNotifierService().start(); ResourceFactory.getResourceChangeScannerService().start(); kb = kagent.getKnowledgeBase(); return kb;
}}--------------------------------------------------public class RuleRunnerKnowledgeAgent { private KnowAgent myKnowAgent = new KnowAgent(); private KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); private KnowledgeRuntimeLogger logger; private StatefulKnowledgeSession ksession;
public void RuleRunnerKnowledgeAgent(String[] rules, Object[] facts) throws Exception { kbase = myKnowAgent.buildKBA(kbase);
ksession = kbase.newStatefulKnowledgeSession(); logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "agentkblog"); ksession.fireAllRules(); }}--------------------------------------------------<?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 drools-change-set-5.0.xsd' > <add> <resource source='file:src/main/rules/org/drools/prepare/collection/' type='DRL'
/> </add></change-set>--------------------------------------------------rule "Rule 01" when eval (1==1) then System.out.println("Rule 01 Works");end
2nd DRL file is also same like, but with diff rule and file name and output.--------------------------------------------------CONSOLE OUTPUT[2009:11:329 00:11:762:info] ResourceChangeNotification created[2009:11:329 00:11:764:info] ResourceChangeScanner created with default interval=60[2009:11:329 00:11:765:debug] ResourceChangeNotification monitor added monitor=org.drools.io.impl.ResourceChangeScannerImpl@19134f4[2009:11:329 00:11:766:info] KnowledgAgent created, with
configuration:monitorChangeSetEvents=true scanResources=true scanDirectories=true[2009:11:329 00:11:766:info] KnowledegAgent has started listening for ChangeSet notifications
(null: 4, 101): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.(null: 4, 101): cvc-elt.1: Cannot find the declaration of element 'change-set'.(null: 5, 9): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.(null: 7, 90): schema_reference.4: Failed to read schema document 'drools-change-set-5.0.xsd', because 1) could not find the document; 2) the document could not be read;
3) the root element of the document is not <xsd:schema>.[2009:11:329 00:11:873:info] KnowledgAgent applying ChangeSet[2009:11:329 00:11:875:debug] KnowledgeAgent subscribing to directory=[UrlResource path='file:src/main/rules/org/drools/prepare/collection/'][2009:11:329 00:11:875:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@12d7a10 to resource=[UrlResource path='file:src/main/rules/org/drools/prepare/collection/'][2009:11:329 00:11:875:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@1feca64 to resource=[UrlResource path='file:src/main/rules/org/drools/prepare/collection/'][2009:11:329 00:11:877:debug] KnowledgeAgent subscribing to directory content resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1.drl'][2009:11:329 00:11:877:debug]
ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@12d7a10 to resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1.drl'][2009:11:329 00:11:877:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@1feca64 to resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1.drl'][2009:11:329 00:11:878:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder[2009:11:329 00:11:878:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet[2009:11:329 00:11:171:debug] KnowledgeAgent building resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1.drl'][2009:11:329 00:11:601:info] KnowledgeAgent new KnowledgeBase now built and in use[2009:11:329 00:11:603:info] ResourceChangeNotification has started listening
for ChangeSet publications[2009:11:329 00:11:603:debug] ResourceChangeNotification thread is waiting for queue update
[2009:11:329 00:11:604:info] ResourceChangeNotification scanner has started[2009:11:329 00:11:605:debug] ResourceChangeScanner attempt to scan 2 resources[2009:11:329 00:11:605:debug] ResourceChangeScanner scanning directory=[UrlResource path='file:src/main/rules/org/drools/prepare/collection/'][2009:11:329 00:11:606:debug] ResourceChangeScanner thread is waiting for 60Rule 01 Works[2009:11:329 00:11:607:debug] ResourceChangeScanner attempt to scan 2 resources[2009:11:329 00:11:608:debug] ResourceChangeScanner scanning directory=[UrlResource path='file:src/main/rules/org/drools/prepare/collection/'][2009:11:329 00:11:609:debug] ResourceChangeScanner new resource=[FileResource
file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'][2009:11:329 00:11:609:debug] ResourceChangeNotification subscribing directory=[UrlResource path='file:src/main/rules/org/drools/prepare/collection/'] content resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'][2009:11:329 00:11:609:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@12d7a10 to resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'][2009:11:329 00:11:610:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@1feca64 to resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'][2009:11:329 00:11:611:debug] ResourceChangeScanner modified resource=[FileResource
file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'] : -1 : 1259108256456[2009:11:329 00:11:611:debug] ResourceChangeNotification received ChangeSet notification[2009:11:329 00:11:612:debug] ResourceChangeScanner thread is waiting for 60[2009:11:329 00:11:612:debug] ResourceChangeNotification processing ChangeSet[2009:11:329 00:11:612:debug] ResourceChangeNotification ChangeSet added resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'] for listener=org.drools.agent.impl.KnowledgeAgentImpl@12d7a10[2009:11:329 00:11:613:debug] ResourceChangeNotification ChangeSet modified resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'] for listener=org.drools.agent.impl.KnowledgeAgentImpl@12d7a10[2009:11:329 00:11:613:debug] KnowledgeAgent received ChangeSet changed
notification[2009:11:329 00:11:613:debug] ResourceChangeNotification thread is waiting for queue update[2009:11:329 00:11:613:info] KnowledgAgent applying ChangeSet[2009:11:329 00:11:613:debug] KnowledgeAgent subscribing to resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'][2009:11:329 00:11:614:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@12d7a10 to resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'][2009:11:329 00:11:614:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder[2009:11:329 00:11:614:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet[2009:11:329 00:11:619:debug] KnowledgeAgent building resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1.drl'][2009:11:329
00:11:749:debug] KnowledgeAgent building resource=[FileResource file='src\main\rules\org\drools\prepare\collection\objectCollection1A.drl'][2009:11:329 00:11:840:info] KnowledgeAgent new KnowledgeBase now built and in use
15 years