How to build a dynamic workflow server in 4.0? RRS feed

  • Question

  • Use case: We have a workflow server, built on 3.5, that is used by a number of users (10+).  These users are allowed to create workflows and edit workflows -- the XAML is then saved in the database.  When the server gets a request to start a workflow, it looks up the XAML in the database and then passes into the WorkflowRunTime.CreateWorkflow.

    So now we're looking at 4.0.  I see WorkflowInvoker, which is not a good fit as our workflows are long running and require persistence.  I see the new WorkflowServiceHost, but it looks like we would need a new WSH instance for each workflow, and we're into the hundreds of workflows here, so that doesn't look like it'll scale.

    Which leaves me with WorkflowApplication.  Is that the proper answer to this? Do I need a separate WorkflowApplication object for each design?  Will that cause a problem if there are, say, 200 different designs?



    Saturday, April 10, 2010 3:39 AM

All replies

  • If using WorkflowApplication, you will need a WorkflowApplication instance for each running instance of your workflow (similar to how you had a WorkflowInstance for each instance in your 3.5 workflows)

    In 3.5 you had a single WorkflowRuntime object and you would handle the workflow lifecycle events there, in 4.0 you handle these events on the WorkflowApplication object.

    So there should be no problem if there are many different types of workflows, just when it is time to start one up (or resume one) you create a WorkflowApplication instance using the workflow definition, point it to the persistence store, handle any lifecycle events that are of interest (that is one difference from 3.5, the events are attached to the instance in 4 instead of global, and you need to handle the desired events each time you create a WorkflowApplication instance) and then start it up with a call to Run (or ResumeBookmark)

    Here are a few links to some topics, and let me know if you have any more specific questions.



    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm


    Monday, April 12, 2010 9:49 PM
  • What if I have the same scenario (many different types of workflows) in an ASP.NET application as host? Would WorkflowApplication still be the right choice?

    eg. I have a some web pages some of them to start a workflow, others to resume running instances, so I would start or resume the workflow in the method handling the post of the web page, by creating a WorkflowApplication, by giving it a xaml definition from database ? And each time I need to set  workflow persistence service on each workflowapplication?


    Does an tutorial exists somewhere on the net (msdn or other) giving a example of this type of scenario?

    Monday, April 19, 2010 7:25 PM