Hide Forgot
Description of problem: Executing rules from processes started in the jBPM Console is highly erratic. I find if I run start process after process, I get inconsistent and unexpected results. I believe this is probably because there is only a single knowledge session being used by the JBPM Console, and since I insert facts and don't retract them when the process completes, they are still sitting around in working memory. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: To workaround this problem I created another rule and rule task at the end of the process to retract the facts (I played around with using a script and process variables for the factHandles but this approach was not as easy). I can now run the process multiple times with expected results. I think this is a really crude solution, for the user to have to manage fact insertion and retraction from the business process. The fact insertion is somewhat expected, since there is no way for the jBPM Console to know how to create facts from input fields on a form (although this would be a useful extension to the form generation capability). But retracting facts at the end of the process is ugly. This workaround also would not work if there were multiple console users starting processes concurrently. Instead, I believe the jBPM Console should have each process instance create a new stateful session (or at least make this behavior configurable). Once the process completes, the stateful session should be disposed.
I believe that in some cases this will be desired behavior - to be able to use business rules (from within the process) that depends on external facts. If reasoning should be done only on internal process instance's facts they should not be inserted into the session but rather rules should be created that operate on process variables and insert only process instance into the session and retract it at the end of the process. This can be done with on entry and on exits scripts currently but could be a good extension if based on some configuration (on process level) that will instruct the engine to do that automatically: when started, process instance should be inserted into the session; update it in the session when variable changes; and retract it when process instances is completed/aborted. Wdyt?