cancel
Showing results for 
Search instead for 
Did you mean: 

Critical Issue with EventSubProcessMessageStartEventActivityBehavior in Alfresco Activiti Integratio

vnosach
Champ on-the-rise
Champ on-the-rise

Part 1: Serialization of isInterrupting Attribute

Activiti introduced a new attribute in StartEvent called isInterrupting. However, Alfresco has not implemented the serialization and deserialization of this attribute in JSON models.

Despite this, Alfresco relies on the isInterrupting parameter in the EventSubProcessMessageStartEventActivityBehavior. Since this parameter defaults to false due to the lack of proper implementation, message events are unable to cancel executions, causing them to malfunction.

Part 2: Handling Child Executions in Subprocesses

In EventSubProcessMessageStartEventActivityBehavior, when startEvent.isInterrupting() is correctly evaluated as true, the implementation attempts to find and cancel child executions via findChildExecutionsByParentExecutionId. However, the logic does not account for inner subprocesses or nested child executions.

As a result, when the trigger method is invoked, it leads to foreign key violations in the act_ru_execution table and rolling back transaction.

Suggested Fixes:

  1. Serialization Fix: Ensure the isInterrupting attribute is properly serialized and deserialized in the StartEventJsonConverter to align with Activiti's implementation.
  2. Nested Subprocess Handling: Update EventSubProcessMessageStartEventActivityBehavior to handle child executions recursively, ensuring all nested subprocesses are correctly cancelled. code snippet from our custom implementation CustomExecutionEntityManagerImpl

 

 

    @override
    public void cancelExecutionAndRelatedData(ExecutionEntity executionEntity, String deleteReason) {
        getAllChildExecutionsHierarchically(executionEntity).forEach(execution -> super.cancelExecutionAndRelatedData(execution, deleteReason));
        super.cancelExecutionAndRelatedData(executionEntity, deleteReason);
    }

    protected List<ExecutionEntity> getAllChildExecutionsHierarchically(ExecutionEntity executionEntity) {
        return Stream.iterate(
                        findChildExecutionsByParentExecutionId(executionEntity.getId()),
                        CollectionUtils::isNotEmpty,
                        list -> list.stream()
                                .flatMap(child -> findChildExecutionsByParentExecutionId(child.getId()).stream())
                                .toList()
                ).flatMap(List::stream)
                .sorted(comparing(ExecutionEntity::getStartTime))
                .toList();
    }
​

 

 

This issue is critical as it directly impacts the proper functioning of interrupting message events. We would appreciate for a fix in upcoming release for this.

 
 
1 REPLY 1

vnosach
Champ on-the-rise
Champ on-the-rise

could anyone comment this or maybe better to report it as issue to Alfresco team?

Getting started

Explore our Alfresco products with the links below. Use labels to filter content by product module.