cancel
Showing results for 
Search instead for 
Did you mean: 

Migrating process instances to newer versions

hamed1369
Champ in-the-making
Champ in-the-making
Hi
I am M.S Student in Software Engineering, in Sharif University Of Technology,
I am interested in Dynamic Workflow and I've studied some papers in this field and trying to prepare my proposal. But it's so strange to me that there is no proven mechanism in Activiti Engine to handle the problem of "Migrating process instances to newer versions" with progressive policy. I mean, adapting active processes to new Schema (PD) if it's possible (It may be impossible).
My Question is, Why there is no proven implemented mechanism in Activiti Engine to handle this?
I love Activiti and really interested to contribute and solve any probable and preventive problem of this field in my thesis.
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
Take a look at org.activiti.engine.impl.cmd.SetProcessDefinitionVersionCmd:


/**
* {@link Command} that changes the process definition version of an existing
* process instance.
*
* Warning: This command will NOT perform any migration magic and simply set the
* process definition version in the database, assuming that the user knows,
* what he or she is doing.
*
* This is only useful for simple migrations. The new process definition MUST
* have the exact same activity id to make it still run.
*
* Furthermore, activities referenced by sub-executions and jobs that belong to
* the process instance MUST exist in the new process definition version.
*
* The command will fail, if there is already a {@link ProcessInstance} or
* {@link HistoricProcessInstance} using the new process definition version and
* the same business key as the {@link ProcessInstance} that is to be migrated.
*
* If the process instance is not currently waiting but actively running, then
* this would be a case for optimistic locking, meaning either the version
* update or the "real work" wins, i.e., this is a race condition.
*
* @see http://forums.activiti.org/en/viewtopic.php?t=2918
* @author Falko Menge
*/
[code]

This is no "official" command offered in the API, but we welcome you to review this and propose solutions to make this more "standard"

jperez11
Champ in-the-making
Champ in-the-making
Hello Frederik,

Is it possible to invoke SetProcessDefinitionVersionCmd from inside an event? I've been trying, but I'm affraid is not possible because the new deployment has not been created yet. Thanks.

Kind regards,
Jonathan.