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

KieScanner is not working as expected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 6.0.1.Final
    • Fix Version/s: 6.1.0.Beta4
    • Component/s: None
    • Labels:
      None

      Description

      KieScanner is not dynamically updates the rules in a sample application.

      drools_sample is a parent project, drools_jar is its dependency that is expected to be dynamically updated.

      Here is the sample code:

      Scanner scanner = new Scanner(System.in);
      try {
      KieServices ks = KieServices.Factory.get();
      ReleaseId releaseId = ks.newReleaseId( "com.study", "drools_sample", "0.0.1-SNAPSHOT" );
      KieContainer kContainer = ks.newKieContainer( releaseId );
      KieSession kSession = null;
      KieScanner kScanner = ks.newKieScanner( kContainer );
      boolean repeat = true;

      // go !
      while(repeat)
      {
      kSession = kContainer.newKieSession("ksession-rules_jar");
      Message message = new Message();
      message.setMessage("Hello World");
      message.setStatus(Message.HELLO);
      DynamicFactType dft = new DynamicFactType();
      kSession.insert(message);
      kSession.insert(dft);
      kSession.fireAllRules();
      kSession.dispose();

      String inp = scanner.nextLine();
      if(inp.length() > 0)
      repeat = false;
      else

      { kScanner.scanNow(); }

      }
      } catch (Throwable t)

      { t.printStackTrace(); }

      scanner.close();

        Attachments

        1. drools_jar.zip
          14 kB
        2. drools_sample.zip
          18 kB

          Activity

            People

            Assignee:
            mfusco Mario Fusco
            Reporter:
            pictin Alexander Pykhtin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: