I have a windows workflow foundation workflow that contains a parallel activity. Inside this parallel activity, there are sequences of activities that can take quite a long time (both the sequences and the activities inside the sequences).
These activities are derived from NativeActivity and use bookmarks and System.Threading.Tasks.Task to perform their work.
Generally, running them in parallel works fine.
Now I would like to add Persist-activities at several places throughout the parallel branches.
Let's imagine we have two parallel branches A, B with activities 1,2 in A, and 3,4 in B.
The asterisk symbol is indicating that something is running:
| Branch A | Branch B |
|##############|##############|
| Activity 1 | Activity 3 |
| | PERSIST |
| *Activity 2* | Activity 4 |
| PERSIST | |
| Activity 5 | *Activity 6* |
A has closed 1, and is executing 2, it has not persisted yet. B has closed 3, persisted, closed 4, and is now executing 6. The server dies
Now if I restart the server and resume the WF instance, I would like to see branch A start from 1 again, and B start from 4.
| Branch A | Branch B |
|##############|##############|
| *Activity 1* | Activity 3 |
| | PERSIST |
| Activity 2 | *Activity 4* |
| PERSIST | |
| Activity 5 | Activity 6 |
So to put it in words, the behaviour I would like to see is that for each of the parallel branches the persist should only apply to the branch it lies in.
As I think the whole workflow is persisted, I am assuming this is not how it works, but I would love to be proven wrong! So, can I achieve this behaviour?