I have a very long running workflow that moves video files around between video processing devices and then reports the files state to a database which is used to drive a UI
At times the users press a button on the UI to “Accept” a file into a video storage server. This involves copying a file from one server to another.]
They have asked if this activity can be cancelled.
I’ve looked at the wf4 documentation and I can’t see a way to roll back part of a workflow.
Is this possible and what technique should I use.
Okay, so let’s first say that the processing of “rolling back” what was already uploaded will have to be done by hand, so where ever you’re storing those chunks you’ll need to clean up by hand when they cancel.
Now, on to the workflow itself, in my opinion you could setup your
FlowChartlike this:Alright so let’s break down this workflow. The entire service should be correlated on some client key so that way you can start the service with
Startonce per client to keep the startup costs down.Next, when said client wants to start a transfer you’ll call
BeginTransferwhich will move into the transfer loop. The transfer loop is setup so that you can cancel between chunks if necessary by callingCancelTransfer.That same branch, in this model, is used to finish the transfer as well because it gets out of the loop, so when your done transferring chunks just call
CancelTransfer(if you don’t like that just setup a different branch that looks exactly the same).Finally, when you’re in the process loop, you can
SoftExitthe entire workflow and shut it down so that you can kill it softly if there is necessary maintenance or when the client is finished with its connection it needs to callSoftExitto dispose of it.