<resource source='
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Sensis/LATEST.drl'
type='DRL' />
</add>
</change-set>
and getting the session as follows:
private final String CHANGE_SET = "/changeset.xml";
ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "30");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
this.kbase = KnowledgeBaseFactory.newKnowledgeBase();
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.scanDirectories", "true");
aconf.setProperty("drools.agent.newInstance", "true");
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("kagent",
this.kbase, aconf);
kagent.applyChangeSet(ResourceFactory.newFileResource(this.CHANGE_SET));
session = kagent.getKnowledgeBase().newStatelessKnowledgeSession();
Thanks
Paul
From:
Mark Proctor <mproctor@codehaus.org>
To: Rules Users List
<rules-users@lists.jboss.org>
Sent: Tuesday,
December 16, 2008 11:05:30 AM
Subject: Re:
[rules-users] How to use KnowledgeAgent in the "old manner" (just like
RuleAgent)
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 );
Mark
Mark
Again, thanks and appreciate your answer
Regards
Paul
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users