1 Reply Latest reply on Dec 15, 2011 3:41 PM by Tihomir Surdilovic

    Rule Task Query - Activations Not Firing

    Shaun Willows Newbie

      TL;DR

      Activations resulting from a rule task in my workflow are not fired on every iteration of the loop containing the rule task.

       

      ---------------------------

       

      During some experimentation with JBPM 5.1, I happened upon some strange behaviour regarding rule tasks. I simplified the workflow to isolate my problem, and have attached the containing eclipse project in a zip archive to this post.

       

      The application generates a list of POJOs that represents rows in a file and their associated row numbers. It starts the simple workflow with the list provided as a process variable. The first task (a script task) in the workflow derives a smaller sub-list and stores it in a process variable. It also updates a looper counter. The second script task inserts all of the objects in the sub-list to the working memory. A rule task then runs which should create ValidationError objects for invalid rows and ExtractedField objects for valid ones. The last script task extracts the generated objects from the working memory using drools queries, and prints the results to System.out. It then retracts all facts from the working memory.

       

      During the first iteration of the loop the rules activate, are fired and the facts are retracted successfully. During the second and third iterations the rules are activated, but do not fire, however retraction still occurs successfully. During the fourth iteration the rules are again activated, fired and the facts retracted successfully. Iterations five and six are equivalent to two and three, and so on, until the list is exhausted and the process completes. I have tried various list sizes, sub-list sizes and other configurations, but this behaviour still occurs.

       

      I cannot determine the reason why the rule activations fire during some iterations and not during others. Does anyone have any suggestions or explanations?

       

      --Shaun

       

      Update:

      I ran the processes (both the original one and the simplified one that I attached) using JBPM 5.2, and it seems that the issue is resolved.