Recreating a workflow instance with the same instance id
Posted
by Miron Brezuleanu
on Stack Overflow
See other posts from Stack Overflow
or by Miron Brezuleanu
Published on 2010-03-05T10:58:43Z
Indexed on
2010/03/09
9:51 UTC
Read the original article
Hit count: 209
We have some objects that have an associated workflow instance. The objects are identified with a GUID, which is also the GUID of the workflow instance associated with the object. We need to restart (see NOTE 3 for the meaning of 'restart') the workflow instance if the workflow definition changed (there is no state in the workflow itself and it is written to support restarting in this manner).
The restarting is performed by calling Terminate
on the WorkflowInstance
, then recreating the instance with the same GUID. The weird part is that this works every other attempt (odd attempts - the workflow is stopped, but for some reason doesn't restart, even attempt - the already terminated workflow is recreated and started successfully).
While I admit that using 'second hand' GUIDs is a sign of extraordinary cheapness (and something we plan to change), I'm wondering why this isn't working. Any ideas?
NOTES:
The terminated workflow instance is passivated (waiting for a notification) at the time of the termination.
The
Terminate
call successfully deletes the data persisted in the database for that instance.We're using 'restarting' with a meaning that's less common in the context of WF - not restarting a passivated instance, but force the workflow to start again from the beginning of its definition.
Thanks!
© Stack Overflow or respective owner