cancel
Showing results for 
Search instead for 
Did you mean: 

Clarification regarding different statuses of a process instance

mittalabhi86
Champ in-the-making
Champ in-the-making
Hi,

In one of my project, I am using activiti 5.13.
I want to have some clarifications regarding various possible statuses a process instance can be in.

1. From where do ProcessInstance.isSuspended flag's value is picked up by activiti engine? Asking this because, it's always shown as false, even when SUSPENSION_STATE_ in ACT_RU_EXECUTION is '1'.
2. From where do ProcessInstance.isEnded flag's value is picked up by activiti engine? Is it negation of IS_ACTIVE_ in ACT_RU_EXECUTION?

My understanding on these flags is following. Please correct me if I am wrong:
1. Active - Process is running. Record is there in ACT_RU_EXECUTION & ACT_HI_PROCINST. SUSPENSION_STATE_ = false, & IS_ACTIVE_ = true.
2. Suspended - Process is presently/permanently halted. Record is there in ACT_RU_EXECUTION & ACT_HI_PROCINST. SUSPENSION_STATE_ = true.
3. Completed - Process has ended. Record is there in ACT_HI_PROCINST only. SUSPENSION_STATE_ = true.

If all of these statements are correct, then I do not understand the signification of records where both IS_ACTIVE_ & SUSPENSION_STATE_ are true Smiley Sad

Beside these, if there are any other possible status for a process instance, please let me know about them as well. I would really appreciate.

Also, I know a bit offtrack, but is there any specific reason for not extending HistoricProcessInstance from ProcessInstance, since basically HistoricProcessInstance = ProcessInstance + (some audit/log fields)

Regards
Abhishek

4 REPLIES 4

trademak
Star Contributor
Star Contributor
Hi,

1. isSuspended is definitely not always false. We have a couple of unit tests that test for a value of true (ProcessDefinitionSuspensionTest for example). So yes this value should be true when the process instance is suspended.
2. That's correct

Your statements are correct. Only for 3 I would expect SUSPENSION_STATE to be false.

The reason why HistoricProcessInstance is not extending ProcessInstance is for historic reasons.

Best regards,

mittalabhi86
Champ in-the-making
Champ in-the-making
Hi,

Thanks a lot for the clarification.
It was a typo in statement 3 (I intended to write false. My bad).
Though, most of the doubts are cleared, I am still struck with one thing.

In ACT_RU_EXECUTION table, the value of SUSPENSION_STATE_ = 1 for all the records. Which suggests that these records are in suspended state, thus residing in this table. They would have been deleted from here, had they got complete. But, the isSuspended flag in ProcessInstance object returns me false for these object. That's why, I am not able to make out from where is the value of this flag picked?

Regards
Abhishek

frederikherema1
Star Contributor
Star Contributor

<resultMap id="executionResultMap" type="org.activiti.engine.impl.persistence.entity.ExecutionEntity">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="revision" column="REV_" jdbcType="INTEGER" />
    <result property="processInstanceId" column="PROC_INST_ID_" jdbcType="VARCHAR" />
    <result property="businessKey" column="BUSINESS_KEY_" jdbcType="VARCHAR" />
    <result property="processDefinitionId" column="PROC_DEF_ID_" jdbcType="VARCHAR" />
    <result property="activityId" column="ACT_ID_" jdbcType="VARCHAR" />
    <result property="isActive" column="IS_ACTIVE_" jdbcType="BOOLEAN" />
    <result property="isConcurrent" column="IS_CONCURRENT_" jdbcType="BOOLEAN" />
    <result property="isScope" column="IS_SCOPE_" jdbcType="BOOLEAN" />
    <result property="isEventScope" column="IS_EVENT_SCOPE_" jdbcType="BOOLEAN" />
    <result property="parentId" column="PARENT_ID_" jdbcType="VARCHAR" />
    <result property="superExecutionId" column="SUPER_EXEC_" jdbcType="VARCHAR" />
    <result property="suspensionState" column="SUSPENSION_STATE_" jdbcType="INTEGER"/>
    <result property="cachedEntityState" column="CACHED_ENT_STATE_" jdbcType="INTEGER"/>
  </resultMap>

Suspension state is read into the ExecutionEntity when fetched, and the isSuspended() is based on that. Please not that SUSPENDED_STATE_ will be 1 for active processes and 2 for suspended processes.

mittalabhi86
Champ in-the-making
Champ in-the-making
Thanks so much. We were confused, since we took it as a bool/bit, rather an enum. This makes perfect sense now.

Thanks!