[rules-users] KnowledgeAgent Changeset problems
Esteban Aliverti
esteban.aliverti at gmail.com
Thu Apr 5 03:17:12 EDT 2012
Could you append the log output of the Knowledge Agent?
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com
On Wed, Apr 4, 2012 at 4:12 PM, albertorugnone
<arugnonechemical at gmail.com>wrote:
> Thank you every body for your answer, unfortunately I was't able to reply
> to
> you until now because other stuff overwhelmed me literally at work.
> Anyway I was going ahead using KnowledgeAgent, following your comments and
> other suggestion. Now I am able to load rules applying change set with
> KnowledgeAgent (thank you!!!), but honestly this is a poor success because,
> even if when I change the rule KnowledgeAgent says "incremental build of
> KnowledgeBase finished and in use" nothing changes.
> It seems that changes at rules have no effect and it is pretty weird. I
> made
> a maven project with eclipse to explain you better my problem. Is a simple
> main. I am working for a better junit test. Anyway if you change the rule
> in
> the folder knowledge you can test the problem by yourself.
> Briefly I will explain the project:
>
> Here the code:
>
> _l.warn("START");
> String xml = "";
> xml += "<change-set xmlns='
> http://drools.org/drools-5.0/change-set'";
> xml += "
> xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'";
> xml += "
> xs:schemaLocation='http://drools.org/drools-5.0/change-set
> drools-change-set-5.0.xsd' >";
> xml += " <add> ";
> xml += " <resource
> source='Z:/EXP/drools-test/knowledge/test.drl'
> type='DRL' />";
> xml += " </add> ";
> xml += "</change-set>";
> FileManager fileManager = new FileManager();
> File fxml = fileManager.newFile("changeset.xml");
> Writer output = new BufferedWriter(new FileWriter(fxml));
> output.write(xml);
> output.close();
> // build a KnowledgeAgent
> ResourceFactory.getResourceChangeNotifierService()
> .start();
> ResourceFactory.getResourceChangeScannerService()
> .start();
>
> final ResourceChangeScannerConfiguration sconf =
> ResourceFactory.getResourceChangeScannerService()
>
>
> .newResourceChangeScannerConfiguration();
> sconf.setProperty("drools.resource.scanner.interval", "2");
> ResourceFactory.getResourceChangeScannerService()
> .configure(sconf);
>
> final KnowledgeAgentConfiguration aconf =
> KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
> aconf.setProperty("drools.agent.scanDirectories", "true");
> aconf.setProperty("drools.agent.scanResources", "true");
> /*
> * important newInstance has to be false in order to update
> the
> * knowledge base and not rebuild a new one
> */
> aconf.setProperty("drools.agent.newInstance", "false");
> final KnowledgeAgent agent =
> KnowledgeAgentFactory.newKnowledgeAgent("pch.sel.knowledge.agent", aconf);
> // if (_l.isDebugEnabled()) {
> /* we need some log every time */
> agent.setSystemEventListener(new
> PrintStreamSystemEventListener());
>
>
> agent.applyChangeSet(ResourceFactory.newClassPathResource("pch.sel.kwset.xml"));
> // fire rules
> StatefulKnowledgeSession session =
> agent.getKnowledgeBase().newStatefulKnowledgeSession();
> session.fireAllRules();
> _l.warn("END");
>
>
> and here the rule
>
>
> package it.ipiu.drools.KnowledgeAgent.test
>
> rule "test rule" timer(int: 0s 2s)
> when
> eval(true);
> then
> System.out.println("ciao");
> end
>
>
>
> If I try to change timer from 2s to 2m nothing changes even if
> KnowledgeAgent seems to reload all.
>
> *Please help!!! I googled the problem everywhere without solution!!!*
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/KnowledgeAgent-Changeset-problems-tp3787165p3884201.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120405/fea5753d/attachment.html
More information about the rules-users
mailing list