Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-638

KnowledgeAgent incremental build stuck infinite if have two rules with same condition in steam mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 5.6.0.Final
    • None
    • None
    • Hide

      1. Create a drl file with two rules with same condition.
      2. Configure KnowledgeAgent with Steam mode.
      3. Update a rule ( then part)
      4. See logs ( agent thread will stuck with "KnowledgeAgent: Diffing: [FileResource file..." logs)

      Show
      1. Create a drl file with two rules with same condition. 2. Configure KnowledgeAgent with Steam mode. 3. Update a rule ( then part) 4. See logs ( agent thread will stuck with "KnowledgeAgent: Diffing: [FileResource file..." logs)

      If we have two rules on same condition in Steam mode, first time agent able to pick both and work fine.

      When we update any rule (then part), KnowledgeAgent will stuck infinite after printing below logs.

      [2014-10-24 17:59:04,066:debug] KnowledgeAgent received ChangeSet changed notification
      [2014-10-24 17:59:04,066:info] KnowledgeAgent applying ChangeSet
      [2014-10-24 17:59:04,067:debug] KnowledgeAgent removing mappings for resource=[FileResource file='rule\streamRule.drl'] with unsubscribe=false
      [2014-10-24 17:59:04,067:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
      [2014-10-24 17:59:04,076:info] KnowledgeAgent performing an incremental build of the ChangeSet
      [2014-10-24 17:59:04,193:debug] KnowledgeAgent: Diffing: [FileResource file='rule\streamRule.drl']

      Below is code snippet for KnowledgeAgent

      KnowledgeAgentConfiguration kaconf = KnowledgeAgentFactory
      .newKnowledgeAgentConfiguration();
      kaconf.setProperty("drools.agent.scanDirectories", "true");
      kaconf.setProperty("drools.agent.newInstance", "false");
      KnowledgeBaseConfiguration config = KnowledgeBaseFactory
      .newKnowledgeBaseConfiguration();
      config.setOption(EventProcessingOption.STREAM);
      KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
      final KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
      "kagent", kbase, kaconf);
      kagent.setSystemEventListener(new PrintStreamSystemEventListener());
      kagent.addEventListener(new KnowledgeAgentEventListener() {

      public void resourceCompilationFailed(
      ResourceCompilationFailedEvent arg0)

      { LOGGER.error("Unable to compile Knowledge" + arg0.toString()); throw new RuntimeException("Unable to compile Knowledge" + arg0.toString()); }

      public void knowledgeBaseUpdated(KnowledgeBaseUpdatedEvent arg0)

      { LOGGER.info("********** KBase was updated***********"); }

      public void beforeResourceProcessed(
      BeforeResourceProcessedEvent arg0) {
      }

      public void beforeChangeSetProcessed(
      BeforeChangeSetProcessedEvent arg0) {
      }

      public void beforeChangeSetApplied(BeforeChangeSetAppliedEvent arg0) {
      }

      public void afterResourceProcessed(AfterResourceProcessedEvent arg0) {
      }

      public void afterChangeSetProcessed(
      AfterChangeSetProcessedEvent arg0) {
      }

      public void afterChangeSetApplied(AfterChangeSetAppliedEvent arg0) {
      }

      });
      ResourceChangeScannerConfiguration sconf = ResourceFactory
      .getResourceChangeScannerService()
      .newResourceChangeScannerConfiguration();
      sconf.setProperty("drools.resource.scanner.interval", "2");
      ResourceFactory.getResourceChangeScannerService().configure(sconf);

      kagent.applyChangeSet(ResourceFactory
      .newClassPathResource("changeset/changeSet.xml"));

      ResourceFactory.getResourceChangeNotifierService().start();
      ResourceFactory.getResourceChangeScannerService().start();

            mproctor@redhat.com Mark Proctor
            vinay.p_jira Vinay Pareek (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: