Hi,
The following is the scenario I am trying to fix by making use of the Activity Execution Context:
I have a Custom Sequential Workflow Activity (extending from a SequentialWorkflowActivity) in which I override the Execute(..) method. In the overrided method I put in logic for re-executing particular activities based on the external stimulus (user input).
I have re-hosted the workflow designer in a windows application. The base workflow activity will be my Custom Sequential Workflow activity. I drag in a few activities, say 4 activities and start executing the workflow. After the execution of activity2, I suspend the workflow and unload the same into my persistent store.
Now, in my re-hosted designer, I would set a break point at activity3 ( the logic for breakpoint is also implemented) for verifying the correctness of the flow until activity3 (i.e. activity 2). I would then select an activity and mark it as the start activity for re-execution (say activity1).
So, when the workflow is resumed, the execution should start again from activity1 and will proceed until activity3 where it will stop due to the breakpoint.
Now this is what I did:
1. I created a WorkflowQueue on which I captured the name of the activity from which the re-execution is supposed to start.
2. I enqueue the name of the activity on to the Workflow Queue when the workflow instance resumes.
3. I then create a new activity execution context for this selected activity by picking the name of the activity from the Queue.
In this process I encountered the following situation:
a. If I register the QueueItemAvailable event, in the event method where I create a child execution context, the next activity that is the activity3 is first executed and then it goes back to activity1 for execution. This means that atleast one next activity from the suspended activity is executed before it goes back to activity1.
b. If I register the QueueItemArrived event, it gets into the Event Handler but it cannot identify the ActivityExecutionContext because the sender is the Workflow Queueing Service and not the Activity Execution Context.
My Basic aim is to create a debugging kind of a scenario where i can go back to any activity and execute it until a point where I have set the breakpoint. And I may do this any number of times.
Please let me know a solution for this problem. Any other approach suggested, better than this is also welcome.