Hi Martin,
I was trying to obtain that behavior using your suggestion (changing the element's behavior), then I got through
org/activiti/engine/impl/bpmn/behavior/BoundaryEventActivityBehavior.java
Hoping that I would be able to kill the token "left behind" the boundary event upon the event's execution.
Surprisingly I found that exists a boolean variable (named interrupting) that does exactly what I wanted inside the BoundaryEventActivityBehavior's execute method.
However, debugging the engine I found out that no matter what value i set on the boundary event's "cancelActivity" property , that variable is never set to true. (I forced that value hard-coding it and the behavior was what I expected).
Then I started searching where is the source of that value (false) on that variable (interrupting) and found out that it comes from org\activiti\editor\language\json\converter\BoundaryEventJsonConverter.java (line 91), where the BPMN model is being parsed.
The code is copied below ( I was testing with a timer boundary event at first ) :
<java>
boundaryEvent.setCancelActivity(getPropertyValueAsBoolean(PROPERTY_CANCEL_ACTIVITY, elementNode));
</java>
Clearly the value is being set based on the property PROPERTY_CANCEL_ACTIVITY="cancelActivity" of that elementNode variable.
The thing I found very strange is that no matter which value I set on the timer boundary event at the bpmn20.xml file, it never is present on that elementNode, which seems to be a json representation of the boundary element, right from the jackson's output (all other attributes from the XML file seems to be present). That way, the getPropertyValueAsBoolean call always resolves to false (its default for not found properties), letting the boundary event interrupted variable never be "true", thus, never working as I expect.
Is that some kind of flaw on the parsing process? why there is that "cancelActivity" option on the timer boundary event since it (seems that) is never used?
thanks in advance,
Fellipe.