AnsweredAssumed Answered

BusinessRuleTask // icon + implementation

Question asked by skay on Nov 1, 2014
Latest reply on Nov 6, 2014 by skay

This topic is actually for both forums : designer and engine.

I would like to keep the bpm icon semantic of BusinessRuleTask, but we have our own RuleEngine implementation / not a drools 5.5 lib directly in the classpath, but rather a kind of remote executor.

This is currently possible / User Guide / Business Rule Task [Experimental]:

As mentioned earlier another option is to hook in the implementation of the BusinessRuleTask yourself:

<businessRuleTask id="businessRuleTask" activiti:class="${MyRuleServiceDelegate}" />
Now the BusinessRuleTask behaves exactly like a ServiceTask, but still keeps the BusinessRuleTask icon to visualize that we do business rule processing here.

I'm facing  2 problem

#1 designer
Activiti designer currently does not provide the field "activiti:class";  Curiously, this field is available in Activiti Modeler.
I can edit manually in the XML, but could you add this field in a future release of the designer ? would be great !

#2 engine
Currently, a businessRuleTaskActivityBehaviour is tightly coupled with drools.
See here below :

import org.activiti.engine.impl.rules.RulesHelper;
import org.drools.KnowledgeBase;
import org.drools.runtime.StatefulKnowledgeSession;

* activity implementation of the BPMN 2.0 business rule task.
* @author Tijs Rademakers
public class BusinessRuleTaskActivityBehavior extends TaskActivityBehavior {
  protected Set<Expression> variablesInputExpressions = new HashSet<Expression>();
  protected Set<Expression> rulesExpressions = new HashSet<Expression>();
  protected boolean exclude = false;
  protected String resultVariable;

  public BusinessRuleTaskActivityBehavior() {}


Conclusion :
I need to put the drools library within my classpath just for having the visual representation of "BusinessRuleTask" BPMN component in my process / better than just "ServiceTask" / the understanding of my bosses :)

On a technical point of view, you are not providing any param to control if the user re-use a stateful ruleEngine session or if he just need a statelessSession.
Furethermore, the usage of the RulesHelper is a little bit static and not clearly open to any customization.

A purist would say that we should rely on e.g. JSR-94 spec rather than KnowledegeBase Drools impl and custom factories.

So 2 different pieces of solutions.

We could modify the implementation of the current BusinessRuleTaskActivityBehavior into something a little more abstract.
Actually we don't need Drools at this stage / we could delegate this job to a Drooly / Custom specific implementation of the BusinessRuleTask.

A new feature of the designer/modeler would be to let the user link the freedom of bpmn tasks icons (why not custom icon?!).
E.G a new "Custom ActivityTask" / same as "serviceTask" but referencing an ActivityBehavior java class implementation as main parameter ?
, and the BPMN icon as second main parameter.

Do you see other/simpler solutions ?

I'll be glad to contribute to the small change proposed here (a) and stage the current [experimental] feature of BusinessRuleTask to a definive one.

Best Regards