locked
state machine workflow projects RRS feed

  • Question

  • Few easy questions on state machine workflows:

    (1) if i add custom activities to my Toolbox, how do i make sure that others that use this same workflow project always see the custom activities i add? (where is this info stored so i can check it in?)

    (2) if i create 2 EventDrivenActivities (1 to state A and the other to state B) on my state machine, but they are both using the same HandleExternalEvent event name (Event1), what happens to the workflow if Event1 is fired?

    (3) If i create a stage with a single event driven activity, and on that put a timeout, but that's it...(no set state)..what happens to the workflow when it's in this stage and it times out? (i.e., does it cycle back to the same state?)

    (4) when i create a new "state machine workflow library"...how to i ask VS2005 to do a XOML with code behind? (instead of a pure code workflow project?

    Many thanks!
    Friday, December 21, 2007 10:39 PM

Answers

  • The answer for 1 & 4 are correct.  Some additional information on how to add the activities to the toolbox with an installer app can be found in the post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2560618&SiteID=1.

     

    Some corrections for 2 & 3.

     

    2. I it is acceptable to be subscribing to the same event in multiple states.  Since the workflow can only be in one state at a time whichever one is the current state will receive the event.

     

    3. The delay activity implements the IEventActivity interface which is what is required to be the first child of an event driven, so it can be the only activity in an event driven that is contained in a state.  If you don't have a set state after a delay, and there are no other event drivens in the state, then the workflow will hang.  You will need to create a custom set state service to transition the workflow to another state, take a look at the post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1375501&SiteID=1 for an example.

     

     

    Saturday, December 22, 2007 3:39 AM

All replies

  • Answers:

     

    1. As far as I know, this is something they have to configure on their own copies of VS by using the Choose Items functionality.

     

    2. This is represents an invalid condition as these are supposed to be mutually exlusive. I believe you will get an error at some point after raising the event.

     

    3. How do you intend to put a timeout...you won't be able to put in a delay activity?

     

    4. Just right click on the project and choose Add New Item, select "State Machine Workflow (with Code Separation)".

    If you would like more details I can dig up some samples on these I have, but hopefully this is the guidance you were looking for.

    Saturday, December 22, 2007 12:35 AM
  • The answer for 1 & 4 are correct.  Some additional information on how to add the activities to the toolbox with an installer app can be found in the post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2560618&SiteID=1.

     

    Some corrections for 2 & 3.

     

    2. I it is acceptable to be subscribing to the same event in multiple states.  Since the workflow can only be in one state at a time whichever one is the current state will receive the event.

     

    3. The delay activity implements the IEventActivity interface which is what is required to be the first child of an event driven, so it can be the only activity in an event driven that is contained in a state.  If you don't have a set state after a delay, and there are no other event drivens in the state, then the workflow will hang.  You will need to create a custom set state service to transition the workflow to another state, take a look at the post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1375501&SiteID=1 for an example.

     

     

    Saturday, December 22, 2007 3:39 AM
  • Tom,

    thanks so much for you helpful answers.

    Once clarificiation:  #2 is asking if you have a single state with multiple events (that point to the same event interface and name)...what happens.

    For #4.  that seems crazy.  it's unacceptable that a workflow would hang.   either the designer needs to flag this as invalid (a delay with no set state), or it needs an intelligent default (e.g., defaults to same stage).

    Thanks.
    Wednesday, December 26, 2007 6:47 PM
  • If you have a single state with multiple events, that are the same and no correlation involved, the first activity to subscribe will get the message.  By hang I just mean that the workflow will remain in that state and will never complete without an external service causing it to transition.  I understand that you don't like this feature but for V1 it will not be changing.  You could always write you own custom StateValidator and add this error in if you wanted to, just remember to call base.Validate so the default validation is also run.

    Wednesday, December 26, 2007 9:01 PM