locked
WF4 TrackingParticipant. RRS feed

  • Question

  • Hello !

    I am using WF4 for a little project and using a CustomTrackingParticipant to track the Activity Execution States. However, (I may be wrong) it seems that the "Executing stateoccurs at the end of the execution together with the "Closed" state. I am using:

    • WorkflowApplication to run the workflow
    • AsyncCodeActivity
    • BeginTrack and EndTrack for the TrackingParticipant.

    I'm not sure if the State is changing on time but reported late ! or actually changed at the end of the execution (Which would not make much sense).

    Please assist.

    Cheers

    Friday, October 4, 2013 2:02 PM

Answers

  • Hi !

    I managed to find a workaround through dynamicActivity! but looks so ugly, I am happy to share it but still open for any suggestions:

    var parallel1 = new Parallel

    {

    Branches =

    {

    new DynamicActivity

    {

    DisplayName =

    "DynAct1",

    Implementation = () =>

    new Act1()

    },

    //-----------------------------------

    new DynamicActivity

    {

    DisplayName =

    "DynAct2",

    Implementation = () =>

    new Act2()

    },

    //-----------------------------------

    new DynamicActivity

    {

    DisplayName =

    "DynAct3",

    Implementation = () =>

    new Act3()

    }

    },

    DisplayName =

    "Par"

    ,CompletionCondition = (

    false)

    }

    • Marked as answer by SkyCaptain13 Tuesday, October 8, 2013 3:44 PM
    Monday, October 7, 2013 9:21 AM

All replies

  • I have tried the same thing with the Delay() activity and showed exactly what I wanted ! as in Executingthen later Closed
    Friday, October 4, 2013 3:28 PM
  • I think that behavior is due to "Executing" state is tracked when Activity.Execute method returns. Note that a lot of activities like sequence, do while, and other containers activities, the execute method returns before the activity completes. These activities just schedule other activities in the execute method. Other activities créate bookmaks in the execute method.
    Friday, October 4, 2013 5:00 PM
  • Hi Jesús!

    Thanks for the post. What you've said makes sense. However, I know that the "Executing" state of any activity occurs as soon as the activity has started (I've checked it myself with a breakpoint and Add watch /*Traditional method :)  */). The only problem is that fact that the Tracking participant does not return the states on time and waits until the completion to return both "Executing" and "Closed/ Faulted". I will have to look into that a bit, but you/ anyone can help, I'm open for suggestions. I am planning to try and Schedule sub-activities instead of running them..... Will let you know.

    Many thanks,

    Monday, October 7, 2013 8:44 AM
  • Hi !

    I managed to find a workaround through dynamicActivity! but looks so ugly, I am happy to share it but still open for any suggestions:

    var parallel1 = new Parallel

    {

    Branches =

    {

    new DynamicActivity

    {

    DisplayName =

    "DynAct1",

    Implementation = () =>

    new Act1()

    },

    //-----------------------------------

    new DynamicActivity

    {

    DisplayName =

    "DynAct2",

    Implementation = () =>

    new Act2()

    },

    //-----------------------------------

    new DynamicActivity

    {

    DisplayName =

    "DynAct3",

    Implementation = () =>

    new Act3()

    }

    },

    DisplayName =

    "Par"

    ,CompletionCondition = (

    false)

    }

    • Marked as answer by SkyCaptain13 Tuesday, October 8, 2013 3:44 PM
    Monday, October 7, 2013 9:21 AM