Re: [rules-users] Help with URL resource caching

2011-09-23 Thread benji2212
Ah, I found my problem.  There was an issue with the builds, and my latest
changes weren't being applied to the environment I was testing in.  I've got
it working with the code I posted above.  Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-URL-resource-caching-tp3362041p3362216.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Help with URL resource caching

2011-09-23 Thread benji2212
I'm using KnowledgeAgent to poll regularly for three DRL files hosted on a
web server.  If the web server goes down for any reason or one of the DRL
files becomes unavailable, the change scanner and knowledge agent
unsubscribe from the resource(s) that were unavailable.  

After reading some topics on the forum, I found that setting the
drools.resource.urlcache system property should correct this.  However, I've
been unable to get this to work properly.  The code I'm using is below.  Any
insight into what I'm doing wrong would be appreciated.  I'm using drools
5.1.1.

System.setProperty("drools.dateformat",
"MM/dd/");
System.setProperty("drools.resource.urlcache",
"C:\\Users\\000\\Documents\\rule-cache");

//start the scanner service and resource change 
notifier service
changeNotifier = 
ResourceFactory.getResourceChangeNotifierService();
changeScanner = 
ResourceFactory.getResourceChangeScannerService();
changeNotifier.start();
changeScanner.start();

kagent = KnowledgeAgentFactory.newKnowledgeAgent("My 
Knowledge Agent");
URL url = 
RulesRuntimeImpl.class.getResource(CHANGE_SET_PATH);
Resource drl = ResourceFactory.newUrlResource(url);
kagent.applyChangeSet(drl);


My change set file looks like this: 
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" >

http://mysite.com/test/FirstDecisionTable.drl";
type="DRL" />
http://mysite.com/test/SecondDecisionTable.drl";
type="DRL" />
http://mysite.com/test/ThirdDecisionTable.drl";
type="DRL" />



and the output I get when a resource in the change set becomes unavailable:
[9/21/11 10:49:28:015 EDT] 004e SystemOut O [2011:09:264
10:09:15:debug] ResourceChangeScanner attempt to scan 3 resources
[9/21/11 10:49:28:046 EDT] 004e SystemOut O [2011:09:264
10:09:46:debug] ResourceChangeScanner thread is waiting for 60 seconds.
[9/21/11 10:50:28:055 EDT] 004e SystemOut O [2011:09:264
10:09:55:debug] ResourceChangeScanner attempt to scan 3 resources
[9/21/11 10:50:28:259 EDT] 004e SystemOut O [2011:09:264
10:09:259:debug] ResourceChangeScanner removed resource=[UrlResource
path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:309 EDT] 004e SystemOut O [2011:09:264
10:09:309:debug] ResourceChangeNotification received ChangeSet notification
[9/21/11 10:50:28:345 EDT] 004e SystemOut O [2011:09:264
10:09:345:debug] ResourceChangeScanner thread is waiting for 60 seconds.
[9/21/11 10:50:28:426 EDT] 004f SystemOut O [2011:09:264
10:09:417:debug] ResourceChangeNotification processing ChangeSet
[9/21/11 10:50:28:535 EDT] 004f SystemOut O [2011:09:264
10:09:535:debug] ResourceChangeNotification ChangeSet removed
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
for listener=org.drools.agent.impl.KnowledgeAgentImpl@6e5a6e5a
[9/21/11 10:50:28:560 EDT] 004f SystemOut O [2011:09:264
10:09:560:debug] KnowledgeAgent received ChangeSet changed notification
[9/21/11 10:50:28:611 EDT] 004f SystemOut O [2011:09:264
10:09:611:debug] ResourceChangeNotification thread is waiting for queue
update
[9/21/11 10:50:28:626 EDT] 0050 SystemOut O [2011:09:264
10:09:625:info] KnowledgeAgent applying ChangeSet
[9/21/11 10:50:28:663 EDT] 0050 SystemOut O [2011:09:264
10:09:663:debug] KnowledgeAgent removing mappings for resource=[UrlResource
path='http://mysite.com/test/FirstDecisionTable.drl'] with unsubscribe=true
[9/21/11 10:50:28:684 EDT] 0050 SystemOut O [2011:09:264
10:09:684:debug] KnowledgeAgent notifier unsubscribing to
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:689 EDT] 0050 SystemOut O [2011:09:264
10:09:689:debug] ResourceChangeNotification unsubscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@6e5a6e5a to
resource=[UrlResource path='http://mysite.com/test/FirstDecisionTable.drl']
[9/21/11 10:50:28:689 EDT] 0050 SystemOut O [2011:09:264
10:09:689:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
...

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-with-URL-resource-caching-tp3362041p3362041.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users