Hello, Before M4 I use a RuleAgent to obtain my rules from files or the repository. Do you have a complete example with the new API ? Thanks Nicolas Le mardi 16 décembre 2008 à 10:05 +0000, Mark Proctor a écrit :
Mark Proctor wrote:Paul Sentosa wrote:
Hi, Mark, thanks for the links and explanation. So if I use Guvnor for administrating my rules, - should I use the URL pointing to LATEST.DRL in change-set instead of the one in package snapshot to get the latest version of rules? - I assume the communication between my application and the Guvnor will happen by the time applyChangeSet-method (which defines a resource by pointing to the URL of DRL) is called and internally create package out of it (compared to the method newRuleAgent("properties"). Is this correct? Is there any significat difference in required time/performance?
I added file scanning, I haven't yet added http scanning, I'll do that this week. the file and http scanning, work in the same manner as they do for the original rule agent. If you look at the file scanner now, you can see how to implement your own if you really need to. The framework is now designed that people can built their own resource monitors, so they can implement their own push based implementations.Sorry I had a mind blank, and I'm talking complete bollocks. http does work. The ResourceChangeScannerImpl is independant of the resource type, as long as the resource type implements getLastModified() and getLastRead() it will work, which the http one does. So in theory whether file or http resources, it should work the same way as the old rule agent. The only difference is the configuration is now in a different location, if you need to change the interval. You now no longer change the interval on the individual rule agent, but on the service. Properties props = new Properties(); props.setProperty("drools.resource.scanner.interval", "30"); ResourceChangeScanner service = ResourceFactory.getResourceChangeScannerService(); ResourceChangeScannerConfiguration rconf = service.newResourceChangeScannerConfiguration(props); service.configure( rconf ); MarkMark
Again, thanks and appreciate your answer Regards Paul
From: Mark Proctor <mproctor@codehaus.org> To: Rules Users List <rules-users@lists.jboss.org> Sent: Tuesday, December 16, 2008 9:22:22 AM Subject: Re: [rules-users] How to use KnowledgeAgent in the "old manner" (just like RuleAgent) psentosa wrote: > Hi all, > > Can anyone give some explanation / examples on this? The docu is still using > ruleagent. > I found some piece of codes within the KnowledgeAgentFactory, but I saw that > it uses the configuration object. The javadocs: https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/javadocs/stable/drools-api/org/drools/agent/KnowledgeAgent.html https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/javadocs/stable/drools-api/org/drools/ChangeSet.html There are a number of unit tests you can follow: http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/agent/KnowledgeAgentTest.java http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/ChangeSetTest.java http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/ChangeSetTest.java http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/ > I personally prefer the old style by using > a property file in which the configuration is defined. > The properties file does not offer enough flexibilility to support all resource types - the xml really is quite simple - how do you specify the worksheet name for a decision tree? In some ways it's actually simpler and more powerful, as there is no separate line for directories, it's just another resource and it detects that it's a directory. ChangeSets will eventually support remove and modify, for incremental knowledgebase changes, so the properties file just doesn't cut it. <change-set> <add> <resource source='http://www.domain.com/test.drl' type='DRL' /> <resource source='file://data/somedir' type='DRL' /> <resource source='http://www.domain.com/test.xls' type='DTABLE' > <decisiontable-conf worksheet-name='sheet10' input-type='XLS' /> </resource> </add> </change-set> Mark > Thanks in advance for any help > > Regards > Paul > _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users