Re-Publishing Workflows with existing Process Instances

  • 10 October 2007
  • 4 replies
  • 1 view

Badge +5

I'm just wondering what other people have done with regard to re-publishing process definitions where there is a need for existing process instances to use the new process definition.

I have been looking at various strategies - including re-starting the running process instances, and using the GoTo API call on them, but that only exists for Process Instances - not Worklist Items.

Think about it - if your process instance has multiple worklist items within it, there is no method build into the API to create worklist items, or move them.

The likelihood of a process definition being changed at some point is pretty high - and forming a strategy about how to deal with already existing processes is made very difficult given the process/instances integrity issues it raises.

Has anybody else done any thinking on this?
 


4 replies

Badge +13
I wish there is a more graceful way to migrate to newer process as well (when you have to add additional data field) and work with the new ASP .NET front-end.  Someone suggested to copy the data/restart the process then use GotoAPI.
Badge +5

Yes - I thought about using the GoTo API call too, but it won't handle process instances with multiple workitems (the GoTo command only exists on the process instance object).

It's a difficult call.

You could, for example, have a server event on the end of every Activity within a workflow that checks a flag somewhere, and kicks off a new process instance for itself. The downside to this is each worklist item becomes a process instance - which is fine unless you have a workflow design that collects parallel processes back up at some point.
 

I'm not sure there IS a solution - it's a classic workflow problem. 

Badge +11

Just as an FYI...


K2 [blackpearl] will cater for something similar shortly.  Haven't got exact details and/or timelines but... watch this space.


Regards,


Ockert

Badge +5

I think I've cracked this - and (after proving it in a rough prototype) will write it up for others to look at.

You can use the K2MNG to loop through all existing worklistitems, and record all their information elsewhere (your own database, for example). This is the easy bit.

The difficult bit - that I thought might be impossible - is how to recreate the process instances, each holding multiple worklistitems.

Here's what I'm building...

 
The Start Activity has a new line leading from it, with a condition in the line that a Process Property called "Flag" has "restart" written in it.

The new line leads to an activity called "Spawner". This has two lines leading from it - one that loops back on itself, and one that leads to another activity called "Mover".

Here's the theory...

1. We read our list of what previously existed for a process instance, and use it to control the looping through Spawner.

2. The loop line rule will return true as many times as is needed according to the number of worklist items needed.

3. The line leading to Mover will always be true - therefore generating a worklist item each time it loops.

4. The mover activity does a K2.GotoActivity() on each worklist item - putting it back where it was before the restart.

** Correction - Point 4 has to be done in software too - the ServerEventContext makes the whole thing move. The utility software will need to grab each worklistitem in the Mover Activity and move it through the K2ROM. 

5. We write a software utility to whiz through the new worklistitems and call Redirect() on them - putting them back with the user who originally had them.

 

The  process SOUNDS a lot more complex than it looks, but I believe it's the only sensible way of restarting process instances with multiple worklist items. It will work for Black Pearl too.

Reply