0 Replies Latest reply on Nov 7, 2013 2:10 PM by ysmarc

    KnowledgeAgent works offline?

    ysmarc

      hi!

       

       

      I'm using guvnor from my java app, I have deployed guvnor 5.4 in a jboss 7 server, my app runs in a jboss 5.1 server. It works fine, rules and jbpm proccess are refreshed ok.

       

       

      I need to ensure that my app gets recovered after guvnor server failures. But after several failures of the guvnor server (which I produce myself stopping the jboss 7 server), the KnowledgeAgent in my app still works, in a "disconnected" status,

      even after the "drools.resource.scanner.interval" time passes.

      First, the KnowledgeAgent knows that guvnor server is not alive and fails, which is what was I expecting. But after a lot of failures, once my KnowledgeAgent gets the "disconnected" status, it doesn't matter if my guvnor is alive or not, it still works, but without refresh my rules and proccess.

       

      here is my code:

       

       

        InputStream in = null;

       

       

        ResourceFactory.getResourceChangeNotifierService().start();

        ResourceFactory.getResourceChangeScannerService().start();

        

        ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();

        sconf.setProperty("drools.resource.scanner.interval", scannerInterval);

        ResourceFactory.getResourceChangeScannerService().configure(sconf);

       

       

        KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();

        aconf.setProperty("drools.agent.scanDirectories", "true");

        aconf.setProperty("drools.agent.scanResources", "true");

        aconf.setProperty("drools.agent.newInstance", "false");

        kagent = KnowledgeAgentFactory.newKnowledgeAgent("CS", aconf);

        

       

       

        try{

             in = createGuvnorChangeSetFile();

             kagent.applyChangeSet(ResourceFactory.newInputStreamResource(in));

             in.close();

             in = null;

        }catch(RuntimeException e){

             in.close();

             in = null;

             throw e;

        }

        kbase = kagent.getKnowledgeBase();

        if(kbase.getKnowledgePackages().size() == 0){

             throw new RuntimeException("Error building kbase! Could not load guvnor packages");

        

        }

       

       

      the method createGuvnorChangeSetFile just creates the changeSet file, with user, password, and my package url. My url looks like: http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/myPkg/LATEST/

       

      any ideas?

      Thanks!!