3 Replies Latest reply: Jul 5, 2012 8:35 AM by Maciej Swiderski RSS

    KnowledgeBase loading on demand

    Lukasz Kozerski Newbie

      Hi,

       

      I am developing application where process definition changes often. I have definiotion versioning: new version has new process id and old definitions still lives in KnowledgeBase - there are persisted running processes.

       

      Every time I need to reload whole KnowledgeBase there are loading old definitions. Many of them.

       

      Is there posibility to do any of ideas:

       

      1. Load process definition on demand - when some old persisted process is activating.

      2. Load process definiotion from db, just like process state.

       

      Thanks,

      Lukasz

        • 1. Re: KnowledgeBase loading on demand
          Maciej Swiderski Master

          Not sure what you intent to achieve here... if you could elaborate little bit more on the foal would be easier to try to come up with some ideas.

           

          Have you looked and KnowledgeAgent? It allows you to load resources from various sources (like file system, http, etc) that are defined as ChangeSet and reload (or recreate) knowledge base when changes are discovered.

           

          HTH

          • 2. Re: KnowledgeBase loading on demand
            Lukasz Kozerski Newbie

            Maciej Swiderski wrote:

             

            Have you looked and KnowledgeAgent? It allows you to load resources from various sources (like file system, http, etc) that are defined as ChangeSet and reload (or recreate) knowledge base when changes are discovered.

             

            Yes, I have. Difference betwean knowledge agent and my idea is that agent reloads KnowledgeBase after new ChangeSet appears, and I want to have (in simple situation) empty knowledge base, and when process starts load defition that is needed.

            • 3. Re: KnowledgeBase loading on demand
              Maciej Swiderski Master

              Then you could manually operate on the knowledge base, something like this:

               

               

                    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                          
                   // add you process definitions here...
                   kbuilder.add(ResourceFactory.newFileResource(subfile), ResourceType.BPMN2);
                          
                   kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
              
              
                   // if you like to remove it you can remove the package
                   kbase.removeKnowledgePackage(packageName);
              

               

              So you can load the process definitions from whatever source you want, if not already supported by ResourceFactory you can implement your own...

               

              Please nore that building knowledge base is considered a heavy operation and should be rather reused instead of rebuilt frequently.

               

              HTH