0 Replies Latest reply on Mar 26, 2012 5:28 PM by affandar

    Automatically updating knowledgebase & sessions with new process definitions

    affandar

      Hello folks, I have guvnor setup as my process 'definitions' editor using jackrabbit underneath as the JCR. Also, in my code I am creating the knowledgebase using this repository like so:

       

      '''

      KnowledgeAgentConfiguration kaconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();

       

       

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

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

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

       

                                    // Set the interval on the ResourceChangeScannerService if the default of 60s is not desirable.

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

                                    sconf.setProperty( "drools.resource.scanner.interval",  "15" ); // set the disk scanning interval to 30s, default is 60s

                                    ResourceFactory.getResourceChangeScannerService().configure( sconf );

       

                                    ResourceFactory.getResourceChangeNotifierService().start();

                                    ResourceFactory.getResourceChangeScannerService().start();

       

                                    KnowledgeAgent ka = KnowledgeAgentFactory.newKnowledgeAgent("workflowknowledgeagent", kaconf);

       

                                    ka.applyChangeSet(ResourceFactory.newUrlResource(

                                                        "http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/ChangeSet.xml"));

       

                                    KnowledgeBase kb = ka.getKnowledgeBase();

      '''

       

      This is working fine but when I add or remove a process definition using guvnor and rebuild the package, the change does not automagically show up in the knowledgebase that was created towards the end of the snippet above. With 'newInstance' set to false I was hoping this would happne automatically (and also the ksessions created off of this knowledgebase will get updated as well).

       

      Is this expected behavior or am I missing something?

       

      Thanks!